Skip to content

One Trait & Class in the same file: Total Coverage: 200.00% 2 / 2  #118

@edorian

Description

@edorian

Total shows 200%. If this is intentional I'm not understanding it :)

If one of the classes is not complety covered it shows 1/2 100% so I'm fairly sure thats a bug :)

...

cat Trait.php

<?php

class TraitUser {

    use MyTrait;

}

trait MyTrait {

    public function foo() {
        return 1;
    }

}

cat TraitTest.php

<?php

require __DIR__ . '/Trait.php';

class TraitTest extends PHPUnit_Framework_TestCase {

    public function testTrait() {
        $x = new TraitUser();
        $this->assertSame(1, $x->foo());
    }

}

Running:

 phpunit --coverage-html foo  TraitTest.php && firefox foo/index.html 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions