diff --git a/.gitignore b/.gitignore
index 74c6d0ce6c4f..71cf213fbfaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -126,5 +126,6 @@ nb-configuration.xml
/results/
/phpunit*.xml
/.phpunit.*.cache
+/.phpunit.cache
/.php-cs-fixer.php
diff --git a/admin/framework/composer.json b/admin/framework/composer.json
index fc06e8fa57b1..d46c7490ec56 100644
--- a/admin/framework/composer.json
+++ b/admin/framework/composer.json
@@ -23,7 +23,7 @@
"kint-php/kint": "^5.0.4",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
- "phpunit/phpunit": "^9.1",
+ "phpunit/phpunit": "^10.5.16",
"predis/predis": "^1.1 || ^2.0"
},
"suggest": {
diff --git a/admin/framework/phpunit.xml.dist b/admin/framework/phpunit.xml.dist
index 51c5fddc530b..0235b8a739c1 100644
--- a/admin/framework/phpunit.xml.dist
+++ b/admin/framework/phpunit.xml.dist
@@ -1,51 +1,33 @@
-
-
-
- ./app
-
-
- ./app/Views
- ./app/Config/Routes.php
-
-
-
-
-
-
-
-
-
-
- ./tests
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
diff --git a/admin/starter/composer.json b/admin/starter/composer.json
index 27b4efc5903b..0b3a889757bc 100644
--- a/admin/starter/composer.json
+++ b/admin/starter/composer.json
@@ -16,7 +16,7 @@
"require-dev": {
"fakerphp/faker": "^1.9",
"mikey179/vfsstream": "^1.6",
- "phpunit/phpunit": "^9.1"
+ "phpunit/phpunit": "^10.5.16"
},
"autoload": {
"psr-4": {
diff --git a/admin/starter/phpunit.xml.dist b/admin/starter/phpunit.xml.dist
index 62a473a733c4..7cd6d3af600a 100644
--- a/admin/starter/phpunit.xml.dist
+++ b/admin/starter/phpunit.xml.dist
@@ -1,51 +1,33 @@
-
-
-
- ./app
-
-
- ./app/Views
- ./app/Config/Routes.php
-
-
-
-
-
-
-
-
-
-
- ./tests
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
diff --git a/composer.json b/composer.json
index cc7de0f54f8f..9c17f59ded32 100644
--- a/composer.json
+++ b/composer.json
@@ -25,12 +25,12 @@
"kint-php/kint": "^5.0.4",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
- "nexusphp/tachycardia": "^1.0",
+ "nexusphp/tachycardia": "^2.0",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10.2",
"phpstan/phpstan-strict-rules": "^1.5",
- "phpunit/phpcov": "^8.2",
- "phpunit/phpunit": "^9.1",
+ "phpunit/phpcov": "^9.0.2",
+ "phpunit/phpunit": "^10.5.16",
"predis/predis": "^1.1 || ^2.0",
"rector/rector": "1.0.4",
"vimeo/psalm": "^5.0"
diff --git a/phpstan-baseline.php b/phpstan-baseline.php
index 9d658e715aad..ffe358b48943 100644
--- a/phpstan-baseline.php
+++ b/phpstan-baseline.php
@@ -11196,26 +11196,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\AbstractHandlerTest\\:\\:\\$dummy has no type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Cache/Handlers/AbstractHandlerTest.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\AbstractHandlerTest\\:\\:\\$key1 has no type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Cache/Handlers/AbstractHandlerTest.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\AbstractHandlerTest\\:\\:\\$key2 has no type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Cache/Handlers/AbstractHandlerTest.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\AbstractHandlerTest\\:\\:\\$key3 has no type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Cache/Handlers/AbstractHandlerTest.php',
-];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\BaseHandlerTest\\:\\:provideValidateKeyInvalidType\\(\\) return type has no value type specified in iterable type iterable\\.$#',
'count' => 1,
@@ -12461,31 +12441,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Database/DatabaseTestCaseTest.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Database\\\\Live\\\\AbstractGetFieldDataTest\\:\\:assertSameFieldData\\(\\) has no return type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Database/Live/AbstractGetFieldDataTest.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Database\\\\Live\\\\AbstractGetFieldDataTest\\:\\:assertSameFieldData\\(\\) has parameter \\$actual with no value type specified in iterable type array\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Database/Live/AbstractGetFieldDataTest.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Database\\\\Live\\\\AbstractGetFieldDataTest\\:\\:assertSameFieldData\\(\\) has parameter \\$expected with no value type specified in iterable type array\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Database/Live/AbstractGetFieldDataTest.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Database\\\\Live\\\\AbstractGetFieldDataTest\\:\\:createTableForDefault\\(\\) has no return type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Database/Live/AbstractGetFieldDataTest.php',
-];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Database\\\\Live\\\\AbstractGetFieldDataTest\\:\\:createTableForType\\(\\) has no return type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Database/Live/AbstractGetFieldDataTest.php',
-];
$ignoreErrors[] = [
'message' => '#^Property CodeIgniter\\\\Database\\\\Live\\\\ConnectTest\\:\\:\\$group1 has no type specified\\.$#',
'count' => 1,
@@ -12656,11 +12611,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Database/Live/SQLite3/AlterTableTest.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Method CodeIgniter\\\\Database\\\\Live\\\\SQLite3\\\\GetFieldDataTest\\:\\:createTableCompositePrimaryKey\\(\\) has no return type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Database/Live/SQLite3/GetFieldDataTest.php',
-];
$ignoreErrors[] = [
'message' => '#^PHPDoc type CodeIgniter\\\\Database\\\\SQLite3\\\\Connection of property CodeIgniter\\\\Database\\\\Live\\\\SQLite3\\\\GetIndexDataTest\\:\\:\\$db is not the same as PHPDoc type CodeIgniter\\\\Database\\\\BaseConnection of overridden property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$db\\.$#',
'count' => 1,
@@ -13071,11 +13021,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Events/EventsTest.php',
];
-$ignoreErrors[] = [
- 'message' => '#^Property class@anonymous/tests/system/Events/EventsTest\\.php\\:285\\:\\:\\$logged has no type specified\\.$#',
- 'count' => 1,
- 'path' => __DIR__ . '/tests/system/Events/EventsTest.php',
-];
$ignoreErrors[] = [
'message' => '#^Property CodeIgniter\\\\Filters\\\\CSRFTest\\:\\:\\$response \\(CodeIgniter\\\\HTTP\\\\Response\\|null\\) does not accept CodeIgniter\\\\HTTP\\\\ResponseInterface\\.$#',
'count' => 2,
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index e23d8ad9d6a5..45b6b07231c4 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,24 +1,32 @@
-
-
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
+ bootstrap="system/Test/bootstrap.php" backupGlobals="false"
+ beStrictAboutOutputDuringTests="true" colors="true" columns="max"
+ failOnRisky="true" failOnWarning="true"
+ cacheDirectory=".phpunit.cache">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tests/system
+
+
+
-
-
-
- tests/system
-
-
-
-
-
-
-
-
- 0.50
-
-
- 30
-
-
- 2
-
-
- false
-
-
-
-
-
-
+
diff --git a/system/Test/Constraints/SeeInDatabase.php b/system/Test/Constraints/SeeInDatabase.php
index 31297f53a0d7..faf874be9ce8 100644
--- a/system/Test/Constraints/SeeInDatabase.php
+++ b/system/Test/Constraints/SeeInDatabase.php
@@ -67,7 +67,7 @@ protected function failureDescription($table): string
return sprintf(
"a row in the table [%s] matches the attributes \n%s\n\n%s",
$table,
- $this->toString(JSON_PRETTY_PRINT),
+ $this->toString(false, JSON_PRETTY_PRINT),
$this->getAdditionalInfo($table)
);
}
@@ -113,7 +113,7 @@ protected function getAdditionalInfo(string $table): string
*
* @param int $options
*/
- public function toString($options = 0): string
+ public function toString(bool $exportObjects = false, $options = 0): string
{
return json_encode($this->data, $options);
}
diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php
index fbefbe20b0ef..b0e7852c2910 100644
--- a/tests/system/Autoloader/AutoloaderTest.php
+++ b/tests/system/Autoloader/AutoloaderTest.php
@@ -396,6 +396,10 @@ public function testAutoloaderLoadsNonClassFiles(): void
*/
public function testLoadHelpers(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$config = new Autoload();
$config->helpers[] = 'form';
diff --git a/tests/system/Cache/Handlers/AbstractHandlerTest.php b/tests/system/Cache/Handlers/AbstractHandlerTestCase.php
similarity index 84%
rename from tests/system/Cache/Handlers/AbstractHandlerTest.php
rename to tests/system/Cache/Handlers/AbstractHandlerTestCase.php
index 80c551a394a8..5732663f99f9 100644
--- a/tests/system/Cache/Handlers/AbstractHandlerTest.php
+++ b/tests/system/Cache/Handlers/AbstractHandlerTestCase.php
@@ -19,13 +19,13 @@
/**
* @internal
*/
-abstract class AbstractHandlerTest extends CIUnitTestCase
+abstract class AbstractHandlerTestCase extends CIUnitTestCase
{
protected BaseHandler $handler;
- protected static $key1 = 'key1';
- protected static $key2 = 'key2';
- protected static $key3 = 'key3';
- protected static $dummy = 'dymmy';
+ protected static string $key1 = 'key1';
+ protected static string $key2 = 'key2';
+ protected static string $key3 = 'key3';
+ protected static string $dummy = 'dymmy';
public function testGetMetaDataMiss(): void
{
diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php
index bc96a8a9cf4b..67aa170c75f5 100644
--- a/tests/system/Cache/Handlers/FileHandlerTest.php
+++ b/tests/system/Cache/Handlers/FileHandlerTest.php
@@ -23,7 +23,7 @@
*
* @group Others
*/
-final class FileHandlerTest extends AbstractHandlerTest
+final class FileHandlerTest extends AbstractHandlerTestCase
{
private static string $directory = 'FileHandler';
private Cache $config;
diff --git a/tests/system/Cache/Handlers/MemcachedHandlerTest.php b/tests/system/Cache/Handlers/MemcachedHandlerTest.php
index bbb91bf6a8de..06ee0c567239 100644
--- a/tests/system/Cache/Handlers/MemcachedHandlerTest.php
+++ b/tests/system/Cache/Handlers/MemcachedHandlerTest.php
@@ -23,7 +23,7 @@
*
* @internal
*/
-final class MemcachedHandlerTest extends AbstractHandlerTest
+final class MemcachedHandlerTest extends AbstractHandlerTestCase
{
private Cache $config;
diff --git a/tests/system/Cache/Handlers/PredisHandlerTest.php b/tests/system/Cache/Handlers/PredisHandlerTest.php
index 83aab83419b0..59e68346517b 100644
--- a/tests/system/Cache/Handlers/PredisHandlerTest.php
+++ b/tests/system/Cache/Handlers/PredisHandlerTest.php
@@ -22,7 +22,7 @@
*
* @internal
*/
-final class PredisHandlerTest extends AbstractHandlerTest
+final class PredisHandlerTest extends AbstractHandlerTestCase
{
private Cache $config;
diff --git a/tests/system/Cache/Handlers/RedisHandlerTest.php b/tests/system/Cache/Handlers/RedisHandlerTest.php
index 887175eee14d..c8182111971a 100644
--- a/tests/system/Cache/Handlers/RedisHandlerTest.php
+++ b/tests/system/Cache/Handlers/RedisHandlerTest.php
@@ -22,7 +22,7 @@
*
* @internal
*/
-final class RedisHandlerTest extends AbstractHandlerTest
+final class RedisHandlerTest extends AbstractHandlerTestCase
{
private Cache $config;
diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php
index 4dc50d328004..d6e93ab7a6d0 100644
--- a/tests/system/CodeIgniterTest.php
+++ b/tests/system/CodeIgniterTest.php
@@ -52,6 +52,10 @@ protected function setUp(): void
parent::setUp();
$this->resetServices();
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
$this->codeigniter = new MockCodeIgniter(new App());
diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php
index 151400745ef4..80d0879bc958 100644
--- a/tests/system/Commands/GenerateKeyTest.php
+++ b/tests/system/Commands/GenerateKeyTest.php
@@ -41,6 +41,10 @@ protected function setUp(): void
}
$this->resetEnvironment();
+
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
}
protected function tearDown(): void
diff --git a/tests/system/CommonFunctionsSendTest.php b/tests/system/CommonFunctionsSendTest.php
index f26e40cadf14..ee4090264da2 100644
--- a/tests/system/CommonFunctionsSendTest.php
+++ b/tests/system/CommonFunctionsSendTest.php
@@ -27,6 +27,10 @@ protected function setUp(): void
parent::setUp();
unset($_ENV['foo'], $_SERVER['foo']);
+
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
}
/**
diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php
index bfe54e291529..35866f640ee9 100644
--- a/tests/system/CommonFunctionsTest.php
+++ b/tests/system/CommonFunctionsTest.php
@@ -275,6 +275,10 @@ public function testEscapeRecursiveArrayRaw(): void
*/
public function testSessionInstance(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->injectSessionMock();
$this->assertInstanceOf(Session::class, session());
@@ -286,6 +290,10 @@ public function testSessionInstance(): void
*/
public function testSessionVariable(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->injectSessionMock();
$_SESSION['notbogus'] = 'Hi there';
@@ -299,6 +307,10 @@ public function testSessionVariable(): void
*/
public function testSessionVariableNotThere(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->injectSessionMock();
$_SESSION['bogus'] = 'Hi there';
@@ -423,6 +435,10 @@ public function testModelExistsAbsoluteClassname(): void
*/
public function testOldInput(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->injectSessionMock();
// setup from RedirectResponseTest...
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -458,6 +474,10 @@ public function testOldInput(): void
*/
public function testOldInputSerializeData(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->injectSessionMock();
// setup from RedirectResponseTest...
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -493,6 +513,10 @@ public function testOldInputSerializeData(): void
*/
public function testOldInputArray(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->injectSessionMock();
// setup from RedirectResponseTest...
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -610,6 +634,10 @@ public function testRedirectResponseCookies1(): void
*/
public function testTrace(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
ob_start();
trace();
$content = ob_get_clean();
@@ -633,6 +661,10 @@ public function testViewNotSaveData(): void
*/
public function testForceHttpsNullRequestAndResponse(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->assertNull(Services::response()->header('Location'));
Services::response()->setCookie('force', 'cookie');
@@ -748,6 +780,10 @@ public function testDWithCSP(): void
*/
public function testTraceWithCSP(): void
{
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ restore_error_handler();
+
$this->resetServices();
/** @var App $config */
@@ -759,6 +795,11 @@ public function testTraceWithCSP(): void
Kint::$cli_detection = false;
+ // Workaround for errors on PHPUnit 10 and PHP 8.3.
+ // See https://github.com/sebastianbergmann/phpunit/issues/5403#issuecomment-1906810619
+ // `$app->initialize()` sets error handler.
+ restore_error_handler();
+
$this->expectOutputRegex('/