Skip to content

Commit 3ac0fd9

Browse files
committed
wip
1 parent 7fb6819 commit 3ac0fd9

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

system/Test/CIUnitTestCase.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)