fix tests issues
Tests / PHPUnit (push) Failing after 43s

This commit is contained in:
root
2026-07-12 20:36:40 -04:00
parent 62492a5644
commit f83ebe66b9
17 changed files with 219 additions and 107 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ class DBReset
foreach ($tables as $table) {
if (!in_array($table, self::$excludeTables)) {
$db->table($table)->truncate();
$db->query('TRUNCATE TABLE ' . $db->escapeIdentifiers($table));
}
}
+29 -1
View File
@@ -1,8 +1,36 @@
<?php
// tests/_support/bootstrap.php
if (! getenv('CI_ENVIRONMENT')) {
putenv('CI_ENVIRONMENT=testing');
$_ENV['CI_ENVIRONMENT'] = 'testing';
$_SERVER['CI_ENVIRONMENT'] = 'testing';
}
$writablePath = realpath(__DIR__ . '/../..') . DIRECTORY_SEPARATOR . 'writable';
$runtimeDirectories = [
$writablePath . DIRECTORY_SEPARATOR . 'cache',
$writablePath . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'testing',
$writablePath . DIRECTORY_SEPARATOR . 'logs',
$writablePath . DIRECTORY_SEPARATOR . 'session',
$writablePath . DIRECTORY_SEPARATOR . 'uploads',
$writablePath . DIRECTORY_SEPARATOR . 'debugbar',
];
foreach ($runtimeDirectories as $directory) {
if (! is_dir($directory) && ! mkdir($directory, 0775, true) && ! is_dir($directory)) {
fwrite(STDERR, "Unable to create writable test directory: {$directory}" . PHP_EOL);
exit(1);
}
if (! is_writable($directory)) {
fwrite(STDERR, "Writable test directory is not writable: {$directory}" . PHP_EOL);
exit(1);
}
}
// Load Composer autoloader
require __DIR__ . '/../../vendor/autoload.php';
// Load CodeIgniter testing bootstrap from Composer package
require __DIR__ . '/../../vendor/codeigniter4/framework/system/Test/bootstrap.php';
require __DIR__ . '/../../vendor/codeigniter4/framework/system/Test/bootstrap.php';