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

Not compatible with PHPUnit 7.0.0 #117

Open
sudar opened this Issue Feb 12, 2018 · 3 comments

Comments

Projects
None yet
5 participants
@sudar
Contributor

sudar commented Feb 12, 2018

In PHPUnit 7.0.0, the phpunit framework has added return types to all the methods in the \PHPUnit\Framework\TestCase class.

The WP_Mock\Tools\TestCase class extends \PHPUnit\Framework\TestCase and therefore these methods also should explicitly add the return types. If not PHP is throwing fatal errors.

Some sample errors that are thrown are

Fatal error: Declaration of WP_Mock\Tools\TestCase::run(?PHPUnit\Framework\TestResult $result = NULL) must be compatible with PHPUnit\Framework\Test::run(?PHPUnit\Framework\TestResult $result = NULL): PHPUnit\Framework\TestResult in /Users/sudar/Dropbox/code/wp/bulk-wp/bulk-move/vendor/10up/wp_mock/php/WP_Mock/Tools/TestCase.php on line 14
Fatal error: Declaration of WP_Mock\Tools\TestCase::run(?PHPUnit\Framework\TestResult $result = NULL): WP_Mock\Tools\PHPUnit\Framework\TestResult must be compatible with PHPUnit\Framework\Test::run(?PHPUnit\Framework\TestResult $result = NULL): PHPUnit\Framework\TestResult in /Users/sudar/Dropbox/code/wp/bulk-wp/bulk-move/vendor/10up/wp_mock/php/WP_Mock/Tools/TestCase.php on line 14
Fatal error: Declaration of WP_Mock\Tools\Constraints\ExpectationsMet::matches($other) must be compatible with PHPUnit\Framework\Constraint\Constraint::matches($other): bool in /Users/sudar/Dropbox/code/wp/bulk-wp/bulk-move/vendor/10up/wp_mock/php/WP_Mock/Tools/Constraints/ExpectationsMet.php on line 40
Fatal error: Declaration of WP_Mock\Tools\Constraints\ExpectationsMet::additionalFailureDescription($other) must be compatible with PHPUnit\Framework\Constraint\Constraint::additionalFailureDescription($other): string in /Users/sudar/Dropbox/code/wp/bulk-wp/bulk-move/vendor/10up/wp_mock/php/WP_Mock/Tools/Constraints/ExpectationsMet.php on line 40

etc.

@jmichaelward

This comment has been minimized.

jmichaelward commented Feb 20, 2018

I just came here to open the same issue. +1.

@manuelRod

This comment has been minimized.

manuelRod commented May 14, 2018

same here

@ericmann ericmann self-assigned this May 14, 2018

@ericmann ericmann added the bug label May 14, 2018

@spikeydaiki

This comment has been minimized.

spikeydaiki commented May 23, 2018

I have the same problem with PHPUnit_Extensions_Selenium2TestCase

Fatal error: Declaration of PHPUnit_Extensions_Selenium2TestCase::run(?PHPUnit\Framework\TestResult $result = NULL) must be compatible with PHPUnit\Framework\Test::run(?PHPUnit\Framework\TestResult $result = NULL): PHPUnit\Framework\TestResult in /Applications/XAMPP/xamppfiles/htdocs/Project_PRAEPOM/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php

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