rectorphp / rector-phpunit

Rector upgrade rules for PHPUnit
http://getrector.com
MIT License
62 stars 47 forks source link

[BetterReflection 6.x] Fix assert($startLine > 0) on CreateMockToAnonymousClassRector #170

Closed samsonasik closed 1 year ago

samsonasik commented 1 year ago

@staabm this should fix https://github.com/rectorphp/rector-phpunit/issues/169

samsonasik commented 1 year ago

Before

 vendor/bin/phpunit tests/Rector/ClassMethod/CreateMockToAnonymousClassRector/CreateMockToAnonymousClassRectorTest.php
PHPUnit 10.0.19 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.13
Configuration: /Users/samsonasik/www/rector-phpunit/phpunit.xml

F.F                                                                 3 / 3 (100%)

Time: 00:01.215, Memory: 88.50 MB

There were 2 failures:

1) Rector\PHPUnit\Tests\Rector\ClassMethod\CreateMockToAnonymousClassRector\CreateMockToAnonymousClassRectorTest::test with data set #0
assert($startLine > 0)

After

vendor/bin/phpunit tests/Rector/ClassMethod/CreateMockToAnonymousClassRector/CreateMockToAnonymousClassRectorTest.php
PHPUnit 10.0.19 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.13
Configuration: /Users/samsonasik/www/rector-phpunit/phpunit.xml

...                                                                 3 / 3 (100%)

Time: 00:01.215, Memory: 88.50 MB

OK (3 tests, 3 assertions)
samsonasik commented 1 year ago

@TomasVotruba I am merging it ;)

staabm commented 1 year ago

fix confirmed, thank you!

staabm commented 1 year ago

btw: wondering why it did not fail in CI... seems there is some coverage missing

samsonasik commented 1 year ago

that's depends on zend_assertion setting https://www.php.net/manual/en/ini.core.php#ini.zend.assertions