Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Updagrding PHPUnit from v9 to 11 #1429

Open
rugk opened this issue Oct 18, 2024 · 0 comments
Open

Updagrding PHPUnit from v9 to 11 #1429

rugk opened this issue Oct 18, 2024 · 0 comments

Comments

@rugk
Copy link
Member

rugk commented Oct 18, 2024

The problem

We seem to have a code dept at PHPUnit.
We currently use v9:

"phpunit/phpunit" : "^9"

As I did not see an issue tracking this yet, let it be here…

I just stumbled upon this when accidentally trying to run it with the latest, which fails like this:

$ phpunit
Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port).


An error occurred inside PHPUnit.

Message:  Call to undefined method PHPUnit\Framework\TestSuite::empty()
Location: /home/vscode/.composer/vendor/phpunit/phpunit/src/TextUI/Configuration/Xml/TestSuiteMapper.php:48

#0 /home/vscode/.composer/vendor/phpunit/phpunit/src/TextUI/Configuration/TestSuiteBuilder.php(75): PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper->map('/workspaces/Pri...', Object(PHPUnit\TextUI\Configuration\TestSuiteCollection), '', '')
#1 /home/vscode/.composer/vendor/phpunit/phpunit/src/TextUI/Application.php(412): PHPUnit\TextUI\Configuration\TestSuiteBuilder->build(Object(PHPUnit\TextUI\Configuration\Configuration))
#2 /home/vscode/.composer/vendor/phpunit/phpunit/src/TextUI/Application.php(180): PHPUnit\TextUI\Application->buildTestSuite(Object(PHPUnit\TextUI\Configuration\Configuration))
#3 /home/vscode/.composer/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#4 /home/vscode/.composer/vendor/bin/phpunit(122): include('/home/vscode/.c...')
#5 {main}

(Ignore the xdebug error, I was not debugging and this is fine.)

The solution

I am unsure what effort it takes/what needs to be done. https://docs.phpunit.de/en/11.4/ as the official doc misses any migration/upgrade doc, but well... it's several major versions, so I expect it to be kinda lot of effort(?).

https://laravelshift.com/upgrade-phpunit-10 -> says it automates the upgrade (we don't use laravel, but really phpunit is not laravel-specific so maybe it works anyway?)
https://book.cakephp.org/5/en/appendices/phpunit10.html

Alternatives

Keep it using old software uhm… not good.
Or well, switch to a totally different lib, though I think phpunit is kinda "industry practice"?

Additional context

Found https://phpunit.de/announcements/phpunit-10.html and old versions are still supported, but they seem to pin that to the PHP version. Okay well… upgrading won't hurt though, I guess.
And https://phpunit.de/announcements/phpunit-11.html for v11.

  • PHPUnit 10 -> PHP v8.1 or later
  • PHPUnit 11 -> PHP v8.2 or later

Ah well given we support older PHP versions I see, why we use v9 now. Anyway, now we have that documented and some resouces once we tackle the upgrade 🙃

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

No branches or pull requests

1 participant