File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,6 +150,8 @@ parameters:
150150 # for config class reflection
151151 - src/Bootstrap/ExtensionConfigResolver.php
152152 - src/Validation/RectorConfigValidator.php
153+ # for phpunit version check
154+ - src/Testing/PHPUnit/AbstractLazyTestCase.php
153155
154156 # use of internal phpstan classes
155157 -
Original file line number Diff line number Diff line change 3333 'exclude-classes ' => [
3434 'PHPUnit\Framework\Constraint\IsEqual ' ,
3535 'PHPUnit\Framework\TestCase ' ,
36+ 'PHPUnit\Runner\Version ' ,
3637 'PHPUnit\Framework\ExpectationFailedException ' ,
3738
3839 // native class on php 8.3+
Original file line number Diff line number Diff line change 55namespace Rector \Testing \PHPUnit ;
66
77use PHPUnit \Framework \TestCase ;
8+ use PHPUnit \Runner \Version ;
89use Rector \Config \RectorConfig ;
910use Rector \DependencyInjection \LazyContainerFactory ;
1011
@@ -63,7 +64,11 @@ private function includePreloadFilesAndScoperAutoload(): void
6364 {
6465 if (file_exists (__DIR__ . '/../../../preload.php ' )) {
6566 if (file_exists (__DIR__ . '/../../../vendor ' )) {
66- require_once __DIR__ . '/../../../preload.php ' ;
67+ // this ensure to not load preload.php on phpunit >= 12
68+ if (! class_exists (Version::class) || (int ) Version::id () < 12 ) {
69+ require_once __DIR__ . '/../../../preload.php ' ;
70+ }
71+
6772 // test case in rector split package
6873 } elseif (file_exists (__DIR__ . '/../../../../../../vendor ' )) {
6974 require_once __DIR__ . '/../../../preload-split-package.php ' ;
You can’t perform that action at this time.
0 commit comments