Closed TomasVotruba closed 2 weeks ago
@TomasVotruba I tried in CodeIgniter4 project,it got error: undefined assertObjectHasNotProperty()
➜ CodeIgniter4 git:(develop) ✗ vendor/bin/phpunit tests/system/Config/BaseConfigTest.php
PHPUnit 10.5.24 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.4 with PCOV 1.0.11
Configuration: /Users/samsonasik/www/CodeIgniter4/phpunit.xml.dist
....E............. 18 / 18 (100%)
Time: 00:00.306, Memory: 14.00 MB
There was 1 error:
1) CodeIgniter\Config\BaseConfigTest::testEnvironmentOverrides
Error: Call to undefined method CodeIgniter\Config\BaseConfigTest::assertObjectHasNotProperty()
It uses PHPUnit 10.5.24
➜ CodeIgniter4 git:(develop) ✗ composer show phpunit/phpunit
name : phpunit/phpunit
descrip. : The PHP Unit Testing framework.
keywords : phpunit, testing, xunit
versions : * 10.5.24
Looking on the repo, it seems there is no method named assertObjectHasNotProperty
PHPUnit 10 removed
assertObjectHasAttribute()
, with no replacement. Then PHPUnit 10.1 introducedassertObjectHasProperty()
as 1:1 replacement.Instead of migrating methods twice back and forth, we'll simple rename it.
See https://github.com/sebastianbergmann/phpunit/issues/5220
Closes https://github.com/rectorphp/rector-phpunit/issues/336