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
PHPUnit 6 compatiblity #93
Comments
Hopefully all public API of test case classes remained the same and extending them from different parent class would do the trick. |
I'll give it a try today. Should not be that hard. |
You can also try changing the |
Yep. Right now it's PHPUNIT 4.8 for all PHP versions. According to https://docs.travis-ci.com/user/languages/php/#Choosing-PHP-versions-to-test-against travis uses installed version found in I would suggest do add a # .travis.yml
...
php:
- 7.0
- 7.1 # added
- hhvm
...
install:
- composer update phpunit/phpunit # added
- composer require satooshi/php-coveralls:^1.0 --dev This would result in following matrix:
With this setup the .travis.yml wouldn't grow that much. What do you think? Btw: Why is 7.0 marked as |
That would 2 different PRs:
Because at the time |
I think there will be 3 PRs:
|
Hmmm. I currently stuck with following problem: @aik099 Do you know if it's possible to execute tests with e.g. PHPUnit 4.8 while library code uses a different PHPUnit version e.g. PHPUnit 6.2?
@aik099 What do you think about a new major release for PHPUnit 6 support? This would result in cleaner code (less if else constructs). |
Then we need to:
I guess no, because at time of PHPUnit 4.x development it wasn't aware that different class names will be used in PHPUnit 6.x.
Any examples?
You mean drop support for PHPUnit 4.x and 5.x? If that is so, then I'm against that. I don't want anyone to force upgrade to PHPUnit 6 to get latest features of this library. |
if ( $test instanceof \PHPUnit_Framework_TestSuite_DataProvider ) { could become if ( $test instanceof \PHPUnit_Framework_TestSuite_DataProvider || $test instanceof \PHPUnit\Framework\DataProviderTestSuite ) { or something like if ( $test instanceof PHPUnitCompatibilityClassNames::DATA_PROVIDER ) {
# in PHPUnitCompatibilityClassNames the const DATA_PROVIDER will be set by PHPUnit version
Another possibility would be to maintain two branches. One with PHPUnit 4.x and 5.x and the other one with PHPUnit 6.x. But I fear it's to much overhead?! |
I see no way to make type hints compatible with both PHPUnit 6.x and below.
That would be too much indeed. |
Maybe we can create polyfill the way, that we create PHPUnit 6.x class by extending from PHPUnit 5.x/5.x class. Then in code we use PHPUnit 6 classes in all places. Include polyfills in test suite bootstrap file. Not sure how PhpStorm test runner would react to such trick though. |
for the testsuite, your don't need anything special: just use the namespaced classes (and bump the min PHPUnit version to 4.8.35 as older 4.8 releases don't have them) |
I thought, that namespaced classes were only added in PHPUnit 6.x. |
Well, the namespace version of a few classes (the one used when writing tests rather than when extending PHPUnit) have been shipped in 4.8.35 and in 5.4.3+, to allow users to migrate their testsuites progressively (before 6.0, these classes are extending the kind of polyfills you described above btw). |
Nice. Then @robertfausk could make use of them. |
I will give it a try after #94 has finished build and is merged.
Same solution like AbstractPHPUnitCompatibilityTestCase should do the trick. |
So what's the state of this? Considering how quick PHPUnit is doing it's releases, that change method signatures/visibility, that we're using I'm proposing to:
|
So now that another year passed... can we expect any progress on this issue in the near future? |
If somebody is using this, then a PR is welcome. My personal choice is avoid using new PHPUnit version, since IMO they don't bring anything new except BC breaks. The only things developer need are |
Well partly true. Some PHP frameworks do require a PHPUnit version of 6 or higher to work. That makes this library unusable with them. |
We're also having same problem in Mink library itself. Maybe a new project like |
The PHPUnit-Mink v2.3.0 release added support for all PHPUnit versions up to 9.x. |
PHPUnit 6 release changed
PHPUnit_Framework_TestCase
class into\PHPUnit\Framework\TestCase
and therefore anyextends PHPUnit_Framework_TestCase
in this project now fails with this error:Maybe https://github.com/minkphp/phpunit-mink/blob/master/library/aik099/PHPUnit/AbstractPHPUnitCompatibilityTestCase.php can be updated to not only support PHPUnit 5 and 4, but also PHPUnit 6.
The text was updated successfully, but these errors were encountered: