1

I've got a unit test that's acting funny. The test passes, but the code coverage report shows one particular line, which is a comment, to be - not covered, and this affects the code coverage statistics:

enter image description here

The definition for the class being tested looks as follows:

class User implements UserInterface, \Serializable

When I remove the , \Serializable part, the problem disappears, but then my code will break in other ways, which is not a solution.

Does anyone have an idea why this could be happening?

phpunit --version 

PHPUnit 3.6.11 by Sebastian Bergmann.

5
  • 1
    Maybe it's warning that it never returns a value? Commented Jun 13, 2012 at 5:43
  • I tried removing the @return, but it has no effect. Commented Jun 13, 2012 at 18:48
  • When I remove the @param line from the comment the problem disappears, but then that's the docblock and phpcs down the drain. Commented Jun 14, 2012 at 5:51
  • Another observation I made is when I remove the implements \Serializable part from my class, the problem completely disappears. Commented Jun 14, 2012 at 5:55
  • 1
    I've created a bug report on Github: github.com/sebastianbergmann/php-code-coverage/issues/101 Commented Jun 14, 2012 at 6:32

1 Answer 1

1

Looks like a bug in the PHPUnit token stream parser and the behavior is definitely not in any way expected.

I don't think you can do more than what you already did by creating the bug report.

Sign up to request clarification or add additional context in comments.

1 Comment

I agree, I'll leave the code as is, and wait for the next update from the developers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.