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

GenericTest - function_exists failed to proceed expected assertion with Polyfills #57

Closed
llaville opened this issue Oct 13, 2020 · 1 comment
Assignees
Milestone

Comments

@llaville
Copy link
Owner

While, I've just fixed all tests running with PHP 8.0.0RC1 (see issue #48), I realized that running unit tests on other platforms PHP 7.x gave unpected results.

i.e:

devilbox@php-7.2.34 in /shared/backups/bartlett/php-compatinfo-db $ /shared/backups/php/phpunit-8.5.phar --stop-on-failure
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

..............................................SS...........    59 / 12586 (  0%)
...........................................................   118 / 12586 (  0%)
...........................................................   177 / 12586 (  1%)
...........................................................   236 / 12586 (  1%)
...........................................................   295 / 12586 (  2%)
.................SS........................................   354 / 12586 (  2%)
...............................................SSSSSSSSSSSS   413 / 12586 (  3%)
S......................SSSSSSSS....................SSSSSSSS   472 / 12586 (  3%)
.........................................................SS   531 / 12586 (  4%)
SSS........................................................   590 / 12586 (  4%)
...........................................................   649 / 12586 (  5%)
...........................................................   708 / 12586 (  5%)
...........................................................   767 / 12586 (  6%)
F

Time: 13.35 seconds, Memory: 140.00 MB

There was 1 failure:

1) Bartlett\Tests\CompatInfoDb\Reference\Extension\CoreExtensionTest::testGetFunctionsFromReference with data set #38 ('get_resource_id', array('Core', '8.0.0alpha1', '', '8.0.0alpha1', '', '', '', array(), ''), 3)
Function 'get_resource_id', found in Reference (8.0.0alpha1,), exists.
Failed asserting that true is false.

/shared/backups/bartlett/php-compatinfo-db/tests/Reference/GenericTest.php:549
/shared/backups/bartlett/php-compatinfo-db/tests/Reference/GenericTest.php:478
/shared/backups/bartlett/php-compatinfo-db/tests/Reference/GenericTest.php:853

FAILURES!
Tests: 768, Assertions: 721, Failures: 1, Skipped: 38.

Reason is not a regression but usage of polyfills.

When Symfony Components are installed, there are also Symonfy/Polyfill

devilbox@php-7.2.34 in /shared/backups/bartlett/php-compatinfo-db $ composer why symfony/polyfill-php80
symfony/config                v5.1.7  requires  symfony/polyfill-php80 (^1.15)
symfony/console               v5.1.7  requires  symfony/polyfill-php80 (^1.15)
symfony/dependency-injection  v5.1.7  requires  symfony/polyfill-php80 (^1.15)
symfony/string                v5.1.7  requires  symfony/polyfill-php80 (~1.15)

To resume the situation, use function_exists is a trap !!!

We will replace it by either :

That will allow us to detect if function really exists or if it's a polyfill.

@llaville
Copy link
Owner Author

devilbox@php-7.2.34 in /shared/backups/bartlett/php-compatinfo-db $ /shared/backups/php/phpunit-8.5.phar tests/Reference/Extension/CoreExtensionTest.php
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

...............................................................  63 / 442 ( 14%)
............................................................... 126 / 442 ( 28%)
............................................................... 189 / 442 ( 42%)
............................................................... 252 / 442 ( 57%)
............................................................... 315 / 442 ( 71%)
............................................................... 378 / 442 ( 85%)
...............................................SS.............. 441 / 442 ( 99%)
.                                                               442 / 442 (100%)

Time: 2.25 seconds, Memory: 22.00 MB

OK, but incomplete, skipped, or risky tests!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant