Skip to content

Conversation

@claylo
Copy link
Contributor

@claylo claylo commented Mar 10, 2022

All tests run now with PHPUnit 9.5.18 + text report of code coverage (tested with ext-pcov).

@tflori
Copy link
Member

tflori commented Mar 10, 2022

I would like to merge this but I'm afraid it will fail with php7.1 because phpunit 9.5 is not compatible. but compatibility with php8 is definitely a thing...

Do we need so many changes? can we not just add it to the composer.json?

@claylo
Copy link
Contributor Author

claylo commented Mar 10, 2022

Hi Thomas,

Since PHPUnit 9 is only a requirement for running the tests, I don't believe there's a need to change the PHP 7.1 requirement. I updated composer.json to allow installation of PHPUnit 9 ... not only with the PHPUnit version itself, but also the "PHP" requirement of >=7.1 || ^8.0.

I updated the : void returns for your tests using php-cs-fixer (as suggested here), and made only two other substantive changes to GetOpt\Test\Printer (New inheritance fromPHPUnit\TextUI\DefaultResultPrinter), changed 3 instances of formatWithColor to colorizeTextBox in GetOpt\Test\Printer (a PHPUnit 8 change, I believe), and one change in GetOpt\Test\OptionParserTest from assertInternalType to assertArray.

No functional changes were made to anything -- this was all just so I could run the test suite with PHPUnit 9 and PHP 8. :)

You are correct that these tests won't run on PHP 7.1 (per PHPUnit 9's supported versions), but both PHP 7.1 and PHPUnit 7 are over 2 years out of date. I'll understand if you don't want to merge this on those grounds, however. composer install does not work on this repository as-is with PHP 8.1.3, which is what started me down this path this morning.

I've been using the library successfully and happily on PHP 8.1.3, so installing the package in my project with 8.1.3 has not been an issue at all.

@tflori
Copy link
Member

tflori commented Mar 11, 2022

I've merged your changes to a branch on this repo so that CI get's executed: https://gitlab.com/thflori/getopt-php/-/pipelines/490096079

As you can see the tests are now not working in php 7.1 and 7.2 because of the php requirement from phpunit.

I additionally removed the custom printer, selected any phpunit and added a printer that works in all phpunit versions:
e9eb44b

Unfortunately there is an issue with limedeck/phpunit-detailed printer - so that this also fails on php 7.1 and php 7.2:
LimeDeck/phpunit-detailed-printer#23

@tflori
Copy link
Member

tflori commented Mar 11, 2022

I added another commit that installs the correct version per php version:
9040594

Thanks for your contribution. FYI: I will close this one in favor of #176

@tflori tflori closed this Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants