Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
edorian opened this issue Sep 24, 2012 · 0 comments
Closed

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

edorian opened this issue Sep 24, 2012 · 0 comments

Comments

@edorian
Copy link
Sponsor Contributor

edorian commented Sep 24, 2012

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 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants