sebastianbergmann / phpcov

TextUI frontend for php-code-coverage
BSD 3-Clause "New" or "Revised" License
226 stars 58 forks source link

Broken tests #43

Closed sebastianbergmann closed 8 years ago

sebastianbergmann commented 8 years ago

After finally (sorry!) merging the pull requests sent by @bryanagee, @MajorCaiger, @fatalcoder, and @vpx, there are now failing tests:

PHPUnit 4.8.19 by Sebastian Bergmann and contributors.

FFF

Time: 40 ms, Memory: 4.00Mb

There were 3 failures:

1) SebastianBergmann\PHPCOV\PatchCoverageTest::testPatchCoverageIsCalculatedCorrectly with data set #0 ('patch')
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'numChangedLinesThatAreExecutable' => 2
-    'numChangedLinesThatWereExecuted' => 1
+    'numChangedLinesThatAreExecutable' => 0
+    'numChangedLinesThatWereExecuted' => 0
     'changedLinesThatWereNotExecuted' => Array (
-        'Example.php' => Array (...)
     )
 )

/usr/local/src/phpcov/tests/PatchCoverageTest.php:38

2) SebastianBergmann\PHPCOV\PatchCoverageTest::testPatchCoverageIsCalculatedCorrectly with data set #1 ('patch2')
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'numChangedLinesThatAreExecutable' => 2
-    'numChangedLinesThatWereExecuted' => 1
+    'numChangedLinesThatAreExecutable' => 0
+    'numChangedLinesThatWereExecuted' => 0
     'changedLinesThatWereNotExecuted' => Array (
-        'Example.php' => Array (...)
     )
 )

/usr/local/src/phpcov/tests/PatchCoverageTest.php:38

3) SebastianBergmann\PHPCOV\PatchCoverageTest::testPatchCoverageIsCalculatedCorrectly with data set #2 ('patch3')
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'numChangedLinesThatAreExecutable' => 2
-    'numChangedLinesThatWereExecuted' => 1
+    'numChangedLinesThatAreExecutable' => 0
+    'numChangedLinesThatWereExecuted' => 0
     'changedLinesThatWereNotExecuted' => Array (
-        'Example.php' => Array (...)
     )
 )

/usr/local/src/phpcov/tests/PatchCoverageTest.php:38

FAILURES!
Tests: 3, Assertions: 3, Failures: 3.
MajorCaiger commented 8 years ago

Hi all

I just temporarily reverted my changes locally and the tests still fail. Interestingly, I changed the composer versions of some dependencies, back to a previous version that should be supported, and the test still failed, but with a different output.

Also, on my fork of the repo, the tests were running fine back when I submitted, but now seem to fail after I have composer updated. Could this be related to changes in one of the dependencies? Unfortunately I don't know what the previous versions I was using are.

MajorCaiger commented 8 years ago

HI all

I have just checked out the last commit prior to any of our changes, updates composer and ran the tests.

There are the same failures appearing (See below).

~/Development/Projects/phpcov (master) -> git checkout b890e390724be2ae18189ddd5e717d03f77f0299
Note: checking out 'b890e390724be2ae18189ddd5e717d03f77f0299'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at b890e39... "symfony/finder": "~2.2" -> "symfony/finder": "~2|~3"
-----------------------------------------------------------
~/Development/Projects/phpcov ((b890e39...)) -> composer update
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
-----------------------------------------------------------
~/Development/Projects/phpcov ((b890e39...)) -> phpunit -c build
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

F

Time: 70 ms, Memory: 5.75Mb

There was 1 failure:

1) SebastianBergmann\PHPCOV\PatchCoverageTest::testPatchCoverageIsCalculatedCorrectly
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'numChangedLinesThatAreExecutable' => 2
-    'numChangedLinesThatWereExecuted' => 1
+    'numChangedLinesThatAreExecutable' => 0
+    'numChangedLinesThatWereExecuted' => 0
     'changedLinesThatWereNotExecuted' => Array (
-        'Example.php' => Array (...)
     )
 )

/Users/rob/Development/Projects/phpcov/tests/PatchCoverageTest.php:37
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:179
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:132

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

My guess is that these failures are due to changes in a composer dependency. I can attempt to narrow it down, but it may take some time. @sebastianbergmann Maybe you could shed a little light?

Thanks

Rob

MajorCaiger commented 8 years ago

Actually....

What I said isn't correct.

For the tests to run, you need to create a file called /tmp/example/Example.php then all tests run correctly.

After doing this locally, all tests run and pass.

I remember getting stuck at this point while I was making my changes.

~/Development/Projects/phpcov {master} -> touch /tmp/example/Example.php
-----------------------------------------------------------
~/Development/Projects/phpcov {master} -> phpunit -c build
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

...

Time: 70 ms, Memory: 5.50Mb

OK (3 tests, 3 assertions)

Thanks

Rob

sebastianbergmann commented 8 years ago

Cannot reproduce this anymore.