File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -234,12 +234,15 @@ public static function setUpBeforeClass(): void
234234 {
235235 parent ::setUpBeforeClass ();
236236
237- // Pre-load MockCodeIgniter (and its parent CodeIgniter\CodeIgniter) while
238- // the autoloader is still in its bootstrap state. This ensures both classes
239- // are in PHP's class registry before any setUp() call re-initializes the
240- // autoloader, preventing sporadic "Class not found" errors on the first test
241- // in a randomly-ordered run.
242- class_exists (MockCodeIgniter::class, true );
237+ // Pre-load MockCodeIgniter and its parent CodeIgniter\CodeIgniter while the
238+ // autoloader is still in its bootstrap state. This prevents sporadic
239+ // "Class not found" / "Failed to open stream" errors on the first test in a
240+ // randomly-ordered run that occur when Composer's PSR-4 fallback uses a
241+ // vendor/composer/../../system path that fails to open in some CI environments.
242+ // Explicit require_once with SYSTEMPATH bypasses both the classmap and PSR-4
243+ // fallback entirely, using the absolute realpath set during bootstrap.
244+ require_once SYSTEMPATH . 'CodeIgniter.php ' ;
245+ require_once SYSTEMPATH . 'Test/Mock/MockCodeIgniter.php ' ;
243246
244247 helper (['url ' , 'test ' ]);
245248 }
You can’t perform that action at this time.
0 commit comments