From 799b5056d17875d385451d6bf3ed2a0dcd2c986a Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 09:11:02 +0900 Subject: [PATCH 001/220] docs: add note on view() and View Renderer relationship --- user_guide_src/source/general/common_functions.rst | 1 + user_guide_src/source/outgoing/views.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index b16b5576ee45..05e43026675d 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -180,6 +180,7 @@ Service Accessors :rtype: string Grabs the current RendererInterface-compatible class + (:doc:`View <../outgoing/view_renderer>` class by default) and tells it to render the specified view. Simply provides a convenience method that can be used in Controllers, libraries, and routed closures. diff --git a/user_guide_src/source/outgoing/views.rst b/user_guide_src/source/outgoing/views.rst index fabd811de87a..611631ea6d5a 100644 --- a/user_guide_src/source/outgoing/views.rst +++ b/user_guide_src/source/outgoing/views.rst @@ -47,6 +47,8 @@ Where *name* is the name of your view file. .. important:: If the file extension is omitted, then the views are expected to end with the **.php** extension. +.. note:: The ``view()`` function uses :doc:`view_renderer` internally. + Now, create a file called **Blog.php** in the **app/Controllers** directory, and put this in it: From a25275ab175a5c26c34132f3d6c89cd4c1d1466c Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 09:16:21 +0900 Subject: [PATCH 002/220] docs: change page order "Views" page is an explanation of the standard views. The standard views use View Renderer. So the two pages should be close. --- user_guide_src/source/outgoing/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/index.rst b/user_guide_src/source/outgoing/index.rst index a08a2e52a125..7b643ae5aad7 100644 --- a/user_guide_src/source/outgoing/index.rst +++ b/user_guide_src/source/outgoing/index.rst @@ -8,9 +8,9 @@ View components are used to build what is returned to the user. :titlesonly: views - view_cells view_renderer view_layouts + view_cells view_parser view_decorators table From 2091c4265f0b725b9e53db25307e04baa349dee8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 09:29:07 +0900 Subject: [PATCH 003/220] docs: capitalize first letter --- user_guide_src/source/outgoing/view_parser.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index 6b82129c64c9..d06161c2840f 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -81,7 +81,7 @@ need to be unique, or a later parameter setting will over-ride an earlier one. This also impacts escaping parameter values for different contexts inside your script. You will have to give each escaped value a unique parameter name. -Parser templates +Parser Templates ================ You can use the ``render()`` method to parse (or render) simple templates, From 312778454869cc88790446ba09d25a836c8bf407 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 09:29:46 +0900 Subject: [PATCH 004/220] docs: decorate method name --- user_guide_src/source/outgoing/view_parser.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index d06161c2840f..4202f478e1fe 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -102,7 +102,7 @@ Parser Configuration Options Several options can be passed to the ``render()`` or ``renderString()`` methods. -- ``cache`` - the time in seconds, to save a view's results; ignored for renderString() +- ``cache`` - the time in seconds, to save a view's results; ignored for ``renderString()`` - ``cache_name`` - the ID used to save/retrieve a cached view result; defaults to the viewpath; ignored for renderString() - ``saveData`` - true if the view data parameters should be retained for subsequent calls; From 7b45a2b5281c89f365da270f95044ebcc989056d Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 09:30:16 +0900 Subject: [PATCH 005/220] docs: improve description The views in "Views" page is pure PHP views. It is different from Parser Template views. So I removed the link to "Views" page. --- user_guide_src/source/outgoing/view_parser.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index 4202f478e1fe..dab40c9b9750 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -90,10 +90,12 @@ like this: .. literalinclude:: view_parser/003.php View parameters are passed to ``setData()`` as an associative -array of data to be replaced in the template. In the above example, the -template would contain two variables: ``{blog_title}`` and ``{blog_heading}`` -The first parameter to ``render()`` contains the name of the :doc:`view -file `, Where *blog_template* is the name of your view file. +array of data to be replaced in the template. + +In the above example, the template would contain two variables: ``{blog_title}`` and ``{blog_heading}`` + +The first parameter to ``render()`` contains the name of the template, where +``blog_template``` is the name of your view template file. .. important:: If the file extension is omitted, then the views are expected to end with the .php extension. From 4d88c19c30bb09befb59abd9f28280dac34897ff Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 09:42:12 +0900 Subject: [PATCH 006/220] docs: add section titles and descriptions --- .../source/outgoing/view_decorators.rst | 18 +++++++++++++++++- .../source/outgoing/view_decorators/002.php | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/outgoing/view_decorators.rst b/user_guide_src/source/outgoing/view_decorators.rst index f0b2239b0f65..29c8c25c7418 100644 --- a/user_guide_src/source/outgoing/view_decorators.rst +++ b/user_guide_src/source/outgoing/view_decorators.rst @@ -2,20 +2,36 @@ View Decorators ############### +.. contents:: + :local: + :depth: 2 + +************************* +What are View Decorators? +************************* + View Decorators allow your application to modify the HTML output during the rendering process. This happens just prior to being cached, and allows you to apply custom functionality to your views. +You can use View Decorators with :doc:`view_renderer` or :doc:`view_parser`. + ******************* Creating Decorators ******************* +Creating Decorator Class +======================== + Creating your own view decorators requires creating a new class that implements ``CodeIgniter\View\ViewDecoratorInterface``. This requires a single method that takes the generated HTML string, performs any modifications on it, and returns the resulting HTML. .. literalinclude:: view_decorators/001.php -Once created, the class must be registered in ``app/Config/View.php``: +Registering Decorator Class +=========================== + +Once created, the class must be registered in **app/Config/View.php**: .. literalinclude:: view_decorators/002.php diff --git a/user_guide_src/source/outgoing/view_decorators/002.php b/user_guide_src/source/outgoing/view_decorators/002.php index ba56ea1e80ad..b0634187b51d 100644 --- a/user_guide_src/source/outgoing/view_decorators/002.php +++ b/user_guide_src/source/outgoing/view_decorators/002.php @@ -6,9 +6,9 @@ class View extends BaseView { + // ... + public array $decorators = [ 'App\Views\Decorators\MyDecorator', ]; - - // ... } From 9483b354431be24b6a9a82d1d31e98eb47d1fc9e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 10:08:04 +0900 Subject: [PATCH 007/220] docs: fix typo Co-authored-by: Pooya Parsa --- user_guide_src/source/outgoing/view_parser.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index dab40c9b9750..a439d907a1de 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -95,7 +95,7 @@ array of data to be replaced in the template. In the above example, the template would contain two variables: ``{blog_title}`` and ``{blog_heading}`` The first parameter to ``render()`` contains the name of the template, where -``blog_template``` is the name of your view template file. +``blog_template`` is the name of your view template file. .. important:: If the file extension is omitted, then the views are expected to end with the .php extension. From df6c93c2857bf0f259d8a1105ed06741d8a47284 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 13:37:20 +0900 Subject: [PATCH 008/220] docs: add changelog and upgrade for v4.5.2 --- user_guide_src/source/changelogs/index.rst | 1 + user_guide_src/source/changelogs/v4.5.2.rst | 35 ++++++++++++ .../source/installation/upgrade_452.rst | 54 +++++++++++++++++++ .../source/installation/upgrading.rst | 1 + 4 files changed, 91 insertions(+) create mode 100644 user_guide_src/source/changelogs/v4.5.2.rst create mode 100644 user_guide_src/source/installation/upgrade_452.rst diff --git a/user_guide_src/source/changelogs/index.rst b/user_guide_src/source/changelogs/index.rst index 8f5c5df8d290..299644d7f060 100644 --- a/user_guide_src/source/changelogs/index.rst +++ b/user_guide_src/source/changelogs/index.rst @@ -12,6 +12,7 @@ See all the changes. .. toctree:: :titlesonly: + v4.5.2 v4.5.1 v4.5.0 v4.4.8 diff --git a/user_guide_src/source/changelogs/v4.5.2.rst b/user_guide_src/source/changelogs/v4.5.2.rst new file mode 100644 index 000000000000..d578360b720a --- /dev/null +++ b/user_guide_src/source/changelogs/v4.5.2.rst @@ -0,0 +1,35 @@ +############# +Version 4.5.2 +############# + +Release Date: Unreleased + +**4.5.2 release of CodeIgniter4** + +.. contents:: + :local: + :depth: 3 + +******** +BREAKING +******** + +*************** +Message Changes +*************** + +******* +Changes +******* + +************ +Deprecations +************ + +********** +Bugs Fixed +********** + +See the repo's +`CHANGELOG.md `_ +for a complete list of bugs fixed. diff --git a/user_guide_src/source/installation/upgrade_452.rst b/user_guide_src/source/installation/upgrade_452.rst new file mode 100644 index 000000000000..9b7071b99bf9 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_452.rst @@ -0,0 +1,54 @@ +############################# +Upgrading from 4.5.1 to 4.5.2 +############################# + +Please refer to the upgrade instructions corresponding to your installation method. + +- :ref:`Composer Installation App Starter Upgrading ` +- :ref:`Composer Installation Adding CodeIgniter4 to an Existing Project Upgrading ` +- :ref:`Manual Installation Upgrading ` + +.. contents:: + :local: + :depth: 2 + +********************** +Mandatory File Changes +********************** + +**************** +Breaking Changes +**************** + +********************* +Breaking Enhancements +********************* + +************* +Project Files +************* + +Some files in the **project space** (root, app, public, writable) received updates. Due to +these files being outside of the **system** scope they will not be changed without your intervention. + +There are some third-party CodeIgniter modules available to assist with merging changes to +the project space: `Explore on Packagist `_. + +Content Changes +=============== + +The following files received significant changes (including deprecations or visual adjustments) +and it is recommended that you merge the updated versions with your application: + +Config +------ + +- @TODO + +All Changes +=========== + +This is a list of all files in the **project space** that received changes; +many will be simple comments or formatting that have no effect on the runtime: + +- @TODO diff --git a/user_guide_src/source/installation/upgrading.rst b/user_guide_src/source/installation/upgrading.rst index 9e5e1730daba..b89d0619c89d 100644 --- a/user_guide_src/source/installation/upgrading.rst +++ b/user_guide_src/source/installation/upgrading.rst @@ -16,6 +16,7 @@ See also :doc:`./backward_compatibility_notes`. backward_compatibility_notes + upgrade_452 upgrade_451 upgrade_450 upgrade_448 From ea3450a1e6f5a95ec16a848614c1477d97892750 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 14 Apr 2024 13:39:28 +0900 Subject: [PATCH 009/220] chore: fix phpunit.xml.dist for appstarter --- admin/starter/phpunit.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/starter/phpunit.xml.dist b/admin/starter/phpunit.xml.dist index dea940878617..b408a99d988c 100644 --- a/admin/starter/phpunit.xml.dist +++ b/admin/starter/phpunit.xml.dist @@ -2,7 +2,7 @@ Date: Sun, 14 Apr 2024 23:07:05 +0800 Subject: [PATCH 010/220] fix: handle other behavior of sql server. --- system/Database/SQLSRV/Builder.php | 9 +++++++++ tests/system/Database/Builder/FromTest.php | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index a624dced38d2..1ba2094ed720 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -290,6 +290,15 @@ private function getFullName(string $table): string } if ($this->db->escapeChar === '"') { + if (str_contains($table, '.')) { + $dbInfo = explode('.', $table); + $database = str_replace('"', '', $dbInfo[0]); + $schema = str_replace('"', '', $dbInfo[1]); + $tableName = str_replace('"', '', $dbInfo[2]); + + return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; + } + return '"' . $this->db->getDatabase() . '"."' . $this->db->schema . '"."' . str_replace('"', '', $table) . '"' . $alias; } diff --git a/tests/system/Database/Builder/FromTest.php b/tests/system/Database/Builder/FromTest.php index 36edaa1dcf0c..6abff01ab241 100644 --- a/tests/system/Database/Builder/FromTest.php +++ b/tests/system/Database/Builder/FromTest.php @@ -153,4 +153,20 @@ public function testFromSubqueryWithSQLSRV(): void $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } + + /** + * See https://github.com/codeigniter4/CodeIgniter4/issues/8697 + * + * @return void + */ + public function testConstructorWithMultipleSegmentTableWithSQLSRV(): void + { + $this->db = new MockConnection(['DBDriver' => 'SQLSRV', 'database' => 'test', 'schema' => 'dbo']); + + $builder = new SQLSRVBuilder('database.dbo.table', $this->db); + + $expectedSQL = 'SELECT * FROM "database"."dbo"."table"'; + + $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); + } } From 8ce148f0c04f6061b7e231a91bc83911cf2a9777 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Sun, 14 Apr 2024 23:27:47 +0800 Subject: [PATCH 011/220] docs: change the comment. --- tests/system/Database/Builder/FromTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/system/Database/Builder/FromTest.php b/tests/system/Database/Builder/FromTest.php index 6abff01ab241..384509155542 100644 --- a/tests/system/Database/Builder/FromTest.php +++ b/tests/system/Database/Builder/FromTest.php @@ -155,9 +155,7 @@ public function testFromSubqueryWithSQLSRV(): void } /** - * See https://github.com/codeigniter4/CodeIgniter4/issues/8697 - * - * @return void + * @see https://github.com/codeigniter4/CodeIgniter4/issues/8697 */ public function testConstructorWithMultipleSegmentTableWithSQLSRV(): void { From 349f996cccf4de2fcafa2f2e4202592092846dfe Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Sun, 14 Apr 2024 23:32:27 +0800 Subject: [PATCH 012/220] style: fix the code style. --- system/Database/SQLSRV/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index 1ba2094ed720..982492610d06 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -298,7 +298,7 @@ private function getFullName(string $table): string return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; } - + return '"' . $this->db->getDatabase() . '"."' . $this->db->schema . '"."' . str_replace('"', '', $table) . '"' . $alias; } From 53093c9ad3cd4802e82436e3ba288270811ee048 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 15 Apr 2024 08:33:00 +0900 Subject: [PATCH 013/220] chore: update gitattributes --- .gitattributes | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitattributes b/.gitattributes index e2219ef90a4e..c41e331ff63c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,18 +17,21 @@ CONTRIBUTING.md export-ignore # contributor/development files tests/ export-ignore +tools/ export-ignore utils/ export-ignore .php-cs-fixer.dist.php export-ignore .php-cs-fixer.no-header.php export-ignore +.php-cs-fixer.tests.php export-ignore .php-cs-fixer.user-guide.php export-ignore deptrac.yaml export-ignore -phpstan-baseline.neon.dist export-ignore +phpmetrics.json export-ignore +phpstan-baseline.php export-ignore phpstan-bootstrap.php export-ignore phpstan.neon.dist export-ignore phpunit.xml.dist export-ignore -psalm_autoload.php export-ignore -psalm-baseline.php export-ignore +psalm-baseline.xml export-ignore psalm.xml export-ignore +psalm_autoload.php export-ignore rector.php export-ignore # source user guide From 5750027a9d0870700ec13752b6ff4e5cdb140fba Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 15 Apr 2024 08:49:45 +0200 Subject: [PATCH 014/220] docs: Small typos in incomingrequest.rst Change "a HTTP" to "an HTTP", "an lowercase" to "a lowercase" an "lower-case" to "lowercase". --- user_guide_src/source/incoming/incomingrequest.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/incoming/incomingrequest.rst b/user_guide_src/source/incoming/incomingrequest.rst index 4ca22ba4d09d..0b6f3daab39e 100644 --- a/user_guide_src/source/incoming/incomingrequest.rst +++ b/user_guide_src/source/incoming/incomingrequest.rst @@ -47,7 +47,7 @@ is() .. versionadded:: 4.3.0 -Since v4.3.0, you can use the ``is()`` method. It accepts a HTTP method, ``'ajax'``, +Since v4.3.0, you can use the ``is()`` method. It accepts an HTTP method, ``'ajax'``, or ``'json'``, and returns boolean. .. note:: HTTP method should be case-sensitive, but the parameter is case-insensitive. @@ -64,10 +64,10 @@ You can check the HTTP method that this request represents with the ``getMethod( The HTTP method is case-sensitive, and by convention, standardized methods are defined in all-uppercase US-ASCII letters. -.. note:: Prior to v4.5.0, by default, the method was returned as a lower-case +.. note:: Prior to v4.5.0, by default, the method was returned as a lowercase string (i.e., ``'get'``, ``'post'``, etc). But it was a bug. -You can get an lowercase version by wrapping the call in ``strtolower()``:: +You can get a lowercase version by wrapping the call in ``strtolower()``:: // Returns 'get' $method = strtolower($request->getMethod()); From 82ece196f1c046102b470c384ff2cbcf552f7843 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Wed, 10 Apr 2024 23:35:22 +0800 Subject: [PATCH 015/220] chore: Reverts disabling custom fixers for PHP 7.4 --- .php-cs-fixer.dist.php | 18 +++++++----------- .php-cs-fixer.no-header.php | 18 +++++++----------- .php-cs-fixer.tests.php | 18 +++++++----------- .php-cs-fixer.user-guide.php | 18 +++++++----------- 4 files changed, 28 insertions(+), 44 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b47b4d6480c9..fc47ed2f87e5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -43,20 +43,16 @@ $overrides = []; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.cache', - 'finder' => $finder, + 'cacheFile' => 'build/.php-cs-fixer.cache', + 'finder' => $finder, + 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), + 'customRules' => [ + NoCodeSeparatorCommentFixer::name() => true, + ], ]; -$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( +return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( 'CodeIgniter 4 framework', 'CodeIgniter Foundation', 'admin@codeigniter.com' ); - -$config - ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) - ->setRules(array_merge($config->getRules(), [ - NoCodeSeparatorCommentFixer::name() => true, - ])); - -return $config; diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 3729d434acba..cd10717aa5a2 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -32,16 +32,12 @@ $overrides = []; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', - 'finder' => $finder, -]; - -$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); - -$config - ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) - ->setRules(array_merge($config->getRules(), [ + 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', + 'finder' => $finder, + 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), + 'customRules' => [ NoCodeSeparatorCommentFixer::name() => true, - ])); + ], +]; -return $config; +return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); diff --git a/.php-cs-fixer.tests.php b/.php-cs-fixer.tests.php index c6b13a135a7c..7d5c1fad5e67 100644 --- a/.php-cs-fixer.tests.php +++ b/.php-cs-fixer.tests.php @@ -38,20 +38,16 @@ ]; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.tests.cache', - 'finder' => $finder, + 'cacheFile' => 'build/.php-cs-fixer.tests.cache', + 'finder' => $finder, + 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), + 'customRules' => [ + NoCodeSeparatorCommentFixer::name() => true, + ], ]; -$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( +return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( 'CodeIgniter 4 framework', 'CodeIgniter Foundation', 'admin@codeigniter.com' ); - -$config - ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) - ->setRules(array_merge($config->getRules(), [ - NoCodeSeparatorCommentFixer::name() => true, - ])); - -return $config; diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index 9f9f9b79a464..6382201525e4 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -42,16 +42,12 @@ ]; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.user-guide.cache', - 'finder' => $finder, -]; - -$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); - -$config - ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) - ->setRules(array_merge($config->getRules(), [ + 'cacheFile' => 'build/.php-cs-fixer.user-guide.cache', + 'finder' => $finder, + 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), + 'customRules' => [ NoCodeSeparatorCommentFixer::name() => true, - ])); + ], +]; -return $config; +return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); From acdbc5dd0fb02bba0b87ef254d3d8b9ad2636796 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 11 Apr 2024 00:33:34 +0800 Subject: [PATCH 016/220] style: enable modernize_strpos --- .php-cs-fixer.dist.php | 5 ++++- .php-cs-fixer.no-header.php | 5 ++++- .php-cs-fixer.tests.php | 2 ++ .php-cs-fixer.user-guide.php | 2 ++ spark | 2 +- user_guide_src/source/libraries/curlrequest/012.php | 2 +- 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b47b4d6480c9..dfd23faaf463 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -40,7 +40,10 @@ __DIR__ . '/spark', ]); -$overrides = []; +$overrides = [ + // for updating to coding-standard + 'modernize_strpos' => true, +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.cache', diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 3729d434acba..34c4c3819f86 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -29,7 +29,10 @@ __DIR__ . '/admin/starter/builds', ]); -$overrides = []; +$overrides = [ + // for updating to coding-standard + 'modernize_strpos' => true, +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', diff --git a/.php-cs-fixer.tests.php b/.php-cs-fixer.tests.php index c6b13a135a7c..e72378587e83 100644 --- a/.php-cs-fixer.tests.php +++ b/.php-cs-fixer.tests.php @@ -35,6 +35,8 @@ $overrides = [ 'void_return' => true, + // for updating to coding-standard + 'modernize_strpos' => true, ]; $options = [ diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index 9f9f9b79a464..a95fd5f1c0ff 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -39,6 +39,8 @@ 'import_symbols' => false, 'leading_backslash_in_global_namespace' => true, ], + // for updating to coding-standard + 'modernize_strpos' => true, ]; $options = [ diff --git a/spark b/spark index a56fbc1bd7b6..992d044c9ee2 100755 --- a/spark +++ b/spark @@ -25,7 +25,7 @@ */ // Refuse to run when called from php-cgi -if (strpos(PHP_SAPI, 'cgi') === 0) { +if (str_starts_with(PHP_SAPI, 'cgi')) { exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n"); } diff --git a/user_guide_src/source/libraries/curlrequest/012.php b/user_guide_src/source/libraries/curlrequest/012.php index 59439c17d569..dfb37fa57bcc 100644 --- a/user_guide_src/source/libraries/curlrequest/012.php +++ b/user_guide_src/source/libraries/curlrequest/012.php @@ -1,5 +1,5 @@ header('content-type'), 'application/json') !== false) { +if (str_contains($response->header('content-type'), 'application/json')) { $body = json_decode($body); } From 6a6a0f20020583d11978c0de30b416f62fdfaef9 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Tue, 16 Apr 2024 02:03:49 +0800 Subject: [PATCH 017/220] feat: add the validation. --- system/Database/SQLSRV/Builder.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index 982492610d06..57a9434d6e98 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -291,10 +291,16 @@ private function getFullName(string $table): string if ($this->db->escapeChar === '"') { if (str_contains($table, '.')) { - $dbInfo = explode('.', $table); - $database = str_replace('"', '', $dbInfo[0]); - $schema = str_replace('"', '', $dbInfo[1]); - $tableName = str_replace('"', '', $dbInfo[2]); + $dbInfo = explode('.', $table); + $database = $this->db->getDatabase(); + $schema = $this->db->schema; + $table = $dbInfo[0]; + + if (isset($dbInfo[1], $dbInfo[2])) { + $database = str_replace('"', '', $dbInfo[0]); + $schema = str_replace('"', '', $dbInfo[1]); + $tableName = str_replace('"', '', $dbInfo[2]); + } return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; } From b19a785e271f3e803e52dccc3606f2a6b020afa4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 16 Apr 2024 08:56:14 +0900 Subject: [PATCH 018/220] fix: ad hoc fix for join() with BETWEEN --- system/Database/BaseBuilder.php | 8 ++++++++ system/Database/SQLSRV/Builder.php | 7 +++++++ tests/system/Database/Builder/JoinTest.php | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 1f0807cdbbde..46d94661aca6 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -654,6 +654,7 @@ public function join(string $table, $cond, string $type = '', ?bool $escape = nu $cond = ' ON ' . $cond; } else { // Split multiple conditions + // @TODO This does not parse `BETWEEN a AND b` correctly. if (preg_match_all('/\sAND\s|\sOR\s/i', $cond, $joints, PREG_OFFSET_CAPTURE)) { $conditions = []; $joints = $joints[0]; @@ -676,6 +677,13 @@ public function join(string $table, $cond, string $type = '', ?bool $escape = nu foreach ($conditions as $i => $condition) { $operator = $this->getOperator($condition); + // Workaround for BETWEEN + if ($operator === false) { + $cond .= $joints[$i] . $condition; + + continue; + } + $cond .= $joints[$i]; $cond .= preg_match('/(\(*)?([\[\]\w\.\'-]+)' . preg_quote($operator, '/') . '(.*)/i', $condition, $match) ? $match[1] . $this->db->protectIdentifiers($match[2]) . $operator . $this->db->protectIdentifiers($match[3]) : $condition; } diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index a624dced38d2..ffc72bd41d66 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -145,6 +145,13 @@ public function join(string $table, $cond, string $type = '', ?bool $escape = nu foreach ($conditions as $i => $condition) { $operator = $this->getOperator($condition); + // Workaround for BETWEEN + if ($operator === false) { + $cond .= $joints[$i] . $condition; + + continue; + } + $cond .= $joints[$i]; $cond .= preg_match('/(\(*)?([\[\]\w\.\'-]+)' . preg_quote($operator, '/') . '(.*)/i', $condition, $match) ? $match[1] . $this->db->protectIdentifiers($match[2]) . $operator . $this->db->protectIdentifiers($match[3]) : $condition; } diff --git a/tests/system/Database/Builder/JoinTest.php b/tests/system/Database/Builder/JoinTest.php index 0ab74729ed7a..83c7ea4f3ab9 100644 --- a/tests/system/Database/Builder/JoinTest.php +++ b/tests/system/Database/Builder/JoinTest.php @@ -80,6 +80,25 @@ public function testJoinMultipleConditions(): void $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/8791 + */ + public function testJoinMultipleConditionsBetween(): void + { + $builder = new BaseBuilder('table1', $this->db); + + $builder->join( + 'leases', + 'units.unit_id = leases.unit_id AND CURDATE() BETWEEN lease_start_date AND lease_exp_date', + 'LEFT' + ); + + // @TODO Should be `... CURDATE() BETWEEN "lease_start_date" AND "lease_exp_date"` + $expectedSQL = 'SELECT * FROM "table1" LEFT JOIN "leases" ON "units"."unit_id" = "leases"."unit_id" AND CURDATE() BETWEEN lease_start_date AND lease_exp_date'; + + $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); + } + /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/3832 */ From 6a29ef3656b380a30e26777e15acf18ee37106c7 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Wed, 17 Apr 2024 01:28:50 +0800 Subject: [PATCH 019/220] feat: Add more validation. --- system/Database/SQLSRV/Builder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index 57a9434d6e98..9f54c68a4e5e 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -290,19 +290,19 @@ private function getFullName(string $table): string } if ($this->db->escapeChar === '"') { - if (str_contains($table, '.')) { + if (str_contains($table, '.') && !str_starts_with($table, '.') && !str_ends_with($table, '.')) { $dbInfo = explode('.', $table); $database = $this->db->getDatabase(); - $schema = $this->db->schema; $table = $dbInfo[0]; if (isset($dbInfo[1], $dbInfo[2])) { $database = str_replace('"', '', $dbInfo[0]); $schema = str_replace('"', '', $dbInfo[1]); $tableName = str_replace('"', '', $dbInfo[2]); - } return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; + } + } return '"' . $this->db->getDatabase() . '"."' . $this->db->schema . '"."' . str_replace('"', '', $table) . '"' . $alias; From f7d4499d0d9e8fec06daebcb3b68cac8072ac310 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Wed, 17 Apr 2024 01:43:26 +0800 Subject: [PATCH 020/220] style: do cs fix. --- system/Database/SQLSRV/Builder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index 9f54c68a4e5e..b8f6d16b8466 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -290,7 +290,7 @@ private function getFullName(string $table): string } if ($this->db->escapeChar === '"') { - if (str_contains($table, '.') && !str_starts_with($table, '.') && !str_ends_with($table, '.')) { + if (str_contains($table, '.') && ! str_starts_with($table, '.') && ! str_ends_with($table, '.')) { $dbInfo = explode('.', $table); $database = $this->db->getDatabase(); $table = $dbInfo[0]; @@ -300,9 +300,8 @@ private function getFullName(string $table): string $schema = str_replace('"', '', $dbInfo[1]); $tableName = str_replace('"', '', $dbInfo[2]); - return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; + return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; } - } return '"' . $this->db->getDatabase() . '"."' . $this->db->schema . '"."' . str_replace('"', '', $table) . '"' . $alias; From 55e0a3a3507d9537ba7a66c9c95bd596906c53f8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 17 Apr 2024 09:05:10 +0900 Subject: [PATCH 021/220] docs: fix/add @return types --- phpstan-baseline.php | 25 ------------------------- system/Database/BaseConnection.php | 2 +- system/Database/MySQLi/Connection.php | 2 ++ system/Database/Postgre/Connection.php | 2 ++ system/Database/SQLSRV/Connection.php | 2 ++ system/Database/SQLite3/Connection.php | 2 ++ system/Test/Mock/MockConnection.php | 2 ++ 7 files changed, 11 insertions(+), 26 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index cfee07815e8a..caaad61d6e84 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -3001,11 +3001,6 @@ 'count' => 11, 'path' => __DIR__ . '/system/Database/MySQLi/Connection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\MySQLi\\\\Connection\\:\\:_close\\(\\) should return mixed but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/MySQLi/Connection.php', -]; $ignoreErrors[] = [ 'message' => '#^Only booleans are allowed in &&, int given on the left side\\.$#', 'count' => 1, @@ -3391,11 +3386,6 @@ 'count' => 2, 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:_close\\(\\) should return mixed but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:buildDSN\\(\\) has no return type specified\\.$#', 'count' => 1, @@ -3756,11 +3746,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/SQLSRV/Connection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Connection\\:\\:_close\\(\\) should return mixed but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Connection.php', -]; $ignoreErrors[] = [ 'message' => '#^PHPDoc type string of property CodeIgniter\\\\Database\\\\SQLSRV\\\\Connection\\:\\:\\$escapeChar is not the same as PHPDoc type array\\|string of overridden property CodeIgniter\\\\Database\\\\BaseConnection\\\\:\\:\\$escapeChar\\.$#', 'count' => 1, @@ -3951,11 +3936,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/SQLite3/Connection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Connection\\:\\:_close\\(\\) should return mixed but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLite3/Connection.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Connection\\:\\:getFieldNames\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -8661,11 +8641,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockConnection\\:\\:_close\\(\\) should return mixed but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockConnection\\:\\:_fieldData\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index b597c6d6cd10..77c9bd39ef3e 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -479,7 +479,7 @@ public function close() /** * Platform dependent way method for closing the connection. * - * @return mixed + * @return void */ abstract protected function _close(); diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index c2ef98adb0b3..b25f2e1af390 100644 --- a/system/Database/MySQLi/Connection.php +++ b/system/Database/MySQLi/Connection.php @@ -246,6 +246,8 @@ public function reconnect() /** * Close the database connection. + * + * @return void */ protected function _close() { diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index bce4209c64d2..126aa98bb1c2 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -146,6 +146,8 @@ public function reconnect() /** * Close the database connection. + * + * @return void */ protected function _close() { diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index 411470d8e34c..0626a63c998b 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -173,6 +173,8 @@ public function reconnect() /** * Close the database connection. + * + * @return void */ protected function _close() { diff --git a/system/Database/SQLite3/Connection.php b/system/Database/SQLite3/Connection.php index d15c64213952..945434184f33 100644 --- a/system/Database/SQLite3/Connection.php +++ b/system/Database/SQLite3/Connection.php @@ -110,6 +110,8 @@ public function reconnect() /** * Close the database connection. + * + * @return void */ protected function _close() { diff --git a/system/Test/Mock/MockConnection.php b/system/Test/Mock/MockConnection.php index 83826c347c98..020d6e3dd340 100644 --- a/system/Test/Mock/MockConnection.php +++ b/system/Test/Mock/MockConnection.php @@ -220,6 +220,8 @@ protected function _foreignKeyData(string $table): array /** * Close the connection. + * + * @return void */ protected function _close() { From 97f63ff041a5659a1fecbccf88e3b5bd7a80ccc7 Mon Sep 17 00:00:00 2001 From: obozdag Date: Wed, 17 Apr 2024 06:54:21 +0200 Subject: [PATCH 022/220] docs: Fix typo in table.rst Fix typo in table.rst, clear function description. --- user_guide_src/source/outgoing/table.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/table.rst b/user_guide_src/source/outgoing/table.rst index bec15f86dbbf..0da5d1971d3d 100644 --- a/user_guide_src/source/outgoing/table.rst +++ b/user_guide_src/source/outgoing/table.rst @@ -210,7 +210,7 @@ Class Reference Lets you clear the table heading, row data and caption. If you need to show multiple tables with different data you - should to call this method after each table has been + should call this method after each table has been generated to clear the previous table information. Example From e3ada75a5b3f0615877205e77e5467eebc0b0233 Mon Sep 17 00:00:00 2001 From: obozdag Date: Wed, 17 Apr 2024 06:56:07 +0200 Subject: [PATCH 023/220] docs: Fix typo view_parser.rst Fix typo view_parser.rst. --- user_guide_src/source/outgoing/view_parser.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index a439d907a1de..dc2a702fe000 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -495,7 +495,7 @@ You can also use closures, but these can only be defined in the config file's co .. literalinclude:: view_parser/015.php -If the callable is on its own, it is treated as a single tag, not a open/close one. It will be replaced by +If the callable is on its own, it is treated as a single tag, not an open/close one. It will be replaced by the return value from the plugin: .. literalinclude:: view_parser/016.php From 617f70cd354b13b2415f5f656c1cfac6aed0bbfc Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Wed, 17 Apr 2024 13:22:23 +0800 Subject: [PATCH 024/220] fix: decrease the verify amount. --- system/Database/SQLSRV/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index b8f6d16b8466..ab41c2f2b361 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -295,7 +295,7 @@ private function getFullName(string $table): string $database = $this->db->getDatabase(); $table = $dbInfo[0]; - if (isset($dbInfo[1], $dbInfo[2])) { + if (isset($dbInfo[2])) { $database = str_replace('"', '', $dbInfo[0]); $schema = str_replace('"', '', $dbInfo[1]); $tableName = str_replace('"', '', $dbInfo[2]); From cc31b09d4ed431d66cfe10af60c73053272711f0 Mon Sep 17 00:00:00 2001 From: obozdag Date: Wed, 17 Apr 2024 07:23:16 +0200 Subject: [PATCH 025/220] docs: Small change in Class Reference description in response.rst Small change in Class Reference description in response.rst. --- user_guide_src/source/outgoing/response.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/response.rst b/user_guide_src/source/outgoing/response.rst index 043ce61133e1..721956fbff1e 100644 --- a/user_guide_src/source/outgoing/response.rst +++ b/user_guide_src/source/outgoing/response.rst @@ -255,7 +255,7 @@ Class Reference .. note:: In addition to the methods listed here, this class inherits the methods from the :doc:`Message Class `. -The methods provided by the parent class that are available are: +The methods inherited from the Message Class are: * :meth:`CodeIgniter\\HTTP\\Message::body` * :meth:`CodeIgniter\\HTTP\\Message::setBody` From 1434af4a6434b5ec050ffaaadec42494231b8895 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Wed, 17 Apr 2024 15:27:15 +0800 Subject: [PATCH 026/220] feat: extend the code to implement the scenario without database. --- system/Database/SQLSRV/Builder.php | 13 +++++++++---- tests/system/Database/Builder/FromTest.php | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index ab41c2f2b361..f01e733f9119 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -295,10 +295,15 @@ private function getFullName(string $table): string $database = $this->db->getDatabase(); $table = $dbInfo[0]; - if (isset($dbInfo[2])) { - $database = str_replace('"', '', $dbInfo[0]); - $schema = str_replace('"', '', $dbInfo[1]); - $tableName = str_replace('"', '', $dbInfo[2]); + if (count($dbInfo) >= 2) { + if (count($dbInfo) === 3) { + $database = str_replace('"', '', $dbInfo[0]); + $schema = str_replace('"', '', $dbInfo[1]); + $tableName = str_replace('"', '', $dbInfo[2]); + } else { + $schema = str_replace('"', '', $dbInfo[0]); + $tableName = str_replace('"', '', $dbInfo[1]); + } return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; } diff --git a/tests/system/Database/Builder/FromTest.php b/tests/system/Database/Builder/FromTest.php index 384509155542..e003353c12f8 100644 --- a/tests/system/Database/Builder/FromTest.php +++ b/tests/system/Database/Builder/FromTest.php @@ -167,4 +167,18 @@ public function testConstructorWithMultipleSegmentTableWithSQLSRV(): void $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/8697 + */ + public function testConstructorWithMultipleSegmentTableWithoutDatabaseWithSQLSRV(): void + { + $this->db = new MockConnection(['DBDriver' => 'SQLSRV', 'database' => 'test', 'schema' => 'dbo']); + + $builder = new SQLSRVBuilder('dbo.table', $this->db); + + $expectedSQL = 'SELECT * FROM "test"."dbo"."table"'; + + $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); + } } From d7dd6b4cdf0fa72aa4428287ad642847fab853ef Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Wed, 17 Apr 2024 15:29:28 +0800 Subject: [PATCH 027/220] feat: add the validation. --- system/Database/SQLSRV/Builder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index f01e733f9119..baa4e0406c7f 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -295,8 +295,8 @@ private function getFullName(string $table): string $database = $this->db->getDatabase(); $table = $dbInfo[0]; - if (count($dbInfo) >= 2) { - if (count($dbInfo) === 3) { + if (count($dbInfo) >= 2 && isset($dbInfo[1])) { + if (count($dbInfo) === 3 && isset($dbInfo[2])) { $database = str_replace('"', '', $dbInfo[0]); $schema = str_replace('"', '', $dbInfo[1]); $tableName = str_replace('"', '', $dbInfo[2]); From 4ac35c07f35307fe64742ed0fd2904296c8565d8 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Thu, 18 Apr 2024 13:57:52 +0800 Subject: [PATCH 028/220] feat: change the condition. --- system/Database/SQLSRV/Builder.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php index baa4e0406c7f..c1b61947c90d 100755 --- a/system/Database/SQLSRV/Builder.php +++ b/system/Database/SQLSRV/Builder.php @@ -295,18 +295,16 @@ private function getFullName(string $table): string $database = $this->db->getDatabase(); $table = $dbInfo[0]; - if (count($dbInfo) >= 2 && isset($dbInfo[1])) { - if (count($dbInfo) === 3 && isset($dbInfo[2])) { - $database = str_replace('"', '', $dbInfo[0]); - $schema = str_replace('"', '', $dbInfo[1]); - $tableName = str_replace('"', '', $dbInfo[2]); - } else { - $schema = str_replace('"', '', $dbInfo[0]); - $tableName = str_replace('"', '', $dbInfo[1]); - } - - return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; + if (count($dbInfo) === 3) { + $database = str_replace('"', '', $dbInfo[0]); + $schema = str_replace('"', '', $dbInfo[1]); + $tableName = str_replace('"', '', $dbInfo[2]); + } else { + $schema = str_replace('"', '', $dbInfo[0]); + $tableName = str_replace('"', '', $dbInfo[1]); } + + return '"' . $database . '"."' . $schema . '"."' . str_replace('"', '', $tableName) . '"' . $alias; } return '"' . $this->db->getDatabase() . '"."' . $this->db->schema . '"."' . str_replace('"', '', $table) . '"' . $alias; From 3a70a22b06913be7fa57598f8bb8ee9d88fca6cc Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 18 Apr 2024 16:12:10 +0200 Subject: [PATCH 029/220] docs: Fix typo in response.rst Fix typo in response.rst "This are" to "This is" --- user_guide_src/source/outgoing/response.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/response.rst b/user_guide_src/source/outgoing/response.rst index 043ce61133e1..8557f6d38f30 100644 --- a/user_guide_src/source/outgoing/response.rst +++ b/user_guide_src/source/outgoing/response.rst @@ -234,7 +234,7 @@ Built into the HTTP specification are tools help the client (often the web brows this can lead to a huge performance boost to your application because it will tell the client that they don't need to contact the server at all since nothing has changed. And you can't get faster than that. -This are handled through the ``Cache-Control`` and ``ETag`` headers. This guide is not the proper place for a thorough +This is handled through the ``Cache-Control`` and ``ETag`` headers. This guide is not the proper place for a thorough introduction to all of the cache headers power, but you can get a good understanding over at `Google Developers `_. From e6ef70c97b9dc5f3f3fb8bd4b7460df1291f84cb Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 19 Apr 2024 07:49:28 +0900 Subject: [PATCH 030/220] fix: [ErrorException] Undefined array key If a setting does not exists, ini_get_all() does not have the key. --- system/Security/CheckPhpIni.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Security/CheckPhpIni.php b/system/Security/CheckPhpIni.php index 6bbd8619c090..633c087080cf 100644 --- a/system/Security/CheckPhpIni.php +++ b/system/Security/CheckPhpIni.php @@ -142,8 +142,8 @@ public static function checkIni(): array foreach ($items as $key => $values) { $output[$key] = [ - 'global' => $ini[$key]['global_value'], - 'current' => $ini[$key]['local_value'], + 'global' => array_key_exists($key, $ini) ? $ini[$key]['global_value'] : 'disabled', + 'current' => array_key_exists($key, $ini) ? $ini[$key]['local_value'] : 'disabled', 'recommended' => $values['recommended'] ?? '', 'remark' => $values['remark'] ?? '', ]; From 4ee58090f725660d01ed8e8cd19fb27ac5c310d3 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 19 Apr 2024 12:04:20 +0900 Subject: [PATCH 031/220] chore: update for 4.5 --- preload.php | 22 ++++++---------------- system/Boot.php | 13 +++++++++++++ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/preload.php b/preload.php index 2fa699388270..75d86f5cf572 100644 --- a/preload.php +++ b/preload.php @@ -29,19 +29,6 @@ // Path to the front controller define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR); -/** - * See https://www.php.net/manual/en/function.str-contains.php#126277 - */ -if (! function_exists('str_contains')) { - /** - * Polyfill of str_contains() - */ - function str_contains(string $haystack, string $needle): bool - { - return empty($needle) || strpos($haystack, $needle) !== false; - } -} - class preload { /** @@ -51,6 +38,7 @@ class preload [ 'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // Change this path if using manual installation 'exclude' => [ + '/system/bootstrap.php', // Not needed if you don't use them. '/system/Database/OCI8/', '/system/Database/Postgre/', @@ -77,16 +65,18 @@ public function __construct() $this->loadAutoloader(); } - private function loadAutoloader() + private function loadAutoloader(): void { $paths = new Config\Paths(); - require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php'; + require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'Boot.php'; + + CodeIgniter\Boot::preload($paths); } /** * Load PHP files. */ - public function load() + public function load(): void { foreach ($this->paths as $path) { $directory = new RecursiveDirectoryIterator($path['include']); diff --git a/system/Boot.php b/system/Boot.php index 8a769bbb6866..54468a5cc192 100644 --- a/system/Boot.php +++ b/system/Boot.php @@ -122,6 +122,19 @@ public static function bootTest(Paths $paths): void static::autoloadHelpers(); } + /** + * Used by `preload.php` + */ + public static function preload(Paths $paths): void + { + static::definePathConstants($paths); + static::loadConstants(); + static::defineEnvironment(); + static::loadEnvironmentBootstrap($paths, false); + + static::loadAutoloader(); + } + /** * Load environment settings from .env files into $_SERVER and $_ENV */ From 7aec7ccff0b93261e182414281a1673374249938 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 19 Apr 2024 12:08:12 +0900 Subject: [PATCH 032/220] chore: add preload.php to php-cs-fixer --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 78dea1429202..521cddf17deb 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -36,6 +36,7 @@ __DIR__ . '/.php-cs-fixer.no-header.php', __DIR__ . '/.php-cs-fixer.tests.php', __DIR__ . '/.php-cs-fixer.user-guide.php', + __DIR__ . '/preload.php', __DIR__ . '/rector.php', __DIR__ . '/spark', ]); From 8d5143380a4e6bd6995dcf425b0a49592802c8b4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 19 Apr 2024 17:01:23 +0900 Subject: [PATCH 033/220] refactor: don't call array_key_exists() twice --- system/Security/CheckPhpIni.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/Security/CheckPhpIni.php b/system/Security/CheckPhpIni.php index 633c087080cf..4cef565ad7d6 100644 --- a/system/Security/CheckPhpIni.php +++ b/system/Security/CheckPhpIni.php @@ -141,9 +141,10 @@ public static function checkIni(): array $ini = ini_get_all(); foreach ($items as $key => $values) { + $hasKeyInIni = array_key_exists($key, $ini); $output[$key] = [ - 'global' => array_key_exists($key, $ini) ? $ini[$key]['global_value'] : 'disabled', - 'current' => array_key_exists($key, $ini) ? $ini[$key]['local_value'] : 'disabled', + 'global' => $hasKeyInIni ? $ini[$key]['global_value'] : 'disabled', + 'current' => $hasKeyInIni ? $ini[$key]['local_value'] : 'disabled', 'recommended' => $values['recommended'] ?? '', 'remark' => $values['remark'] ?? '', ]; From 98f44fc159cb8eaab14b728d573cf32ab89df540 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 21 Apr 2024 10:49:35 +0900 Subject: [PATCH 034/220] docs: fix page title This page is for CI3 users. In CI3 there is no HTTP Response. So it is better to be "Upgrade Output Class". --- user_guide_src/source/installation/upgrade_4xx.rst | 2 +- user_guide_src/source/installation/upgrade_responses.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/installation/upgrade_4xx.rst b/user_guide_src/source/installation/upgrade_4xx.rst index f837180e8bfd..93340648278e 100644 --- a/user_guide_src/source/installation/upgrade_4xx.rst +++ b/user_guide_src/source/installation/upgrade_4xx.rst @@ -254,8 +254,8 @@ Upgrading Libraries upgrade_images upgrade_localization upgrade_migrations - upgrade_pagination upgrade_responses + upgrade_pagination upgrade_routing upgrade_security upgrade_sessions diff --git a/user_guide_src/source/installation/upgrade_responses.rst b/user_guide_src/source/installation/upgrade_responses.rst index 26ccfc658e3f..c74f172b620c 100644 --- a/user_guide_src/source/installation/upgrade_responses.rst +++ b/user_guide_src/source/installation/upgrade_responses.rst @@ -1,5 +1,5 @@ -Upgrade HTTP Responses -###################### +Upgrade Output Class +#################### .. contents:: :local: From 8b37b839b3fcdb364eebcddeb7d25ad9750e039e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 21 Apr 2024 10:51:05 +0900 Subject: [PATCH 035/220] docs: add explanation --- user_guide_src/source/installation/upgrade_responses.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_responses.rst b/user_guide_src/source/installation/upgrade_responses.rst index c74f172b620c..a2d45f3e10c5 100644 --- a/user_guide_src/source/installation/upgrade_responses.rst +++ b/user_guide_src/source/installation/upgrade_responses.rst @@ -12,7 +12,8 @@ Documentations What has been changed ===================== -- The methods have been renamed +- The Output class has been changed to the Response class. +- The methods have been renamed. Upgrade Guide ============= From d6f1e88fc5eb1cf8e70a48353c31789089479911 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 21 Apr 2024 10:51:25 +0900 Subject: [PATCH 036/220] docs: fix typo --- user_guide_src/source/installation/upgrade_responses.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_responses.rst b/user_guide_src/source/installation/upgrade_responses.rst index a2d45f3e10c5..41ce2446de5c 100644 --- a/user_guide_src/source/installation/upgrade_responses.rst +++ b/user_guide_src/source/installation/upgrade_responses.rst @@ -17,7 +17,7 @@ What has been changed Upgrade Guide ============= -1. The methods in the HTTP Responses class are named slightly different. The most important change in the naming is the switch from underscored method names to camelCase. The method ``set_content_type()`` from version 3 is now named ``setContentType()`` and so on. +1. The methods in the HTTP Response class are named slightly different. The most important change in the naming is the switch from underscored method names to camelCase. The method ``set_content_type()`` from version 3 is now named ``setContentType()`` and so on. 2. In the most cases you have to change ``$this->output`` to ``$this->response`` followed by the method. You can find all methods in :doc:`../outgoing/response`. Code Example From fa06a8bf0c12396d88d791a7d9f186493e20db38 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 22 Apr 2024 08:53:27 +0900 Subject: [PATCH 037/220] fix: incorrect Security exception message This is a server side misconfiguration, not a client error. --- system/HTTP/ResponseTrait.php | 2 +- system/Language/en/Security.php | 1 + system/Security/Exceptions/SecurityException.php | 10 ++++++++++ tests/system/HTTP/ResponseSendTest.php | 5 +---- user_guide_src/source/changelogs/v4.5.2.rst | 2 ++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index 2d4295116807..45f07d186170 100644 --- a/system/HTTP/ResponseTrait.php +++ b/system/HTTP/ResponseTrait.php @@ -670,7 +670,7 @@ private function dispatchCookies(): void foreach ($this->cookieStore->display() as $cookie) { if ($cookie->isSecure() && ! $request->isSecure()) { - throw SecurityException::forDisallowedAction(); + throw SecurityException::forInsecureCookie(); } $name = $cookie->getPrefixedName(); diff --git a/system/Language/en/Security.php b/system/Language/en/Security.php index 145abaab71e7..fd906e378a29 100644 --- a/system/Language/en/Security.php +++ b/system/Language/en/Security.php @@ -14,6 +14,7 @@ // Security language settings return [ 'disallowedAction' => 'The action you requested is not allowed.', + 'insecureCookie' => 'Attempted to send a secure cookie over a non-secure connection.', // @deprecated 'invalidSameSite' => 'The SameSite value must be None, Lax, Strict, or a blank string. Given: "{0}"', diff --git a/system/Security/Exceptions/SecurityException.php b/system/Security/Exceptions/SecurityException.php index 16383fc25bfc..ed1d76825036 100644 --- a/system/Security/Exceptions/SecurityException.php +++ b/system/Security/Exceptions/SecurityException.php @@ -20,6 +20,7 @@ class SecurityException extends FrameworkException implements HTTPExceptionInter { /** * Throws when some specific action is not allowed. + * This is used for CSRF protection. * * @return static */ @@ -28,6 +29,15 @@ public static function forDisallowedAction() return new static(lang('Security.disallowedAction'), 403); } + /** + * Throws if a secure cookie is dispatched when the current connection is not + * secure. + */ + public static function forInsecureCookie(): static + { + return new static(lang('Security.insecureCookie')); + } + /** * Throws when the source string contains invalid UTF-8 characters. * diff --git a/tests/system/HTTP/ResponseSendTest.php b/tests/system/HTTP/ResponseSendTest.php index a4cc67765d3d..6159ee1140ba 100644 --- a/tests/system/HTTP/ResponseSendTest.php +++ b/tests/system/HTTP/ResponseSendTest.php @@ -162,14 +162,11 @@ public function testRedirectResponseCookies(): void /** * Make sure secure cookies are not sent with HTTP request - * - * @ runInSeparateProcess - * @ preserveGlobalState disabled */ public function testDoNotSendUnSecureCookie(): void { $this->expectException(SecurityException::class); - $this->expectExceptionMessage('The action you requested is not allowed'); + $this->expectExceptionMessage('Attempted to send a secure cookie over a non-secure connection.'); $request = $this->createMock(IncomingRequest::class); $request->method('isSecure')->willReturn(false); diff --git a/user_guide_src/source/changelogs/v4.5.2.rst b/user_guide_src/source/changelogs/v4.5.2.rst index d578360b720a..8824d3c72b96 100644 --- a/user_guide_src/source/changelogs/v4.5.2.rst +++ b/user_guide_src/source/changelogs/v4.5.2.rst @@ -18,6 +18,8 @@ BREAKING Message Changes *************** +- Added ``Security.insecureCookie`` message. + ******* Changes ******* From 7e8ebbcda98516e91526b7749f61634b48437c14 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:02:44 +0700 Subject: [PATCH 038/220] docs: @param BaseBuilder.php --- system/Database/BaseBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 1f0807cdbbde..62916eeaa63b 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2865,7 +2865,7 @@ public function deleteBatch($set = null, $constraints = null, int $batchSize = 1 * * @param string $table Protected table name * @param list $keys QBKeys - * @paramst> $values QBSet + * @param list $values QBSet */ protected function _deleteBatch(string $table, array $keys, array $values): string { From 590793e139ea326e79659319adfa5bbf7b91727e Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 19 Apr 2024 17:41:32 +0700 Subject: [PATCH 039/220] docs: specify phpdoc BaseBuilder --- phpstan-baseline.php | 98 +++++---------------------------- system/Database/BaseBuilder.php | 14 +++-- 2 files changed, 23 insertions(+), 89 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index caaad61d6e84..a7f3f149999b 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1791,36 +1791,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_insert\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_insert\\(\\) has parameter \\$unescapedKeys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_like\\(\\) has parameter \\$field with no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -2206,6 +2181,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:\\$QBFrom type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3121,21 +3101,6 @@ 'count' => 3, 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3156,6 +3121,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', +]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:\\$randomKeyword type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3317,27 +3287,17 @@ 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_insert\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_insert\\(\\) has parameter \\$unescapedKeys with no value type specified in iterable type array\\.$#', + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:replace\\(\\) has parameter \\$set with no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:replace\\(\\) has parameter \\$set with no value type specified in iterable type array\\.$#', + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; @@ -3676,26 +3636,6 @@ 'count' => 9, 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_insert\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_insert\\(\\) has parameter \\$unescapedKeys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3907,17 +3847,7 @@ 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Builder\\:\\:_deleteBatch\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Builder\\:\\:_replace\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Builder\\:\\:_replace\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_map expects array, int\\|string given\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Database/SQLite3/Builder.php', ]; diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 62916eeaa63b..4c80edc0aa39 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2376,7 +2376,9 @@ protected function validateInsert(): bool /** * Generates a platform-specific insert string from the supplied data * - * @param string $table Protected table name + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list $unescapedKeys QBSet */ protected function _insert(string $table, array $keys, array $unescapedKeys): string { @@ -2416,7 +2418,9 @@ public function replace(?array $set = null) /** * Generates a platform-specific replace string from the supplied data * - * @param string $table Protected table name + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list $values QBSet */ protected function _replace(string $table, array $keys, array $values): string { @@ -2863,9 +2867,9 @@ public function deleteBatch($set = null, $constraints = null, int $batchSize = 1 * * @used-by batchExecute() * - * @param string $table Protected table name - * @param list $keys QBKeys - * @param list $values QBSet + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list $values QBSet */ protected function _deleteBatch(string $table, array $keys, array $values): string { From abfb7f6a2d3ffec3d33875abce76684753b6c372 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Mon, 22 Apr 2024 09:23:24 +0700 Subject: [PATCH 040/220] docs: generate baseline --- phpstan-baseline.php | 20 -------------------- system/Database/BaseBuilder.php | 11 ++++++----- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index a7f3f149999b..3260e4b6f8cb 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1796,11 +1796,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_whereIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', 'count' => 1, @@ -3101,11 +3096,6 @@ 'count' => 3, 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:fieldsFromQuery\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3286,11 +3276,6 @@ 'count' => 7, 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/Postgre/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Builder\\:\\:replace\\(\\) has parameter \\$set with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -3636,11 +3621,6 @@ 'count' => 9, 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:_update\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Builder\\:\\:fieldsFromQuery\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 4c80edc0aa39..d552580703ec 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -2377,8 +2377,8 @@ protected function validateInsert(): bool * Generates a platform-specific insert string from the supplied data * * @param string $table Protected table name - * @param list $keys QBKeys - * @param list $unescapedKeys QBSet + * @param list $keys Keys of QBSet + * @param list $unescapedKeys Values of QBSet */ protected function _insert(string $table, array $keys, array $unescapedKeys): string { @@ -2419,8 +2419,8 @@ public function replace(?array $set = null) * Generates a platform-specific replace string from the supplied data * * @param string $table Protected table name - * @param list $keys QBKeys - * @param list $values QBSet + * @param list $keys Keys of QBSet + * @param list $values Values of QBSet */ protected function _replace(string $table, array $keys, array $values): string { @@ -2516,7 +2516,8 @@ public function update($set = null, $where = null, ?int $limit = null): bool /** * Generates a platform-specific update string from the supplied data * - * @param string $table Protected table name + * @param string $table Protected table name + * @param array $values QBSet */ protected function _update(string $table, array $values): string { From 715dff050873b7bf1183ef24e2af0678bf22659d Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Mon, 22 Apr 2024 09:45:41 +0700 Subject: [PATCH 041/220] docs: _like phpdocs --- phpstan-baseline.php | 5 ----- system/Database/BaseBuilder.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 3260e4b6f8cb..3fdb6424df80 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1791,11 +1791,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Database/BaseBuilder.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_like\\(\\) has parameter \\$field with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Database/BaseBuilder.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_whereIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', 'count' => 1, diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index d552580703ec..36a6ba7d73b9 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -1090,7 +1090,7 @@ public function orNotHavingLike($field, string $match = '', string $side = 'both * @used-by notHavingLike() * @used-by orNotHavingLike() * - * @param array|RawSql|string $field + * @param list|RawSql|string $field * * @return $this */ From d7a5a878cc4383570b50a7f11fe1f4d844778651 Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 22 Apr 2024 19:55:09 +0200 Subject: [PATCH 042/220] docs: Change connecting and Query Builder link names in database/examples.rst Change connecting and Query Builder link names in database/examples.rst --- user_guide_src/source/database/examples.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/database/examples.rst b/user_guide_src/source/database/examples.rst index a88608e85651..f7dfc4b85891 100644 --- a/user_guide_src/source/database/examples.rst +++ b/user_guide_src/source/database/examples.rst @@ -24,7 +24,7 @@ your :doc:`configuration ` settings: Once loaded the class is ready to be used as described below. .. note:: If all your pages require database access you can connect - automatically. See the :doc:`connecting ` page for details. + automatically. See the :doc:`Connecting to a Database ` page for details. Standard Query With Multiple Results (Object Version) ===================================================== @@ -66,7 +66,7 @@ Standard Insert Query Builder Query =================== -The :doc:`Query Builder Pattern ` gives you a simplified +The :doc:`Query Builder ` gives you a simplified means of retrieving data: .. literalinclude:: examples/007.php From a53ae657b644475adb8bc869532abab71b3def1d Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 22 Apr 2024 20:07:30 +0200 Subject: [PATCH 043/220] docs: Change page header in database/examples.rst Change page header in database/examples.rst --- user_guide_src/source/database/examples.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/database/examples.rst b/user_guide_src/source/database/examples.rst index f7dfc4b85891..43a2bdceac62 100644 --- a/user_guide_src/source/database/examples.rst +++ b/user_guide_src/source/database/examples.rst @@ -1,6 +1,6 @@ -################################## -Database Quick Start: Example Code -################################## +########################### +Quick Start: Usage Examples +########################### The following page contains example code showing how the database class is used. For complete details please read the individual pages From dde1de7ebcaa825c59cada173a16b312957a9f61 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 23 Apr 2024 11:35:48 +0900 Subject: [PATCH 044/220] test: add test for Model returns Entity with Casts --- tests/_support/Entity/UserWithCasts.php | 23 +++++++++++++++ .../Models/UserEntityWithCastsModel.php | 29 +++++++++++++++++++ tests/system/Models/FindModelTest.php | 19 ++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tests/_support/Entity/UserWithCasts.php create mode 100644 tests/_support/Models/UserEntityWithCastsModel.php diff --git a/tests/_support/Entity/UserWithCasts.php b/tests/_support/Entity/UserWithCasts.php new file mode 100644 index 000000000000..cfe1981fa3fa --- /dev/null +++ b/tests/_support/Entity/UserWithCasts.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Tests\Support\Entity; + +use CodeIgniter\Entity\Entity; + +class UserWithCasts extends Entity +{ + protected $casts = [ + 'email' => 'json', + ]; +} diff --git a/tests/_support/Models/UserEntityWithCastsModel.php b/tests/_support/Models/UserEntityWithCastsModel.php new file mode 100644 index 000000000000..2ea32c88f842 --- /dev/null +++ b/tests/_support/Models/UserEntityWithCastsModel.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Tests\Support\Models; + +use CodeIgniter\Model; +use Tests\Support\Entity\UserWithCasts; + +class UserEntityWithCastsModel extends Model +{ + protected $table = 'user'; + protected $allowedFields = [ + 'name', + 'email', + 'country', + 'deleted_at', + ]; + protected $returnType = UserWithCasts::class; +} diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index d27fcb791bb3..24946b4e2965 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -15,8 +15,10 @@ use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Exceptions\ModelException; +use Tests\Support\Entity\UserWithCasts; use Tests\Support\Models\JobModel; use Tests\Support\Models\SecondaryModel; +use Tests\Support\Models\UserEntityWithCastsModel; use Tests\Support\Models\UserModel; /** @@ -32,6 +34,23 @@ public function testFindReturnsRow(): void $this->assertSame('Musician', $this->model->find(4)->name); } + public function testFindReturnsEntityWithCasts(): void + { + $this->createModel(UserEntityWithCastsModel::class); + $this->model->builder()->truncate(); + $user = new UserWithCasts([ + 'name' => 'John Smith', + 'email' => ['foo@example.jp', 'bar@example.com'], + 'country' => 'US', + ]); + $id = $this->model->insert($user, true); + + $user = $this->model->find($id); + + $this->assertSame('John Smith', $user->name); + $this->assertSame(['foo@example.jp', 'bar@example.com'], $user->email); + } + public function testFindReturnsMultipleRows(): void { $this->createModel(JobModel::class); From c6e17476f319df179d0b18c967e7732f039abb22 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Tue, 23 Apr 2024 11:24:25 +0700 Subject: [PATCH 045/220] Update system/Database/BaseBuilder.php Co-authored-by: kenjis --- system/Database/BaseBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 36a6ba7d73b9..c20f59920ff2 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -1090,7 +1090,7 @@ public function orNotHavingLike($field, string $match = '', string $side = 'both * @used-by notHavingLike() * @used-by orNotHavingLike() * - * @param list|RawSql|string $field + * @param array|RawSql|string $field * * @return $this */ From c99d08943e5f41877d317023152e3a0059b52270 Mon Sep 17 00:00:00 2001 From: obozdag Date: Wed, 24 Apr 2024 06:37:02 +0200 Subject: [PATCH 046/220] docs: Some typos in database/configuration.rst Some typos in database/configuration.rst --- .../source/database/configuration.rst | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index 26b7515bab12..2336c2a845af 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -29,13 +29,13 @@ prototype: The name of the class property is the connection name, and can be used while connecting to specify a group name. -.. note:: The default location of the SQLite3 database is in the **writable** folder. - If you want to change the location, you must set the full path to the new folder. +.. note:: The default location of the SQLite3 database is the **writable** folder. + If you want to change the location, you must set the full path to the new folder (e.g., 'database' => '../db/database_name'). DSN --- -Some database drivers (such as Postgre, OCI8) requires a full DSN string to connect. +Some database drivers (such as Postgre, OCI8) requires a full DSN (Data Source Name) string to connect. But if you do not specify a DSN string for a driver that requires it, CodeIgniter will try to build it with the rest of the provided settings. @@ -48,7 +48,7 @@ you're using the driver's underlying native PHP extension, like this: DSN in Universal Manner ^^^^^^^^^^^^^^^^^^^^^^^ -You can also set a Data Source Name in universal manner (URL like). In that case DSNs must have this prototype: +You can also set a DSN in universal manner (URL like). In that case DSNs must have this prototype: .. literalinclude:: configuration/003.php :lines: 11-14 @@ -113,7 +113,7 @@ Configuring with .env File You can also save your configuration values within a **.env** file with the current server's database settings. You only need to enter the values that change from what is in the -default group's configuration settings. The values should be name following this format, where +default group's configuration settings. The values should follow this format, where ``default`` is the group name:: database.default.username = 'root'; @@ -137,11 +137,11 @@ and decode it in the constructor in the Config class: .. _database-config-explanation-of-values: ********************* -Explanation of Values +Description of Values ********************* ================ =========================================================================================================== - Name Config Description + Config Name Description ================ =========================================================================================================== **DSN** The DSN connect string (an all-in-one configuration sequence). **hostname** The hostname of your database server. Often this is 'localhost'. @@ -154,31 +154,31 @@ Explanation of Values **DBDriver** The database driver name. The case must match the driver name. You can set a fully qualified classname to use your custom driver. Supported drivers: ``MySQLi``, ``Postgre``, ``SQLite3``, ``SQLSRV``, and ``OCI8``. -**DBPrefix** An optional table prefix which will added to the table name when running +**DBPrefix** An optional table prefix which will be added to the table name when running :doc:`Query Builder ` queries. This permits multiple CodeIgniter installations to share one database. **pConnect** true/false (boolean) - Whether to use a persistent connection. -**DBDebug** true/false (boolean) - Whether to throw exceptions or not when database errors occur. +**DBDebug** true/false (boolean) - Whether to throw exceptions when database errors occur. **charset** The character set used in communicating with the database. **DBCollat** (``MySQLi`` only) The character collation used in communicating with the database. **swapPre** A default table prefix that should be swapped with ``DBPrefix``. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user. **schema** (``Postgre`` and ``SQLSRV`` only) The database schema, default value varies by driver. -**encrypt** (``MySQLi`` and ``SQLSRV`` only) Whether or not to use an encrypted connection. +**encrypt** (``MySQLi`` and ``SQLSRV`` only) Whether to use an encrypted connection. See :ref:`MySQLi encrypt ` for ``MySQLi`` settings. ``SQLSRV`` driver accepts true/false. -**compress** (``MySQLi`` only) Whether or not to use client compression. +**compress** (``MySQLi`` only) Whether to use client compression. **strictOn** (``MySQLi`` only) true/false (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application. **port** The database port number - Empty string ``''`` for default port (or dynamic port with ``SQLSRV``). -**foreignKeys** (``SQLite3`` only) true/false (boolean) - Whether or not to enable Foreign Key constraint. +**foreignKeys** (``SQLite3`` only) true/false (boolean) - Whether to enable Foreign Key constraint. .. important:: SQLite3 Foreign Key constraint is disabled by default. See `SQLite documentation `_. To enforce Foreign Key constraint, set this config item to true. **busyTimeout** (``SQLite3`` only) milliseconds (int) - Sleeps for a specified amount of time when a table is locked. -**numberNative** (``MySQLi`` only) true/false (boolean) - Whether or not to enable MYSQLI_OPT_INT_AND_FLOAT_NATIVE. +**numberNative** (``MySQLi`` only) true/false (boolean) - Whether to enable MYSQLI_OPT_INT_AND_FLOAT_NATIVE. **dateFormat** The default date/time formats as PHP's `DateTime format`_. * ``date`` - date format * ``datetime`` - date and time format @@ -225,4 +225,4 @@ MySQLi driver accepts an array with the following options: * ``ssl_ca`` - Path to the certificate authority file * ``ssl_capath`` - Path to a directory containing trusted CA certificates in PEM format * ``ssl_cipher`` - List of *allowed* ciphers to be used for the encryption, separated by colons (``:``) -* ``ssl_verify`` - true/false; Whether to verify the server certificate or not +* ``ssl_verify`` - true/false (boolean) - Whether to verify the server certificate or not From 9333516d428d01bfb8a0c812b05d63bd541f12bc Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 25 Apr 2024 07:44:01 +0200 Subject: [PATCH 047/220] docs: Change path for SQLite3 sample in configuration.rst Change path for SQLite3 sample in configuration.rst --- user_guide_src/source/database/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index 2336c2a845af..86155dea0803 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -30,7 +30,7 @@ The name of the class property is the connection name, and can be used while connecting to specify a group name. .. note:: The default location of the SQLite3 database is the **writable** folder. - If you want to change the location, you must set the full path to the new folder (e.g., 'database' => '../db/database_name'). + If you want to change the location, you must set the full path to the new folder (e.g., 'database' => WRITEPATH . 'db/database_name.db'). DSN --- From 8427340e5344c20c2bd6ef0584030f6e69f31457 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 25 Apr 2024 16:49:12 +0900 Subject: [PATCH 048/220] test: add @var for PHPStan ------ ----------------------------------------------------- Line tests/system/Models/FindModelTest.php ------ ----------------------------------------------------- 50 Cannot access property $name on array. 51 Cannot access property $email on array. ------ ----------------------------------------------------- --- tests/system/Models/FindModelTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index 24946b4e2965..b0b835bc1067 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -45,6 +45,7 @@ public function testFindReturnsEntityWithCasts(): void ]); $id = $this->model->insert($user, true); + /** @var UserWithCasts $user */ $user = $this->model->find($id); $this->assertSame('John Smith', $user->name); From 84fa8f0e4b3c0774b343d05e83e357140d22de42 Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 25 Apr 2024 17:10:22 +0200 Subject: [PATCH 049/220] docs: Some typo in database/query_builder.rst Some typo in database/query_builder.rst --- user_guide_src/source/database/query_builder.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 5dac7926f7a8..ba5177093595 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -88,7 +88,7 @@ $query, which can be used to show the results: .. literalinclude:: query_builder/004.php -Please visit the :doc:`getResult*() method ` page for a full +Please visit the :doc:`getResult() method ` page for a full discussion regarding result generation. $builder->getCompiledSelect() @@ -101,14 +101,14 @@ Example: .. literalinclude:: query_builder/005.php -The first parameter enables you to set whether or not the query builder query +The parameter in the first query (false) enables you to set whether or not the query builder will be reset (by default it will be reset, just like when using ``$builder->get()``): .. literalinclude:: query_builder/006.php The key thing to notice in the above example is that the second query did not utilize ``limit(10, 20)`` but the generated SQL query has ``LIMIT 20, 10``. -The reason for this outcome is because the first parameter is set to ``false``. +The reason for this outcome is because the parameter in the first query is set to ``false``, ``limit(10, 20)`` remained in the second query. $builder->getWhere() -------------------- @@ -169,7 +169,7 @@ $builder->selectMin() --------------------- Writes a **SELECT MIN(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. literalinclude:: query_builder/011.php @@ -178,7 +178,7 @@ $builder->selectAvg() --------------------- Writes a **SELECT AVG(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. literalinclude:: query_builder/012.php @@ -187,7 +187,7 @@ $builder->selectSum() --------------------- Writes a **SELECT SUM(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. literalinclude:: query_builder/013.php @@ -196,7 +196,7 @@ $builder->selectCount() ----------------------- Writes a **SELECT COUNT(field)** portion for your query. As with -``selectMax()``, You can optionally include a second parameter to rename +``selectMax()``, you can optionally include a second parameter to rename the resulting field. .. note:: This method is particularly helpful when used with ``groupBy()``. For From 73de4806aa48ab4be531f34f71cfb9932fbade46 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 26 Apr 2024 08:48:19 +0700 Subject: [PATCH 050/220] docs: fix Command --- system/CLI/GeneratorTrait.php | 7 ++++++- system/Commands/Encryption/GenerateKey.php | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 5640a7ae1ac8..7505e3395d26 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -103,6 +103,8 @@ trait GeneratorTrait /** * Execute the command. * + * @param array $params + * * @deprecated use generateClass() instead */ protected function execute(array $params): void @@ -112,6 +114,8 @@ protected function execute(array $params): void /** * Generates a class file from an existing template. + * + * @param array $params */ protected function generateClass(array $params): void { @@ -134,7 +138,8 @@ protected function generateClass(array $params): void /** * Generate a view file from an existing template. * - * @param string $view namespaced view name that is generated + * @param string $view namespaced view name that is generated + * @param array $params */ protected function generateView(string $view, array $params): void { diff --git a/system/Commands/Encryption/GenerateKey.php b/system/Commands/Encryption/GenerateKey.php index 820ec48137c9..21a582a06725 100644 --- a/system/Commands/Encryption/GenerateKey.php +++ b/system/Commands/Encryption/GenerateKey.php @@ -124,6 +124,8 @@ protected function generateRandomKey(string $prefix, int $length): string /** * Sets the new encryption key in your .env file. + * + * @param array $params */ protected function setNewEncryptionKey(string $key, array $params): bool { @@ -139,6 +141,8 @@ protected function setNewEncryptionKey(string $key, array $params): bool /** * Checks whether to overwrite existing encryption key. + * + * @param array $params */ protected function confirmOverwrite(array $params): bool { From 7532ae17342e605929a9396c9b8ccf5f42e6dfd7 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 26 Apr 2024 09:20:41 +0700 Subject: [PATCH 051/220] run: generate phpstan-baseline.php --- phpstan-baseline.php | 220 ------------------------------------------- 1 file changed, 220 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 3fdb6424df80..d8f96c646890 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -706,31 +706,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Encryption/GenerateKey.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Encryption\\\\GenerateKey\\:\\:confirmOverwrite\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Encryption/GenerateKey.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Encryption\\\\GenerateKey\\:\\:setNewEncryptionKey\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Encryption/GenerateKey.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -756,21 +731,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -796,21 +756,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -836,21 +781,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -876,21 +806,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -916,21 +831,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -956,21 +856,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -996,21 +881,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -1036,21 +906,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -1076,21 +931,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -1116,21 +956,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -1156,21 +981,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9741,21 +9551,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Cells/StarterCell.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9791,21 +9586,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Commands/ParamsReveal.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:execute\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:generateClass\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:generateView\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, From 3e4b23bcff77fbeef6ad7479b9add983c380c968 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 26 Apr 2024 09:54:54 +0700 Subject: [PATCH 052/220] docs: fix Commands --- phpstan-baseline.php | 210 ---------------------------------- system/CLI/GeneratorTrait.php | 5 +- 2 files changed, 4 insertions(+), 211 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index d8f96c646890..bff02e1a156e 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -706,21 +706,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Encryption/GenerateKey.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -731,21 +716,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -756,21 +726,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -781,21 +736,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -806,21 +746,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -831,21 +756,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -856,21 +766,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -881,21 +776,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -906,21 +786,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -931,21 +796,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -956,21 +806,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -981,21 +816,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9551,21 +9371,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Cells/StarterCell.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9586,21 +9391,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Commands/ParamsReveal.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:parseTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:parseTemplate\\(\\) has parameter \\$replace with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:parseTemplate\\(\\) has parameter \\$search with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 7505e3395d26..627cea4ee613 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -357,7 +357,10 @@ protected function renderTemplate(array $data = []): string /** * Performs pseudo-variables contained within view file. * - * @param string $class namespaced classname or namespaced view. + * @param string $class namespaced classname or namespaced view. + * @param list $search + * @param list $replace + * @param array $data * * @return string generated file content */ From 76d11deca011ef346b75959f3dc76c70ce2a0420 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 26 Apr 2024 09:58:10 +0700 Subject: [PATCH 053/220] docs: fix Commands --- phpstan-baseline.php | 70 ----------------------------------- system/CLI/GeneratorTrait.php | 2 + 2 files changed, 2 insertions(+), 70 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index bff02e1a156e..053f659cb1d4 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -706,121 +706,61 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Encryption/GenerateKey.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9371,11 +9311,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Cells/StarterCell.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; $ignoreErrors[] = [ 'message' => '#^Property Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9391,11 +9326,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Commands/ParamsReveal.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:renderTemplate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; $ignoreErrors[] = [ 'message' => '#^Property Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:\\$params type has no value type specified in iterable type array\\.$#', 'count' => 1, diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 627cea4ee613..ae0b79816907 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -336,6 +336,8 @@ private function normalizeInputClassName(): string /** * Gets the generator view as defined in the `Config\Generators::$views`, * with fallback to `$template` when the defined view does not exist. + * + * @param array $data */ protected function renderTemplate(array $data = []): string { From b5ec948e0cfe24668afe782bc752d6e7fa9fffda Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 26 Apr 2024 10:14:06 +0700 Subject: [PATCH 054/220] docs: fix Commands --- phpstan-baseline.php | 70 ----------------------------------- system/CLI/GeneratorTrait.php | 2 +- 2 files changed, 1 insertion(+), 71 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 053f659cb1d4..1959aea9685c 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -706,66 +706,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Commands/Encryption/GenerateKey.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\TestGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/TestGenerator.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Commands\\\\ListCommands\\:\\:listFull\\(\\) has no return type specified\\.$#', 'count' => 1, @@ -9311,11 +9251,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Cells/StarterCell.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property Tests\\\\Support\\\\Commands\\\\LanguageCommand\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/LanguageCommand.php', -]; $ignoreErrors[] = [ 'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#', 'count' => 1, @@ -9326,11 +9261,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/_support/Commands/ParamsReveal.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property Tests\\\\Support\\\\Commands\\\\Unsuffixable\\:\\:\\$params type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Commands/Unsuffixable.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Tests\\\\Support\\\\Config\\\\BadRegistrar\\:\\:RegistrarConfig\\(\\) has no return type specified\\.$#', 'count' => 1, diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index ae0b79816907..759fe0e84ae3 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -96,7 +96,7 @@ trait GeneratorTrait * * @internal * - * @var array + * @var array */ private $params = []; From e49aa37ac7d500a36da90f38ca25a8c297686c0a Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 26 Apr 2024 07:23:08 +0200 Subject: [PATCH 055/220] docs: Added getCompiledSelect method parameter's default value in query_builder.rst Added getCompiledSelect method parameter's default value explanation in query_builder.rst --- user_guide_src/source/database/query_builder.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index ba5177093595..434392a74b22 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -101,8 +101,8 @@ Example: .. literalinclude:: query_builder/005.php -The parameter in the first query (false) enables you to set whether or not the query builder -will be reset (by default it will be reset, just like when using ``$builder->get()``): +The parameter (false) in the first query below enables you to set whether or not the query builder +will be reset (because the default value of the parameter is true, ``getCompiledSelect(bool $reset = true)``, by default it will be reset just like when using ``$builder->get()``): .. literalinclude:: query_builder/006.php From 6abf095cf86f4f5961bb8ef789cf5d06a076d7ee Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 26 Apr 2024 08:02:56 +0200 Subject: [PATCH 056/220] docs: Added link to getResult() method in results.rst Added link to getResult() method in results.rst --- user_guide_src/source/database/results.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index a5d490a81a20..93e2bef67018 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -12,6 +12,8 @@ There are several ways to generate query results: Result Arrays ************* +.. _getresult: + getResult() =========== From 28d9a43b93a96231b82501eb5364dc7ca0f94ba9 Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 26 Apr 2024 08:08:03 +0200 Subject: [PATCH 057/220] docs: Update link to getResult() method in query_builder.rst Update link to getResult() method in query_builder.rst --- user_guide_src/source/database/query_builder.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 434392a74b22..9be16e2fba82 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -88,7 +88,7 @@ $query, which can be used to show the results: .. literalinclude:: query_builder/004.php -Please visit the :doc:`getResult() method ` page for a full +Please visit the :doc:`getResult() method ` method for a full discussion regarding result generation. $builder->getCompiledSelect() From 9a05a1625dd46e80e6bf3e763ead8eee2435a67c Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 26 Apr 2024 11:18:40 +0200 Subject: [PATCH 058/220] docs: Correct getresult link in query_builder.rst Correct getresult link in query_builder.rst --- user_guide_src/source/database/query_builder.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 9be16e2fba82..682833bff0bd 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -88,7 +88,7 @@ $query, which can be used to show the results: .. literalinclude:: query_builder/004.php -Please visit the :doc:`getResult() method ` method for a full +Please visit the :doc:`getResult() method ` method for a full discussion regarding result generation. $builder->getCompiledSelect() From 5d09e424cdaec3f2fd3a43fdb4f886f363ceabd6 Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 26 Apr 2024 11:53:46 +0200 Subject: [PATCH 059/220] docs: Change Query Helper Functions to Methods in database/index.rst Change Query Helper Functions to Methods in database/index.rst --- user_guide_src/source/database/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst index 0862ec0f4125..29920f0c9756 100644 --- a/user_guide_src/source/database/index.rst +++ b/user_guide_src/source/database/index.rst @@ -14,7 +14,7 @@ patterns. The database functions offer clear, simple syntax. Connecting to a Database Running Queries Generating Query Results - Query Helper Functions + Query Helper Methods Query Builder Class Transactions Getting MetaData From 3529d62bc0f976196b92c8905d02495042e9b94c Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 26 Apr 2024 11:55:57 +0200 Subject: [PATCH 060/220] docs: Change backwards to backward for consistency in database/results.rst Change backwards to backward for consistency in database/results.rst --- user_guide_src/source/database/results.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index 93e2bef67018..85e57c3be70e 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -95,7 +95,7 @@ digit in the first parameter: .. literalinclude:: results/009.php -In addition, you can walk forward/backwards/first/last through your +In addition, you can walk forward/backward/first/last through your results using these variations: | ``$row = $query->getFirstRow()`` From 1fc8af97de6eb4bf9dad0bdf14d238245974205b Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 26 Apr 2024 11:58:06 +0200 Subject: [PATCH 061/220] docs: Delete unnecessary "Example:" in database/helpers.rst Delete unnecessary "Example:" in database/helpers.rst --- user_guide_src/source/database/helpers.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide_src/source/database/helpers.rst b/user_guide_src/source/database/helpers.rst index 0d640f6422e1..0542057379b1 100644 --- a/user_guide_src/source/database/helpers.rst +++ b/user_guide_src/source/database/helpers.rst @@ -42,7 +42,6 @@ $db->countAll() Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. This is part of Query Builder. -Example: .. literalinclude:: helpers/001.php @@ -51,7 +50,6 @@ $db->countAllResults() Permits you to determine the number of rows in a particular result set. Submit the table name in the first parameter. This is part of Query Builder. -Example: .. literalinclude:: helpers/002.php From 213fd504ef3b0636fb9d052f817fcdf9bff6e863 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 27 Apr 2024 10:43:45 +0900 Subject: [PATCH 062/220] chore: update Kint to 5.1.1 --- system/ThirdParty/Kint/Parser/FsPathPlugin.php | 10 ++++++++-- system/ThirdParty/Kint/Parser/MysqliPlugin.php | 3 ++- system/ThirdParty/Kint/Zval/BlobValue.php | 4 +++- .../Zval/Representation/SplFileInfoRepresentation.php | 2 +- system/ThirdParty/Kint/init.php | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/system/ThirdParty/Kint/Parser/FsPathPlugin.php b/system/ThirdParty/Kint/Parser/FsPathPlugin.php index 7ec49de109cc..1a98c6dcd134 100644 --- a/system/ThirdParty/Kint/Parser/FsPathPlugin.php +++ b/system/ThirdParty/Kint/Parser/FsPathPlugin.php @@ -30,6 +30,7 @@ use Kint\Zval\Representation\SplFileInfoRepresentation; use Kint\Zval\Value; use SplFileInfo; +use TypeError; class FsPathPlugin extends AbstractPlugin { @@ -59,8 +60,13 @@ public function parse(&$var, Value &$o, int $trigger): void return; } - if (!@\file_exists($var)) { - return; + try { + if (!@\file_exists($var)) { + return; + } + } catch (TypeError $e) {// @codeCoverageIgnore + // Only possible in PHP 7 + return; // @codeCoverageIgnore } if (\in_array($var, self::$blacklist, true)) { diff --git a/system/ThirdParty/Kint/Parser/MysqliPlugin.php b/system/ThirdParty/Kint/Parser/MysqliPlugin.php index 90a4abd6b511..22a23a901ccb 100644 --- a/system/ThirdParty/Kint/Parser/MysqliPlugin.php +++ b/system/ThirdParty/Kint/Parser/MysqliPlugin.php @@ -105,7 +105,8 @@ public function parse(&$var, Value &$o, int $trigger): void foreach ($o->value->contents as $key => $obj) { if (isset($this->connected_readable[$obj->name])) { if (!$connected) { - continue; + // No failed connections after PHP 8.1 + continue; // @codeCoverageIgnore } } elseif (isset($this->empty_readable[$obj->name])) { // No failed connections after PHP 8.1 diff --git a/system/ThirdParty/Kint/Zval/BlobValue.php b/system/ThirdParty/Kint/Zval/BlobValue.php index 5e9f129d1181..66f60fdb9043 100644 --- a/system/ThirdParty/Kint/Zval/BlobValue.php +++ b/system/ThirdParty/Kint/Zval/BlobValue.php @@ -182,7 +182,9 @@ public static function detectEncoding(string $string) if (\function_exists('iconv')) { foreach (self::$legacy_encodings as $encoding) { // Iconv detection works by triggering - // "Detected an illegal character in input string" warnings + // "Detected an illegal character in input string" notices + // This notice does not become a TypeError with strict_types + // so we don't have to wrap this in a try catch if (@\iconv($encoding, $encoding, $string) === $string) { return $encoding; } diff --git a/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php b/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php index 6424ee6a9175..dad9d04cdc9e 100644 --- a/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php +++ b/system/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php @@ -76,7 +76,7 @@ public function __construct(SplFileInfo $fileInfo) } } catch (RuntimeException $e) { if (false === \strpos($e->getMessage(), ' open_basedir ')) { - throw $e; + throw $e; // @codeCoverageIgnore } } diff --git a/system/ThirdParty/Kint/init.php b/system/ThirdParty/Kint/init.php index 039489ab43ad..d682d9a9dc36 100644 --- a/system/ThirdParty/Kint/init.php +++ b/system/ThirdParty/Kint/init.php @@ -51,7 +51,7 @@ if (false !== \ini_get('xdebug.file_link_format')) { Kint::$file_link_format = \ini_get('xdebug.file_link_format'); } -if (isset($_SERVER['DOCUMENT_ROOT'])) { +if (isset($_SERVER['DOCUMENT_ROOT']) && false === \strpos($_SERVER['DOCUMENT_ROOT'], "\0")) { Kint::$app_root_dirs = [ $_SERVER['DOCUMENT_ROOT'] => '', ]; From 37d68708e8ee3f237e197a8d89988bbf1ca69762 Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 27 Apr 2024 09:35:49 +0200 Subject: [PATCH 063/220] docs: Small typos in database/metadata.rst Fix some small typos in database/metadata.rst --- user_guide_src/source/database/metadata.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/database/metadata.rst b/user_guide_src/source/database/metadata.rst index 85dcdc0b1d33..03bf91230e0e 100644 --- a/user_guide_src/source/database/metadata.rst +++ b/user_guide_src/source/database/metadata.rst @@ -1,6 +1,6 @@ -################# -Database Metadata -################# +################ +Getting Metadata +################ .. contents:: :local: @@ -71,9 +71,7 @@ performing an action. Returns a boolean true/false. Usage example: .. literalinclude:: metadata/005.php -.. note:: Replace *field_name* with the name of the column you are looking - for, and replace *table_name* with the name of the table you are - looking for. +.. note:: Replace *field_name* and *table_name* with the column name and the table name you are looking for. Retrieve Field Metadata ======================= @@ -88,7 +86,7 @@ Returns an array of objects containing field information. Sometimes it's helpful to gather the field names or other metadata, like the column type, max length, etc. -.. note:: Not all databases provide meta-data. +.. note:: Not all databases provide metadata. Usage example: From c12915ee0f43c3bd1194824f8cc45e9e7acac44a Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 27 Apr 2024 11:02:21 +0200 Subject: [PATCH 064/220] docs: Fix getresult link in database/query_builder.rst Fix getresult link in database/query_builder.rst --- user_guide_src/source/database/query_builder.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 682833bff0bd..171c354d1120 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -88,7 +88,7 @@ $query, which can be used to show the results: .. literalinclude:: query_builder/004.php -Please visit the :doc:`getResult() method ` method for a full +Please visit the :ref:`getResult() ` method for a full discussion regarding result generation. $builder->getCompiledSelect() From 996893f2c159f4adceaa3bd556b89d08a37c4b29 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Sat, 27 Apr 2024 16:02:41 +0700 Subject: [PATCH 065/220] Update system/CLI/GeneratorTrait.php Co-authored-by: kenjis --- system/CLI/GeneratorTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 759fe0e84ae3..258f12379dd6 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -337,7 +337,7 @@ private function normalizeInputClassName(): string * Gets the generator view as defined in the `Config\Generators::$views`, * with fallback to `$template` when the defined view does not exist. * - * @param array $data + * @param array $data */ protected function renderTemplate(array $data = []): string { From c61c9f8cb8d74f63ca5c46255a1b36d09272b1fa Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 27 Apr 2024 11:36:19 +0200 Subject: [PATCH 066/220] docs: Change page header in database/utilities.rst Change page header to be consistent with the menu in database/utilities.rst --- user_guide_src/source/database/utilities.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst index c8c11e51d864..00c04ebaddc9 100644 --- a/user_guide_src/source/database/utilities.rst +++ b/user_guide_src/source/database/utilities.rst @@ -1,6 +1,6 @@ -###################### -Database Utility Class -###################### +################## +Database Utilities +################## The Database Utility Class contains methods that help you manage your database. From c4a58da38fda4c7ace80a7e7f23d9c02ff11393b Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 27 Apr 2024 11:42:08 +0200 Subject: [PATCH 067/220] docs: Change MetaData to Metadata in database/metadata.rst Change MetaData to Metadata in database/metadata.rst --- user_guide_src/source/database/metadata.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/database/metadata.rst b/user_guide_src/source/database/metadata.rst index 03bf91230e0e..7674c401b793 100644 --- a/user_guide_src/source/database/metadata.rst +++ b/user_guide_src/source/database/metadata.rst @@ -7,7 +7,7 @@ Getting Metadata :depth: 2 ************** -Table MetaData +Table Metadata ************** These functions let you fetch table information. @@ -39,7 +39,7 @@ running an operation on it. Returns a boolean true/false. Usage example: .. note:: Replace *table_name* with the name of the table you are looking for. ************** -Field MetaData +Field Metadata ************** List the Fields in a Table From 08d8a1aa96717de871d9a7809d7e03a65e40f56f Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 27 Apr 2024 11:44:05 +0200 Subject: [PATCH 068/220] docs: Change MetaData to Metadata in database/index.rst Change MetaData to Metadata in database/index.rst --- user_guide_src/source/database/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst index 0862ec0f4125..e9ab69ad17cb 100644 --- a/user_guide_src/source/database/index.rst +++ b/user_guide_src/source/database/index.rst @@ -14,10 +14,10 @@ patterns. The database functions offer clear, simple syntax. Connecting to a Database Running Queries Generating Query Results - Query Helper Functions + Query Helper Methods Query Builder Class Transactions - Getting MetaData + Getting Metadata Custom Function Calls Database Events Database Utilities From d1631d64bf3a4e38102bf35495f67b7e57606298 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 28 Apr 2024 11:18:23 +0900 Subject: [PATCH 069/220] docs: add/update description for lang() --- user_guide_src/source/general/common_functions.rst | 10 ++++++---- user_guide_src/source/outgoing/localization.rst | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 05e43026675d..61b92a99df92 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -106,13 +106,15 @@ Service Accessors .. php:function:: lang($line[, $args[, $locale]]) - :param string $line: The line of text to retrieve + :param string $line: The language filename and the key of the text to retrieve. :param array $args: An array of data to substitute for placeholders. - :param string $locale: Specify a different locale to be used instead of default one. + :param string $locale: Specify a different locale to be used instead of the current locale. + :returns: The text in the language file + :rtype: list|string - Retrieves a locale-specific file based on an alias string. + Retrieves text from the language files. - For more information, see the :doc:`Localization ` page. + For more information, see the :ref:`language-localization`. .. php:function:: model($name[, $getShared = true[, &$conn = null]]) diff --git a/user_guide_src/source/outgoing/localization.rst b/user_guide_src/source/outgoing/localization.rst index 50fb7053beb2..c03ddd49b1a5 100644 --- a/user_guide_src/source/outgoing/localization.rst +++ b/user_guide_src/source/outgoing/localization.rst @@ -130,6 +130,8 @@ Alternatively, you can use the :doc:`Services class ` to ret .. literalinclude:: localization/006.php +.. _language-localization: + ********************* Language Localization ********************* From 0153a896566db38f06d31dfa378d2cd1236bf548 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 28 Apr 2024 11:18:49 +0900 Subject: [PATCH 070/220] docs: add text decration --- user_guide_src/source/outgoing/localization.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/outgoing/localization.rst b/user_guide_src/source/outgoing/localization.rst index c03ddd49b1a5..f9f7e096b6e9 100644 --- a/user_guide_src/source/outgoing/localization.rst +++ b/user_guide_src/source/outgoing/localization.rst @@ -159,8 +159,10 @@ Basic Usage =========== You can use the :php:func:`lang()` helper function to retrieve text from any of the language files, by passing the -filename and the language key as the first parameter, separated by a period (.). For example, to load the -``errorEmailMissing`` string from the **Errors.php** language file, you would do the following: +filename and the language key as the first parameter, separated by a period (``.``). + +For example, to load the ``errorEmailMissing`` string from the **Errors.php** +language file, you would do the following: .. literalinclude:: localization/010.php @@ -169,7 +171,7 @@ For nested definition, you would do the following: .. literalinclude:: localization/011.php If the requested language key doesn't exist in the file for the current locale, the string will be passed -back, unchanged. In this example, it would return 'Errors.errorEmailMissing' or 'Errors.nested.error.message' if it didn't exist. +back, unchanged. In this example, it would return ``Errors.errorEmailMissing`` or ``Errors.nested.error.message`` if it didn't exist. Replacing Parameters -------------------- From e98c5e60f2cacbfec15d133de89a4bb86a4b44f9 Mon Sep 17 00:00:00 2001 From: obozdag Date: Sun, 28 Apr 2024 11:41:21 +0200 Subject: [PATCH 071/220] docs: Update menu user_guide_src/source/database/index.rst Co-authored-by: kenjis --- user_guide_src/source/database/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst index e9ab69ad17cb..e24066e8dc3e 100644 --- a/user_guide_src/source/database/index.rst +++ b/user_guide_src/source/database/index.rst @@ -14,7 +14,7 @@ patterns. The database functions offer clear, simple syntax. Connecting to a Database Running Queries Generating Query Results - Query Helper Methods + helpers Query Builder Class Transactions Getting Metadata From 6a79a09702bf841d7c28274a9d3bb763b149d423 Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 29 Apr 2024 14:12:14 +0200 Subject: [PATCH 072/220] docs: Fix typo in models/model.rst Fix typo in models/model.rst --- user_guide_src/source/models/model.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index 02c97a1b48a7..edc4139a4d42 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -34,7 +34,7 @@ See :ref:`factories-loading-class` for details on the first parameter. CodeIgniter's Model ******************* -CodeIgniter does provide a model class that provides a few nice features, including: +CodeIgniter does provide a model class that has a few nice features, including: - automatic database connection - basic CRUD methods @@ -580,7 +580,7 @@ automatically, based on whether it finds an array key matching the **primary key The save method also can make working with custom class result objects much simpler by recognizing a non-simple object and grabbing its public and protected values into an array, which is then passed to the appropriate insert or update method. This allows you to work with Entity classes in a very clean way. Entity classes are -simple classes that represent a single instance of an object type, like a user, a blog post, job, etc. This +simple classes that represent a single instance of an object type, like a user, a blog post, a job, etc. This class is responsible for maintaining the business logic surrounding the object itself, like formatting elements in a certain way, etc. They shouldn't have any idea about how they are saved to the database. At their simplest, they might look like this: From 75bd0ac69c7a39d0cbd330a54e994f5d2a3c286f Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 29 Apr 2024 16:51:41 +0200 Subject: [PATCH 073/220] docs: Fix typo in models/entities.rst Fix typo in models/entities.rst --- user_guide_src/source/models/entities.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/models/entities.rst b/user_guide_src/source/models/entities.rst index bcc0c2ec57d0..ce5313f4115d 100644 --- a/user_guide_src/source/models/entities.rst +++ b/user_guide_src/source/models/entities.rst @@ -258,8 +258,8 @@ Array/Json Casting Array/Json casting is especially useful with fields that store serialized arrays or json in them. When cast as: * an **array**, they will automatically be unserialized, -* a **json**, they will automatically be set as an value of ``json_decode($value, false)``, -* a **json-array**, they will automatically be set as an value of ``json_decode($value, true)``, +* a **json**, they will automatically be set as a value of ``json_decode($value, false)``, +* a **json-array**, they will automatically be set as a value of ``json_decode($value, true)``, when you set the property's value. Unlike the rest of the data types that you can cast properties into, the: From 694aa97ebbc0bb0b0cc699beb426d09b1dbcc7ed Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 30 Apr 2024 11:49:03 +0900 Subject: [PATCH 074/220] docs: update deprecated method in sample code --- user_guide_src/source/libraries/curlrequest/009.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/curlrequest/009.php b/user_guide_src/source/libraries/curlrequest/009.php index 49eaa5ec7562..934213024009 100644 --- a/user_guide_src/source/libraries/curlrequest/009.php +++ b/user_guide_src/source/libraries/curlrequest/009.php @@ -1,4 +1,4 @@ getStatusCode(); // 200 -$reason = $response->getReason(); // OK +$code = $response->getStatusCode(); // 200 +$reason = $response->getReasonPhrase(); // OK From b4fe6d26617b2da7f58fb741fe58c83c83a466ea Mon Sep 17 00:00:00 2001 From: obozdag Date: Tue, 30 Apr 2024 06:38:24 +0200 Subject: [PATCH 075/220] docs: Solve conflict in database/index.rst Solve conflict in database/index.rst --- user_guide_src/source/database/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst index e24066e8dc3e..e9ab69ad17cb 100644 --- a/user_guide_src/source/database/index.rst +++ b/user_guide_src/source/database/index.rst @@ -14,7 +14,7 @@ patterns. The database functions offer clear, simple syntax. Connecting to a Database Running Queries Generating Query Results - helpers + Query Helper Methods Query Builder Class Transactions Getting Metadata From 46ea07b4fb6519ac6a32870bef1cc99cc944562a Mon Sep 17 00:00:00 2001 From: obozdag Date: Tue, 30 Apr 2024 11:13:47 +0200 Subject: [PATCH 076/220] docs: Fix typo in dbmgmt/forge.rst Fix typo in dbmgmt/forge.rst --- user_guide_src/source/dbmgmt/forge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/dbmgmt/forge.rst b/user_guide_src/source/dbmgmt/forge.rst index 241743fb487e..00915a5dae81 100644 --- a/user_guide_src/source/dbmgmt/forge.rst +++ b/user_guide_src/source/dbmgmt/forge.rst @@ -41,7 +41,7 @@ Returns true/false based on success or failure: .. literalinclude:: forge/003.php An optional second parameter set to true will add ``IF EXISTS`` statement -or will check if a database exists before create it (depending on DBMS). +or will check if a database exists before creating it (depending on DBMS). .. literalinclude:: forge/004.php From dc050da64aabe2943305182bed7a210dad53a211 Mon Sep 17 00:00:00 2001 From: obozdag Date: Tue, 30 Apr 2024 11:18:02 +0200 Subject: [PATCH 077/220] docs: Shorten the menu item in dbmgmt/index.rst Shorten the menu item "Database Manipulation with Database Forge" to "Database Forge" --- user_guide_src/source/dbmgmt/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/dbmgmt/index.rst b/user_guide_src/source/dbmgmt/index.rst index 68bfea3e6098..38701c2e1ac8 100644 --- a/user_guide_src/source/dbmgmt/index.rst +++ b/user_guide_src/source/dbmgmt/index.rst @@ -7,7 +7,7 @@ CodeIgniter comes with tools to restructure or seed your database. .. toctree:: :titlesonly: - Database Manipulation with Database Forge + Database Forge Database Migrations Database Seeding db_commands From f9a2e2441ef999f7dd09950bf53e918bff8ea8f1 Mon Sep 17 00:00:00 2001 From: obozdag Date: Tue, 30 Apr 2024 13:51:27 +0200 Subject: [PATCH 078/220] docs: Fix typo in dbtgmt/migration.rst Fix typo in dbtgmt/migration.rst --- user_guide_src/source/dbmgmt/migration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index 5b6b09dc4414..f0bb37b279a5 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -209,7 +209,7 @@ creates is the Pascal case version of the filename. php spark make:migration [options] -You can use (``make:migration``) with the following options: +You can use (make:migration) with the following options: - ``--namespace`` - Set root namespace. Default: ``APP_NAMESPACE``. - ``--suffix`` - Append the component title to the class name. From 13702a4f1bb8b472b37f51d53d0e7b1948939395 Mon Sep 17 00:00:00 2001 From: obozdag Date: Tue, 30 Apr 2024 17:12:16 +0200 Subject: [PATCH 079/220] docs: Fix typos in libraries/caching.rst Fix typos in libraries/caching.rst --- user_guide_src/source/libraries/caching.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index dd735a8a12c0..a09f6e9f385b 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -67,7 +67,7 @@ This is an array of settings specific to the ``File`` handler to determine how $memcached ========== -This is an array of servers that will be used when using the ``Memcache(d)`` handler. +This is an array of servers that will be used when using the ``Memcached`` handler. $redis ====== @@ -155,7 +155,7 @@ Class Reference .. literalinclude:: caching/004.php - .. note:: The ``$raw`` parameter is only utilized by Memcache, + .. note:: The ``$raw`` parameter is only utilized by Memcached, in order to allow usage of ``increment()`` and ``decrement()``. .. php:method:: delete($key): bool @@ -280,7 +280,7 @@ Drivers File-based Caching ================== -Unlike caching from the Output Class, the driver file-based caching +Unlike caching from the Output Class, the file-based caching allows for pieces of view files to be cached. Use this with care, and make sure to benchmark your application, as a point can come where disk I/O will negate positive gains by caching. This requires a cache From adeca44aa3db2719713913f5670288a20e649c05 Mon Sep 17 00:00:00 2001 From: obozdag Date: Wed, 1 May 2024 08:28:14 +0200 Subject: [PATCH 080/220] docs: Fix typos for consistency in dbmgmt/migration.rst Fix typos for consistency in dbmgmt/migration.rst --- user_guide_src/source/dbmgmt/migration.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index f0bb37b279a5..dec16c5037ff 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -121,7 +121,7 @@ Migrates a database group with all available migrations: php spark migrate -You can use (migrate) with the following options: +You can use ``migrate`` with the following options: - ``-g`` - to specify database group. If specified, only migrations for the specified database group will be run. If not specified, all migrations will be run. - ``-n`` - to choose namespace, otherwise ``App`` namespace will be used. @@ -145,8 +145,8 @@ When using the ``--all`` option, it will scan through all namespaces attempting not been run. These will all be collected and then sorted as a group by date created. This should help to minimize any potential conflicts between the main application and any modules. -rollback -======== +migrate:rollback +================ Rolls back all migrations to a blank slate, effectively migration 0: @@ -154,13 +154,13 @@ Rolls back all migrations to a blank slate, effectively migration 0: php spark migrate:rollback -You can use (rollback) with the following options: +You can use ``migrate:rollback`` with the following options: - ``-b`` - to choose a batch: natural numbers specify the batch. - ``-f`` - to force a bypass confirmation question, it is only asked in a production environment. -refresh -======= +migrate:refresh +=============== Refreshes the database state by first rolling back all migrations, and then migrating all: @@ -168,15 +168,15 @@ Refreshes the database state by first rolling back all migrations, and then migr php spark migrate:refresh -You can use (refresh) with the following options: +You can use ``migrate:refresh`` with the following options: - ``-g`` - to specify database group. If specified, only migrations for the specified database group will be run. If not specified, all migrations will be run. - ``-n`` - to choose namespace, otherwise ``App`` namespace will be used. - ``--all`` - to refresh all namespaces. - ``-f`` - to force a bypass confirmation question, it is only asked in a production environment. -status -====== +migrate:status +============== Displays a list of all migrations and the date and time they ran, or '--' if they have not been run: @@ -194,7 +194,7 @@ Displays a list of all migrations and the date and time they ran, or '--' if the | CodeIgniter\Settings | 2021-11-14-143905 | AddContextColumn | default | 2022-04-06 01:23:08 | 1 | +----------------------+-------------------+-----------------------+---------+---------------------+-------+ -You can use (status) with the following options: +You can use ``migrate:status`` with the following options: - ``-g`` - to specify database group. If specified, only migrations for the specified database group will be checked. If not specified, all migrations will be checked. @@ -209,7 +209,7 @@ creates is the Pascal case version of the filename. php spark make:migration [options] -You can use (make:migration) with the following options: +You can use ``make:migration`` with the following options: - ``--namespace`` - Set root namespace. Default: ``APP_NAMESPACE``. - ``--suffix`` - Append the component title to the class name. From 723af86bfca9c856e712289ae897cdaea4dd0cd1 Mon Sep 17 00:00:00 2001 From: obozdag Date: Wed, 1 May 2024 10:23:39 +0200 Subject: [PATCH 081/220] docs: Fix sentence in File-based Caching in libraries/caching.rst Fix sentence in File-based Caching in libraries/caching.rst --- user_guide_src/source/libraries/caching.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index a09f6e9f385b..fa27a2c53397 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -280,8 +280,7 @@ Drivers File-based Caching ================== -Unlike caching from the Output Class, the file-based caching -allows for pieces of view files to be cached. Use this with care, and +File-based caching allows for pieces of view files to be cached. Use this with care, and make sure to benchmark your application, as a point can come where disk I/O will negate positive gains by caching. This requires a cache directory to be really writable by the application. From 1ff88899e84e02515ab95e5a75754307a8de8f72 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 2 May 2024 10:53:57 +0900 Subject: [PATCH 082/220] fix: remove unused undefined param $raw It is not defined in the interface and other classes, and not used at all. --- system/Test/Mock/MockCache.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/Test/Mock/MockCache.php b/system/Test/Mock/MockCache.php index df2179678de5..85b5fd9e7e14 100644 --- a/system/Test/Mock/MockCache.php +++ b/system/Test/Mock/MockCache.php @@ -92,11 +92,10 @@ public function remember(string $key, int $ttl, Closure $callback) * @param string $key Cache item name * @param mixed $value the data to save * @param int $ttl Time To Live, in seconds (default 60) - * @param bool $raw Whether to store the raw value. * * @return bool */ - public function save(string $key, $value, int $ttl = 60, bool $raw = false) + public function save(string $key, $value, int $ttl = 60) { if ($this->bypass) { return false; From 99baa7376e0ffaf8e243abae68a5a57c1717a8ea Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 2 May 2024 09:49:51 +0200 Subject: [PATCH 083/220] docs: Change some decorations libraries/caching.rst Change some decorations libraries/caching.rst --- user_guide_src/source/libraries/caching.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index fa27a2c53397..3b4fdc5d4c53 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -36,14 +36,14 @@ $handler ======== The is the name of the handler that should be used as the primary handler when starting up the engine. -Available names are: dummy, file, memcached, redis, predis, wincache. +Available names are: dummy, file, memcached, redis, predis, wincache. This is commonly the **File** handler +since the file system is always available, but may not fit more complex, multi-server setups. $backupHandler ============== In the case that the first choice ``$handler`` is not available, this is the next cache handler to load. -This is commonly the ``File`` handler since the file system is always available, but may not fit -more complex, multi-server setups. +The default backup handler is **dummy**. $prefix ======= @@ -62,17 +62,17 @@ to projects and modules. This will replace the hard-coded value in a future rele $file ===== -This is an array of settings specific to the ``File`` handler to determine how it should save the cache files. +This is an array of settings specific to the **File** handler to determine how it should save the cache files. $memcached ========== -This is an array of servers that will be used when using the ``Memcached`` handler. +This is an array of servers that will be used when using the **Memcached** handler. $redis ====== -The settings for the Redis server that you wish to use when using the ``Redis`` and ``Predis`` handler. +The settings for the Redis server that you wish to use when using the **Redis** and **Predis** handler. ****************** Command-Line Tools From 6056e30953e4ddc35a2adb87de65638ffbb4b555 Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 2 May 2024 10:05:02 +0200 Subject: [PATCH 084/220] docs: Remove $raw parameter from save method in libraries/caching.rst Remove $raw parameter from save method in libraries/caching.rst --- user_guide_src/source/libraries/caching.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index 3b4fdc5d4c53..908e429d543d 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -139,12 +139,11 @@ Class Reference Gets an item from the cache. If ``null`` was returned, this will invoke the callback and save the result. Either way, this will return the value. - .. php:method:: save(string $key, $data[, int $ttl = 60[, $raw = false]]) + .. php:method:: save(string $key, $data[, int $ttl = 60]) :param string $key: Cache item name :param mixed $data: the data to save :param int $ttl: Time To Live, in seconds (default 60) - :param bool $raw: Whether to store the raw value :returns: ``true`` on success, ``false`` on failure :rtype: bool @@ -155,9 +154,6 @@ Class Reference .. literalinclude:: caching/004.php - .. note:: The ``$raw`` parameter is only utilized by Memcached, - in order to allow usage of ``increment()`` and ``decrement()``. - .. php:method:: delete($key): bool :param string $key: name of cached item From 7e17608d4ac8798a2267d5f724ede4baed0aaf26 Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 4 May 2024 08:46:00 +0200 Subject: [PATCH 085/220] docs: Fix typos in libraries/cookies.rst Fix typos in libraries/cookies.rst --- user_guide_src/source/libraries/cookies.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/cookies.rst b/user_guide_src/source/libraries/cookies.rst index 40177800ecbb..cd2b5bd48695 100644 --- a/user_guide_src/source/libraries/cookies.rst +++ b/user_guide_src/source/libraries/cookies.rst @@ -26,7 +26,7 @@ cookie interaction. Creating Cookies **************** -There are currently four (4) ways to create a new ``Cookie`` value object. +There are currently four ways to create a new ``Cookie`` value object. .. literalinclude:: cookies/001.php @@ -110,7 +110,7 @@ using the ``__Host-`` prefix, cookies must exhibit the following: Validating the SameSite Attribute ================================= -The SameSite attribute only accepts three (3) values: +The SameSite attribute accepts three values: - **Lax**: Cookies are not sent on normal cross-site subrequests (for example to load images or frames into a third party site), but are sent when a user is navigating to the origin site (*i.e.* when following a link). - **Strict**: Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. @@ -167,7 +167,7 @@ instance can be accessed from the current ``Response`` object. Creating CookieStore ==================== -CodeIgniter provides three (3) other ways to create a new instance of the ``CookieStore``. +CodeIgniter provides three other ways to create a new instance of the ``CookieStore``. .. literalinclude:: cookies/008.php @@ -248,7 +248,7 @@ objects. However, you may wish to define your own settings by changing the follo ``Config\Cookie`` class in **app/Config/Cookie.php** file. ==================== ===================================== ========= ===================================================== -Setting Options/ Types Default Description +Setting Options/Types Default Description ==================== ===================================== ========= ===================================================== **$prefix** ``string`` ``''`` Prefix to prepend to the cookie name. **$expires** ``DateTimeInterface|string|int`` ``0`` The expires timestamp. @@ -256,7 +256,7 @@ Setting Options/ Types Default Description **$domain** ``string`` ``''`` The domain property of the cookie.with trailing slash. **$secure** ``true/false`` ``false`` If to be sent over secure HTTPS. **$httponly** ``true/false`` ``true`` If not accessible to JavaScript. -**$samesite** ``Lax|None|Strict|lax|none|strict''`` ``Lax`` The SameSite attribute. +**$samesite** ``Lax|None|Strict`` ``Lax`` The SameSite attribute. **$raw** ``true/false`` ``false`` If to be dispatched using ``setrawcookie()``. ==================== ===================================== ========= ===================================================== From 8ea603aeffc0aaa5cfde316874c378eecae9b081 Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 4 May 2024 13:47:04 +0200 Subject: [PATCH 086/220] docs: Samesite options typos user_guide_src/source/libraries/cookies.rst Samesite options typos user_guide_src/source/libraries/cookies.rst Co-authored-by: kenjis --- user_guide_src/source/libraries/cookies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/cookies.rst b/user_guide_src/source/libraries/cookies.rst index cd2b5bd48695..e05e3c15959f 100644 --- a/user_guide_src/source/libraries/cookies.rst +++ b/user_guide_src/source/libraries/cookies.rst @@ -256,7 +256,7 @@ Setting Options/Types Default Description **$domain** ``string`` ``''`` The domain property of the cookie.with trailing slash. **$secure** ``true/false`` ``false`` If to be sent over secure HTTPS. **$httponly** ``true/false`` ``true`` If not accessible to JavaScript. -**$samesite** ``Lax|None|Strict`` ``Lax`` The SameSite attribute. +**$samesite** ``Lax``/``None``/``Strict`` ``Lax`` The SameSite attribute. **$raw** ``true/false`` ``false`` If to be dispatched using ``setrawcookie()``. ==================== ===================================== ========= ===================================================== From ef98a198ec9b9dac619e21a0443ddd28c1aaaf2b Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 4 May 2024 13:47:43 +0200 Subject: [PATCH 087/220] docs: Cookie options typos user_guide_src/source/libraries/cookies.rst Cookie options typos user_guide_src/source/libraries/cookies.rst Co-authored-by: kenjis --- user_guide_src/source/libraries/cookies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/cookies.rst b/user_guide_src/source/libraries/cookies.rst index e05e3c15959f..6d4096799206 100644 --- a/user_guide_src/source/libraries/cookies.rst +++ b/user_guide_src/source/libraries/cookies.rst @@ -257,7 +257,7 @@ Setting Options/Types Default Description **$secure** ``true/false`` ``false`` If to be sent over secure HTTPS. **$httponly** ``true/false`` ``true`` If not accessible to JavaScript. **$samesite** ``Lax``/``None``/``Strict`` ``Lax`` The SameSite attribute. -**$raw** ``true/false`` ``false`` If to be dispatched using ``setrawcookie()``. +**$raw** ``true``/``false`` ``false`` If to be dispatched using ``setrawcookie()``. ==================== ===================================== ========= ===================================================== In runtime, you can manually supply a new default using the ``Cookie::setDefaults()`` method. From 091e15f5598282b5c84618e1b1638d6d28d6b6d5 Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 4 May 2024 13:48:07 +0200 Subject: [PATCH 088/220] docs: Cookie options typos user_guide_src/source/libraries/cookies.rst Cookie options typos user_guide_src/source/libraries/cookies.rst Co-authored-by: kenjis --- user_guide_src/source/libraries/cookies.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/cookies.rst b/user_guide_src/source/libraries/cookies.rst index 6d4096799206..c6ac80706829 100644 --- a/user_guide_src/source/libraries/cookies.rst +++ b/user_guide_src/source/libraries/cookies.rst @@ -254,8 +254,8 @@ Setting Options/Types Default Description **$expires** ``DateTimeInterface|string|int`` ``0`` The expires timestamp. **$path** ``string`` ``/`` The path property of the cookie. **$domain** ``string`` ``''`` The domain property of the cookie.with trailing slash. -**$secure** ``true/false`` ``false`` If to be sent over secure HTTPS. -**$httponly** ``true/false`` ``true`` If not accessible to JavaScript. +**$secure** ``true``/``false`` ``false`` If to be sent over secure HTTPS. +**$httponly** ``true``/``false`` ``true`` If not accessible to JavaScript. **$samesite** ``Lax``/``None``/``Strict`` ``Lax`` The SameSite attribute. **$raw** ``true``/``false`` ``false`` If to be dispatched using ``setrawcookie()``. ==================== ===================================== ========= ===================================================== From 20e8388f67d10019f000aa93ca02fa4a99bdc269 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 5 May 2024 11:18:07 +0900 Subject: [PATCH 089/220] docs: update contributing/pull_request.md --- contributing/pull_request.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 4b5b06406124..372cf8d6b0e0 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -2,25 +2,23 @@ ## Contributions -We expect all contributions to -- conform to our [style guide](./styleguide.md), -- be commented (inside the PHP source files), -- be documented (in the [user guide](https://codeigniter4.github.io/userguide/)), -- and unit tested (in the [test folder](https://github.com/codeigniter4/CodeIgniter4/tree/develop/tests)). +We expect the following in all pull requests. +- All git commits are [GPG-signed](#signing) +- Must follow our [style guide](#php-style) +- Be [commented](#comments) in the PHP source file +- Be documented in the [user guide](#user-guide) +- Be [unit tested](#unit-testing) +- Pass all checks in GitHub Actions > [!IMPORTANT] > We expect all code changes or bug-fixes to be accompanied by one or more tests > added to our test suite to prove the code works. -If pull requests are not accompanied by relevant tests, they will likely be closed. +If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work on the framework than you do. Please make it as painless for your contributions to be included as possible. -If you need help with getting tests running on your local machines, ask for help -on the [forum](https://forum.codeigniter.com/forumdisplay.php?fid=27). We would -be happy to help out. - The [Open Source Guide](https://opensource.guide/) is a good first read for those new to contributing to open source! @@ -67,13 +65,18 @@ composer cs If you are not familiar with Unit Testing, see [the forum thread](https://forum.codeigniter.com/showthread.php?tid=81830). +If you need help with getting tests running on your local machines, ask for help +on the [forum](https://forum.codeigniter.com/forumdisplay.php?fid=27). We would +be happy to help out. Unit testing is expected for all CodeIgniter components. We use PHPUnit, and run unit tests using GitHub Actions for each PR submitted or changed. -In the CodeIgniter project, there is a `tests` folder, with a structure +In the CodeIgniter project, there is a [tests][tests-folder] folder, with a structure that parallels that of `system`. +[tests-folder]: https://github.com/codeigniter4/CodeIgniter4/tree/develop/tests + The normal practice would be to have a unit test class for each of the classes in `system`, named appropriately. For instance, the `BananaTest` class would test the `Banana` class. There will be occasions when it is From 4a8866b6da96927da31d96da42457dcad38d5d8d Mon Sep 17 00:00:00 2001 From: obozdag Date: Sun, 5 May 2024 09:21:49 +0200 Subject: [PATCH 090/220] docs: Remove mistakenly changed sentence in libraries/caching.rst Remove mistakenly changed sentence in libraries/caching.rst --- user_guide_src/source/libraries/caching.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index 908e429d543d..f0a702ddc4fb 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -36,8 +36,7 @@ $handler ======== The is the name of the handler that should be used as the primary handler when starting up the engine. -Available names are: dummy, file, memcached, redis, predis, wincache. This is commonly the **File** handler -since the file system is always available, but may not fit more complex, multi-server setups. +Available names are: dummy, file, memcached, redis, predis, wincache. $backupHandler ============== From acf3e6ce4d15b413429e9ed4223aeb74fec0854f Mon Sep 17 00:00:00 2001 From: Sahil Khatik Date: Sun, 5 May 2024 13:03:00 +0530 Subject: [PATCH 091/220] Fix: Resolved phpstan error in Config/Filters.php --- phpstan-baseline.php | 11 ----------- system/Config/Filters.php | 2 ++ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 1959aea9685c..fc9b102f8b3f 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1,11 +1,5 @@ '#^PHPDoc type array\\\\> of property Config\\\\Filters\\:\\:\\$methods is not the same as PHPDoc type array of overridden property CodeIgniter\\\\Config\\\\Filters\\:\\:\\$methods\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Config/Filters.php', -]; $ignoreErrors[] = [ 'message' => '#^PHPDoc type array\\\\>\\> of property Config\\\\Filters\\:\\:\\$filters is not the same as PHPDoc type array of overridden property CodeIgniter\\\\Config\\\\Filters\\:\\:\\$filters\\.$#', 'count' => 1, @@ -1151,11 +1145,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Config/Filters.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Config\\\\Filters\\:\\:\\$methods type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/Filters.php', -]; $ignoreErrors[] = [ 'message' => '#^Accessing offset \'SERVER_PROTOCOL\' directly on \\$_SERVER is discouraged\\.$#', 'count' => 1, diff --git a/system/Config/Filters.php b/system/Config/Filters.php index 9096dc7ba03f..562eae8a26ef 100644 --- a/system/Config/Filters.php +++ b/system/Config/Filters.php @@ -102,6 +102,8 @@ class Filters extends BaseConfig * If you use this, you should disable auto-routing because auto-routing * permits any HTTP method to access a controller. Accessing the controller * with a method you don't expect could bypass the filter. + * + * @var array> */ public array $methods = []; From af8ad2963bbe663f9d7d02046c3cdee1382b5f4e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 5 May 2024 17:18:34 +0900 Subject: [PATCH 092/220] docs: add "PRs must be sent to the appropriate branch" --- contributing/pull_request.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 372cf8d6b0e0..426ca41a788e 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -2,7 +2,8 @@ ## Contributions -We expect the following in all pull requests. +We expect the following in all Pull Requests (PRs). +- PRs must be sent to the [appropriate branch](#branching) - All git commits are [GPG-signed](#signing) - Must follow our [style guide](#php-style) - Be [commented](#comments) in the PHP source file From b1a42f4ef2506233ca3ecec1b9cfe76a5f5f1eeb Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 5 May 2024 17:21:35 +0900 Subject: [PATCH 093/220] docs: replace "are" with "must be" --- contributing/pull_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 426ca41a788e..46a57e667aa9 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -4,7 +4,7 @@ We expect the following in all Pull Requests (PRs). - PRs must be sent to the [appropriate branch](#branching) -- All git commits are [GPG-signed](#signing) +- All git commits must be [GPG-signed](#signing) - Must follow our [style guide](#php-style) - Be [commented](#comments) in the PHP source file - Be documented in the [user guide](#user-guide) From 33edee13fe0eeb00707076e2f77d78847e7ae39e Mon Sep 17 00:00:00 2001 From: obozdag Date: Sun, 5 May 2024 10:22:07 +0200 Subject: [PATCH 094/220] docs: Updated File-based Caching in libraries/caching.rst Updated File-based Caching in libraries/caching.rst --- user_guide_src/source/libraries/caching.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index f0a702ddc4fb..647055749923 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -275,10 +275,10 @@ Drivers File-based Caching ================== -File-based caching allows for pieces of view files to be cached. Use this with care, and -make sure to benchmark your application, as a point can come where disk -I/O will negate positive gains by caching. This requires a cache -directory to be really writable by the application. +This requires a cache directory to be really writable by the application. + +Use this with care, and make sure to benchmark your application, as a point can +come where disk I/O will negate positive gains by caching. Memcached Caching ================= From 3da5bebb2c78adf3b5addc07f527f840c79063f5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 5 May 2024 17:22:43 +0900 Subject: [PATCH 095/220] docs: update sample branch name to `4.6` --- contributing/pull_request.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 46a57e667aa9..66bdd9151ccd 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -203,7 +203,7 @@ working on your contribution. All bug fixes should be sent to the __"develop"__ branch, this is where the next bug fix version will be developed. -PRs with any enhancement should be sent to next minor version branch, e.g. __"4.5"__ +PRs with any enhancement should be sent to next minor version branch, e.g. __"4.6"__ The __"master"__ branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g. an emergency security patch) can be applied to the @@ -304,7 +304,7 @@ GitHub means "making a copy of that repo to your account" and "cloning" means - If your PR is for bug fixes: - `> git switch develop` - `> git switch -c ` - - If your PR has any enhancement, create new branch from next minor version branch, e.g. __"4.5"__: + - If your PR has any enhancement, create new branch from next minor version branch, e.g. __"4.6"__: - `> git switch ` - `> git switch -c ` 7. Fix existing bugs on the [Issue tracker](https://github.com/codeigniter4/CodeIgniter4/issues) after confirming that no one From 88eebb5f035e7dead3b612d6e637a0068c9d08b9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 5 May 2024 17:53:09 +0900 Subject: [PATCH 096/220] fix: correct property default values Make them the same as in the Config\Email. --- system/Email/Email.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index a686ca0ca06e..b82779eb891d 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -151,7 +151,7 @@ class Email * * @var string */ - public $charset = 'utf-8'; + public $charset = 'UTF-8'; /** * Alternative message (for HTML messages only) @@ -182,7 +182,7 @@ class Email * * @var string "\r\n" or "\n" */ - public $newline = "\n"; + public $newline = "\r\n"; /** * CRLF character sequence @@ -197,7 +197,7 @@ class Email * * @var string */ - public $CRLF = "\n"; + public $CRLF = "\r\n"; /** * Whether to use Delivery Status Notification. From fe997e41040cc9bdd5a1e4f7199f8a6d7fda3d7b Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 23 Apr 2024 00:32:06 +0800 Subject: [PATCH 097/220] Enable `php_unit_attributes` --- .php-cs-fixer.dist.php | 3 +- .php-cs-fixer.no-header.php | 3 +- .php-cs-fixer.tests.php | 3 +- .php-cs-fixer.user-guide.php | 3 +- tests/system/API/ResponseTraitTest.php | 3 +- tests/system/AutoReview/ComposerJsonTest.php | 6 +- tests/system/AutoReview/FrameworkCodeTest.php | 6 +- tests/system/Autoloader/AutoloaderTest.php | 9 +- .../Autoloader/FileLocatorCachedTest.php | 3 +- tests/system/Autoloader/FileLocatorTest.php | 2 +- tests/system/CLI/CLITest.php | 6 +- tests/system/CLI/ConsoleTest.php | 3 +- tests/system/Cache/CacheFactoryTest.php | 3 +- tests/system/Cache/CacheMockTest.php | 3 +- .../Cache/FactoriesCacheFileHandlerTest.php | 3 +- ...FactoriesCacheFileVarExportHandlerTest.php | 3 +- .../system/Cache/Handlers/BaseHandlerTest.php | 6 +- .../Cache/Handlers/DummyHandlerTest.php | 3 +- .../system/Cache/Handlers/FileHandlerTest.php | 18 +- .../Cache/Handlers/MemcachedHandlerTest.php | 3 +- .../Cache/Handlers/PredisHandlerTest.php | 3 +- .../Cache/Handlers/RedisHandlerTest.php | 3 +- tests/system/Cache/ResponseCacheTest.php | 6 +- tests/system/CodeIgniterTest.php | 12 +- tests/system/Commands/BaseCommandTest.php | 3 +- tests/system/Commands/CellGeneratorTest.php | 3 +- tests/system/Commands/ClearCacheTest.php | 3 +- tests/system/Commands/ClearDebugbarTest.php | 3 +- tests/system/Commands/ClearLogsTest.php | 3 +- .../system/Commands/CommandGeneratorTest.php | 3 +- tests/system/Commands/CommandTest.php | 7 +- tests/system/Commands/ConfigGeneratorTest.php | 3 +- .../Commands/ConfigurableSortImportsTest.php | 3 +- .../Commands/ControllerGeneratorTest.php | 3 +- tests/system/Commands/CreateDatabaseTest.php | 3 +- .../Commands/Database/MigrateStatusTest.php | 3 +- .../Database/ShowTableInfoMockIOTest.php | 3 +- .../Commands/Database/ShowTableInfoTest.php | 3 +- .../system/Commands/DatabaseCommandsTest.php | 3 +- tests/system/Commands/EntityGeneratorTest.php | 3 +- .../Commands/EnvironmentCommandTest.php | 3 +- tests/system/Commands/FilterCheckTest.php | 3 +- tests/system/Commands/FilterGeneratorTest.php | 3 +- tests/system/Commands/GenerateKeyTest.php | 9 +- tests/system/Commands/GeneratorsTest.php | 3 +- tests/system/Commands/HelpCommandTest.php | 3 +- tests/system/Commands/InfoCacheTest.php | 3 +- .../Commands/MigrationGeneratorTest.php | 3 +- .../Commands/MigrationIntegrationTest.php | 3 +- tests/system/Commands/ModelGeneratorTest.php | 3 +- tests/system/Commands/PublishCommandTest.php | 3 +- tests/system/Commands/RoutesTest.php | 3 +- .../system/Commands/ScaffoldGeneratorTest.php | 3 +- tests/system/Commands/SeederGeneratorTest.php | 3 +- tests/system/Commands/TestGeneratorTest.php | 3 +- .../Translation/LocalizationFinderTest.php | 3 +- .../Commands/Utilities/ConfigCheckTest.php | 3 +- .../Commands/Utilities/NamespacesTest.php | 3 +- .../Routes/AutoRouteCollectorTest.php | 3 +- .../AutoRouteCollectorTest.php | 3 +- .../ControllerMethodReaderTest.php | 3 +- .../Utilities/Routes/ControllerFinderTest.php | 3 +- .../Routes/ControllerMethodReaderTest.php | 3 +- .../Utilities/Routes/FilterCollectorTest.php | 3 +- .../Utilities/Routes/FilterFinderTest.php | 3 +- .../Routes/SampleURIGeneratorTest.php | 7 +- .../Commands/ValidationGeneratorTest.php | 3 +- tests/system/CommonFunctionsSendTest.php | 8 +- tests/system/CommonFunctionsTest.php | 62 ++---- tests/system/CommonHelperTest.php | 6 +- tests/system/CommonSingleServiceTest.php | 11 +- tests/system/Config/BaseConfigTest.php | 21 +- tests/system/Config/DotEnvTest.php | 22 +- tests/system/Config/FactoriesTest.php | 11 +- tests/system/Config/MimesTest.php | 11 +- tests/system/Config/ServicesTest.php | 45 ++--- tests/system/ControllerTest.php | 6 +- tests/system/Cookie/CookieStoreTest.php | 3 +- tests/system/Cookie/CookieTest.php | 14 +- .../DataConverter/DataConverterTest.php | 11 +- tests/system/Database/BaseConnectionTest.php | 13 +- tests/system/Database/BaseQueryTest.php | 9 +- tests/system/Database/Builder/AliasTest.php | 3 +- tests/system/Database/Builder/BaseTest.php | 3 +- tests/system/Database/Builder/CountTest.php | 3 +- tests/system/Database/Builder/DeleteTest.php | 3 +- .../system/Database/Builder/DistinctTest.php | 3 +- tests/system/Database/Builder/EmptyTest.php | 3 +- tests/system/Database/Builder/FromTest.php | 3 +- tests/system/Database/Builder/GetTest.php | 3 +- tests/system/Database/Builder/GroupTest.php | 3 +- tests/system/Database/Builder/InsertTest.php | 3 +- tests/system/Database/Builder/JoinTest.php | 3 +- tests/system/Database/Builder/LikeTest.php | 3 +- tests/system/Database/Builder/LimitTest.php | 3 +- tests/system/Database/Builder/OrderTest.php | 3 +- tests/system/Database/Builder/PrefixTest.php | 3 +- tests/system/Database/Builder/ReplaceTest.php | 3 +- tests/system/Database/Builder/SelectTest.php | 3 +- .../system/Database/Builder/TruncateTest.php | 3 +- tests/system/Database/Builder/UnionTest.php | 3 +- tests/system/Database/Builder/UpdateTest.php | 3 +- tests/system/Database/Builder/WhenTest.php | 3 +- tests/system/Database/Builder/WhereTest.php | 9 +- tests/system/Database/ConfigTest.php | 6 +- tests/system/Database/DatabaseSeederTest.php | 3 +- .../DatabaseTestCaseMigrationOnce1Test.php | 3 +- .../DatabaseTestCaseMigrationOnce2Test.php | 3 +- .../system/Database/DatabaseTestCaseTest.php | 3 +- .../system/Database/Forge/CreateTableTest.php | 3 +- .../Database/Forge/DropForeignKeyTest.php | 3 +- tests/system/Database/Live/AliasTest.php | 3 +- tests/system/Database/Live/BadQueryTest.php | 3 +- tests/system/Database/Live/ConnectTest.php | 3 +- tests/system/Database/Live/CountTest.php | 3 +- .../Live/DatabaseTestTraitCaseTest.php | 3 +- tests/system/Database/Live/DbDebugTest.php | 3 +- tests/system/Database/Live/DbUtilsTest.php | 3 +- tests/system/Database/Live/DeleteTest.php | 3 +- tests/system/Database/Live/EmptyTest.php | 3 +- tests/system/Database/Live/EscapeTest.php | 3 +- .../Database/Live/FabricatorLiveTest.php | 3 +- tests/system/Database/Live/ForgeTest.php | 3 +- tests/system/Database/Live/FromTest.php | 3 +- tests/system/Database/Live/GetNumRowsTest.php | 3 +- tests/system/Database/Live/GetTest.php | 3 +- tests/system/Database/Live/GetVersionTest.php | 3 +- tests/system/Database/Live/GroupTest.php | 3 +- tests/system/Database/Live/IncrementTest.php | 3 +- tests/system/Database/Live/InsertTest.php | 3 +- tests/system/Database/Live/JoinTest.php | 3 +- tests/system/Database/Live/LikeTest.php | 3 +- tests/system/Database/Live/LimitTest.php | 3 +- tests/system/Database/Live/MetadataTest.php | 3 +- .../Live/MySQLi/GetFieldDataTestCase.php | 3 +- .../Database/Live/MySQLi/NumberNativeTest.php | 3 +- .../Database/Live/MySQLi/RawSqlTest.php | 3 +- .../Live/OCI8/CallStoredProcedureTest.php | 3 +- .../Live/OCI8/GetFieldDataTestCase.php | 3 +- .../Database/Live/OCI8/LastInsertIDTest.php | 3 +- tests/system/Database/Live/OrderTest.php | 3 +- .../Live/Postgre/GetFieldDataTestCase.php | 3 +- .../Database/Live/PreparedQueryTest.php | 3 +- tests/system/Database/Live/PretendTest.php | 3 +- .../Live/SQLSRV/GetFieldDataTestCase.php | 3 +- .../Database/Live/SQLite3/AlterTableTest.php | 6 +- .../Live/SQLite3/ForgeModifyColumnTest.php | 3 +- .../Live/SQLite3/GetFieldDataTestCase.php | 3 +- .../Live/SQLite3/GetIndexDataTest.php | 3 +- tests/system/Database/Live/SelectTest.php | 3 +- .../Live/TransactionDBDebugFalseTest.php | 3 +- .../Live/TransactionDBDebugTrueTest.php | 3 +- .../system/Database/Live/TransactionTest.php | 3 +- tests/system/Database/Live/UnionTest.php | 3 +- tests/system/Database/Live/UpdateTest.php | 7 +- tests/system/Database/Live/UpsertTest.php | 3 +- tests/system/Database/Live/WhereTest.php | 3 +- .../Database/Live/WriteTypeQueryTest.php | 3 +- .../Migrations/MigrationRunnerTest.php | 3 +- .../Database/Migrations/MigrationTest.php | 3 +- tests/system/Database/RawSqlTest.php | 3 +- tests/system/Debug/ExceptionHandlerTest.php | 3 +- tests/system/Debug/ExceptionsTest.php | 7 +- tests/system/Debug/TimerTest.php | 3 +- .../Debug/Toolbar/Collectors/DatabaseTest.php | 3 +- .../Debug/Toolbar/Collectors/HistoryTest.php | 3 +- tests/system/DebugTraceableTraitTest.php | 6 +- tests/system/Email/EmailTest.php | 6 +- tests/system/Encryption/EncryptionTest.php | 3 +- .../Handlers/OpenSSLHandlerTest.php | 3 +- .../Encryption/Handlers/SodiumHandlerTest.php | 3 +- tests/system/Entity/EntityTest.php | 3 +- tests/system/Events/EventsTest.php | 9 +- tests/system/Files/FileCollectionTest.php | 3 +- tests/system/Files/FileTest.php | 3 +- tests/system/Files/FileWithVfsTest.php | 3 +- tests/system/Filters/CSRFTest.php | 6 +- tests/system/Filters/CorsTest.php | 3 +- tests/system/Filters/DebugToolbarTest.php | 6 +- tests/system/Filters/FiltersTest.php | 12 +- tests/system/Filters/HoneypotTest.php | 18 +- tests/system/Filters/InvalidCharsTest.php | 22 +- tests/system/Filters/SecureHeadersTest.php | 3 +- tests/system/Format/FormatTest.php | 3 +- tests/system/Format/JSONFormatterTest.php | 3 +- tests/system/Format/XMLFormatterTest.php | 7 +- tests/system/HTTP/CLIRequestTest.php | 6 +- .../HTTP/CURLRequestShareOptionsTest.php | 3 +- tests/system/HTTP/CURLRequestTest.php | 11 +- .../system/HTTP/ContentSecurityPolicyTest.php | 189 ++++++------------ tests/system/HTTP/CorsTest.php | 3 +- tests/system/HTTP/DownloadResponseTest.php | 9 +- .../system/HTTP/Files/FileCollectionTest.php | 3 +- tests/system/HTTP/Files/FileMovingTest.php | 3 +- tests/system/HTTP/HeaderTest.php | 3 +- .../HTTP/IncomingRequestDetectingTest.php | 6 +- tests/system/HTTP/IncomingRequestTest.php | 25 +-- tests/system/HTTP/MessageTest.php | 9 +- tests/system/HTTP/NegotiateTest.php | 3 +- tests/system/HTTP/OutgoingRequestTest.php | 3 +- tests/system/HTTP/RedirectExceptionTest.php | 3 +- tests/system/HTTP/RedirectResponseTest.php | 44 ++-- tests/system/HTTP/RequestTest.php | 6 +- tests/system/HTTP/ResponseCookieTest.php | 3 +- tests/system/HTTP/ResponseSendTest.php | 20 +- tests/system/HTTP/ResponseTest.php | 11 +- .../SiteURIFactoryDetectRoutePathTest.php | 9 +- tests/system/HTTP/SiteURIFactoryTest.php | 14 +- tests/system/HTTP/SiteURITest.php | 14 +- tests/system/HTTP/URITest.php | 32 +-- tests/system/HTTP/UserAgentTest.php | 3 +- .../Array/ArrayHelperDotKeyExistsTest.php | 3 +- .../Array/ArrayHelperRecursiveDiffTest.php | 3 +- .../ArrayHelperSortValuesByNaturalTest.php | 3 +- tests/system/Helpers/ArrayHelperTest.php | 33 +-- tests/system/Helpers/CookieHelperTest.php | 3 +- tests/system/Helpers/DateHelperTest.php | 3 +- tests/system/Helpers/FilesystemHelperTest.php | 3 +- tests/system/Helpers/FormHelperTest.php | 21 +- tests/system/Helpers/HTMLHelperTest.php | 3 +- tests/system/Helpers/InflectorHelperTest.php | 7 +- tests/system/Helpers/NumberHelperTest.php | 3 +- tests/system/Helpers/SecurityHelperTest.php | 3 +- tests/system/Helpers/TextHelperTest.php | 3 +- .../Helpers/URLHelper/CurrentUrlTest.php | 18 +- .../system/Helpers/URLHelper/MiscUrlTest.php | 69 ++----- .../Helpers/URLHelper/SiteUrlCliTest.php | 9 +- .../system/Helpers/URLHelper/SiteUrlTest.php | 9 +- tests/system/Helpers/XMLHelperTest.php | 3 +- tests/system/HomeTest.php | 3 +- tests/system/Honeypot/HoneypotTest.php | 6 +- .../HotReloader/DirectoryHasherTest.php | 3 +- tests/system/I18n/TimeDifferenceTest.php | 3 +- tests/system/I18n/TimeLegacyTest.php | 7 +- tests/system/I18n/TimeTest.php | 7 +- tests/system/Images/BaseHandlerTest.php | 3 +- tests/system/Images/GDHandlerTest.php | 3 +- .../system/Images/ImageMagickHandlerTest.php | 10 +- tests/system/Images/ImageTest.php | 3 +- tests/system/Language/LanguageTest.php | 6 +- .../Log/Handlers/ChromeLoggerHandlerTest.php | 3 +- .../Log/Handlers/ErrorlogHandlerTest.php | 3 +- tests/system/Log/Handlers/FileHandlerTest.php | 3 +- tests/system/Log/LoggerTest.php | 3 +- tests/system/Models/AffectedRowsTest.php | 3 +- tests/system/Models/CountAllModelTest.php | 3 +- .../system/Models/DataConverterModelTest.php | 3 +- tests/system/Models/DeleteModelTest.php | 18 +- tests/system/Models/EventsModelTest.php | 3 +- tests/system/Models/FindModelTest.php | 12 +- tests/system/Models/GeneralModelTest.php | 3 +- tests/system/Models/GetCompiledModelTest.php | 3 +- tests/system/Models/InsertModelTest.php | 3 +- .../system/Models/MiscellaneousModelTest.php | 3 +- tests/system/Models/PaginateModelTest.php | 3 +- tests/system/Models/ReplaceModelTest.php | 3 +- tests/system/Models/SaveModelTest.php | 3 +- tests/system/Models/TimestampModelTest.php | 3 +- tests/system/Models/UpdateModelTest.php | 6 +- .../Models/ValidationModelRuleGroupTest.php | 3 +- tests/system/Models/ValidationModelTest.php | 3 +- tests/system/Models/WhenWhenNotModelTest.php | 3 +- tests/system/Pager/PagerRendererTest.php | 3 +- tests/system/Pager/PagerTest.php | 6 +- .../system/Publisher/ContentReplacerTest.php | 3 +- .../Publisher/PublisherContentReplaceTest.php | 3 +- tests/system/Publisher/PublisherInputTest.php | 3 +- .../system/Publisher/PublisherOutputTest.php | 3 +- .../Publisher/PublisherRestrictionsTest.php | 11 +- .../system/Publisher/PublisherSupportTest.php | 3 +- .../system/RESTful/ResourceControllerTest.php | 9 +- .../system/RESTful/ResourcePresenterTest.php | 9 +- .../system/Router/AutoRouterImprovedTest.php | 11 +- .../Router/DefinedRouteCollectorTest.php | 3 +- .../RouteCollectionReverseRouteTest.php | 7 +- tests/system/Router/RouteCollectionTest.php | 17 +- tests/system/Router/RouterTest.php | 7 +- tests/system/Security/CheckPhpIniTest.php | 3 +- .../SecurityCSRFCookieRandomizeTokenTest.php | 3 +- .../SecurityCSRFSessionRandomizeTokenTest.php | 9 +- .../Security/SecurityCSRFSessionTest.php | 9 +- tests/system/Security/SecurityTest.php | 6 +- .../Handlers/Database/MySQLiHandlerTest.php | 3 +- .../Handlers/Database/PostgreHandlerTest.php | 3 +- .../Handlers/Database/RedisHandlerTest.php | 10 +- tests/system/Session/SessionTest.php | 9 +- tests/system/SparkTest.php | 3 +- tests/system/SuperglobalsTest.php | 3 +- tests/system/Test/BootstrapFCPATHTest.php | 3 +- tests/system/Test/ControllerTestTraitTest.php | 9 +- tests/system/Test/DOMParserTest.php | 9 +- tests/system/Test/FabricatorTest.php | 3 +- .../FeatureTestAutoRoutingImprovedTest.php | 3 +- tests/system/Test/FeatureTestTraitTest.php | 6 +- tests/system/Test/FilterTestTraitTest.php | 3 +- tests/system/Test/IniTestTraitTest.php | 3 +- tests/system/Test/ReflectionHelperTest.php | 3 +- tests/system/Test/TestCaseEmissionsTest.php | 16 +- tests/system/Test/TestCaseTest.php | 3 +- tests/system/Test/TestLoggerTest.php | 7 +- tests/system/Test/TestResponseTest.php | 11 +- tests/system/Throttle/ThrottleTest.php | 7 +- tests/system/Typography/TypographyTest.php | 3 +- .../system/Validation/CreditCardRulesTest.php | 7 +- .../Validation/DatabaseRelatedRulesTest.php | 3 +- .../system/Validation/DotArrayFilterTest.php | 3 +- tests/system/Validation/FileRulesTest.php | 3 +- tests/system/Validation/FormatRulesTest.php | 96 +++------ tests/system/Validation/RulesTest.php | 97 +++------ .../StrictRules/CreditCardRulesTest.php | 7 +- .../StrictRules/DatabaseRelatedRulesTest.php | 3 +- .../Validation/StrictRules/FileRulesTest.php | 3 +- .../StrictRules/FormatRulesTest.php | 3 +- .../Validation/StrictRules/RulesTest.php | 27 +-- .../Validation/StrictRules/ValidationTest.php | 3 +- tests/system/Validation/ValidationTest.php | 28 +-- tests/system/View/CellTest.php | 3 +- tests/system/View/ControlledCellTest.php | 3 +- tests/system/View/DecoratorsTest.php | 3 +- tests/system/View/ParserFilterTest.php | 3 +- tests/system/View/ParserPluginTest.php | 12 +- tests/system/View/ParserTest.php | 6 +- tests/system/View/TableTest.php | 19 +- tests/system/View/ViewTest.php | 3 +- 324 files changed, 724 insertions(+), 1549 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 521cddf17deb..478b266693e8 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -43,7 +43,8 @@ $overrides = [ // for updating to coding-standard - 'modernize_strpos' => true, + 'modernize_strpos' => true, + 'php_unit_attributes' => true, ]; $options = [ diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 57b93738a859..f46f526120e0 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -31,7 +31,8 @@ $overrides = [ // for updating to coding-standard - 'modernize_strpos' => true, + 'modernize_strpos' => true, + 'php_unit_attributes' => true, ]; $options = [ diff --git a/.php-cs-fixer.tests.php b/.php-cs-fixer.tests.php index 386ebd5a7a82..404959f26fce 100644 --- a/.php-cs-fixer.tests.php +++ b/.php-cs-fixer.tests.php @@ -36,7 +36,8 @@ $overrides = [ 'void_return' => true, // for updating to coding-standard - 'modernize_strpos' => true, + 'modernize_strpos' => true, + 'php_unit_attributes' => true, ]; $options = [ diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index 9fb1ec265e19..5356cef28d93 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -40,7 +40,8 @@ 'leading_backslash_in_global_namespace' => true, ], // for updating to coding-standard - 'modernize_strpos' => true, + 'modernize_strpos' => true, + 'php_unit_attributes' => true, ]; $options = [ diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index b54f3037b247..357acf1ad0ef 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -28,9 +28,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ResponseTraitTest extends CIUnitTestCase { private ?MockIncomingRequest $request = null; diff --git a/tests/system/AutoReview/ComposerJsonTest.php b/tests/system/AutoReview/ComposerJsonTest.php index 8a2277ec8931..83f49e499beb 100644 --- a/tests/system/AutoReview/ComposerJsonTest.php +++ b/tests/system/AutoReview/ComposerJsonTest.php @@ -19,11 +19,9 @@ /** * @internal - * - * @coversNothing - * - * @group AutoReview */ +#[\PHPUnit\Framework\Attributes\CoversNothing] +#[\PHPUnit\Framework\Attributes\Group('AutoReview')] final class ComposerJsonTest extends TestCase { private array $devComposer; diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index bb50b8d5f185..346be42e736e 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group AutoReview */ +#[\PHPUnit\Framework\Attributes\Group('AutoReview')] final class FrameworkCodeTest extends TestCase { /** @@ -41,10 +40,9 @@ final class FrameworkCodeTest extends TestCase ]; /** - * @dataProvider provideEachTestClassHasCorrectGroupAnnotation - * * @param class-string $class */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideEachTestClassHasCorrectGroupAnnotation')] public function testEachTestClassHasCorrectGroupAnnotation(string $class): void { $reflection = new ReflectionClass($class); diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index b0e7852c2910..08432101eb3b 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -27,9 +27,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class AutoloaderTest extends CIUnitTestCase { use ReflectionHelper; @@ -390,10 +389,8 @@ public function testAutoloaderLoadsNonClassFiles(): void $loader->unregister(); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testLoadHelpers(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/Autoloader/FileLocatorCachedTest.php b/tests/system/Autoloader/FileLocatorCachedTest.php index a10f1f30781b..5348207f9aa7 100644 --- a/tests/system/Autoloader/FileLocatorCachedTest.php +++ b/tests/system/Autoloader/FileLocatorCachedTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileLocatorCachedTest extends FileLocatorTest { private FileVarExportHandler $handler; diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index 869c6b36090a..38d2eb98f751 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -21,9 +21,9 @@ /** * @internal * - * @group Others * @no-final */ +#[\PHPUnit\Framework\Attributes\Group('Others')] class FileLocatorTest extends CIUnitTestCase { protected FileLocatorInterface $locator; diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index f0dadef1763d..062ffda752da 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CLITest extends CIUnitTestCase { use StreamFilterTrait; @@ -452,12 +451,11 @@ public function testWindow(): void } /** - * @dataProvider provideTable - * * @param array $tbody * @param array $thead * @param array $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideTable')] public function testTable($tbody, $thead, $expected): void { CLI::table($tbody, $thead); diff --git a/tests/system/CLI/ConsoleTest.php b/tests/system/CLI/ConsoleTest.php index 54f0ff4a6813..b0100693344c 100644 --- a/tests/system/CLI/ConsoleTest.php +++ b/tests/system/CLI/ConsoleTest.php @@ -23,9 +23,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ConsoleTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Cache/CacheFactoryTest.php b/tests/system/Cache/CacheFactoryTest.php index b358a1eb1eb7..4694dd98fb20 100644 --- a/tests/system/Cache/CacheFactoryTest.php +++ b/tests/system/Cache/CacheFactoryTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CacheFactoryTest extends CIUnitTestCase { private static string $directory = 'CacheFactory'; diff --git a/tests/system/Cache/CacheMockTest.php b/tests/system/Cache/CacheMockTest.php index 451f7fe7c459..4275bc16bffd 100644 --- a/tests/system/Cache/CacheMockTest.php +++ b/tests/system/Cache/CacheMockTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CacheMockTest extends CIUnitTestCase { public function testMockReturnsMockCacheClass(): void diff --git a/tests/system/Cache/FactoriesCacheFileHandlerTest.php b/tests/system/Cache/FactoriesCacheFileHandlerTest.php index eea51d1f87f9..9cd3e1f182e6 100644 --- a/tests/system/Cache/FactoriesCacheFileHandlerTest.php +++ b/tests/system/Cache/FactoriesCacheFileHandlerTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FactoriesCacheFileHandlerTest extends FactoriesCacheFileVarExportHandlerTest { /** diff --git a/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php b/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php index 1566862c2ff9..0d1fe0b4446b 100644 --- a/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php +++ b/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php @@ -21,9 +21,8 @@ /** * @internal * @no-final - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] class FactoriesCacheFileVarExportHandlerTest extends CIUnitTestCase { protected FactoriesCache $cache; diff --git a/tests/system/Cache/Handlers/BaseHandlerTest.php b/tests/system/Cache/Handlers/BaseHandlerTest.php index 49462ffbe04e..02e6c9907c1b 100644 --- a/tests/system/Cache/Handlers/BaseHandlerTest.php +++ b/tests/system/Cache/Handlers/BaseHandlerTest.php @@ -19,16 +19,14 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class BaseHandlerTest extends CIUnitTestCase { /** - * @dataProvider provideValidateKeyInvalidType - * * @param mixed $input */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidateKeyInvalidType')] public function testValidateKeyInvalidType($input): void { $this->expectException('InvalidArgumentException'); diff --git a/tests/system/Cache/Handlers/DummyHandlerTest.php b/tests/system/Cache/Handlers/DummyHandlerTest.php index c30c99da733e..363882bfb818 100644 --- a/tests/system/Cache/Handlers/DummyHandlerTest.php +++ b/tests/system/Cache/Handlers/DummyHandlerTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DummyHandlerTest extends CIUnitTestCase { private DummyHandler $handler; diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index 67aa170c75f5..927c2a912fc3 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileHandlerTest extends AbstractHandlerTestCase { private static string $directory = 'FileHandler'; @@ -86,9 +85,8 @@ public function testNew(): void /** * chmod('path', 0444) does not work on Windows - * - * @requires OS Linux|Darwin */ + #[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux|Darwin')] public function testNewWithNonWritablePath(): void { $this->expectException(CacheException::class); @@ -145,9 +143,8 @@ public function testRemember(): void /** * chmod('path', 0444) does not work on Windows - * - * @requires OS Linux|Darwin */ + #[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux|Darwin')] public function testSave(): void { $this->assertTrue($this->handler->save(self::$key1, 'value')); @@ -309,13 +306,8 @@ public function testIsSupported(): void $this->assertTrue($this->handler->isSupported()); } - /** - * @dataProvider provideSaveMode - * - * permissions given on Windows are fixed to `0666` - * - * @requires OS Linux|Darwin - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSaveMode')] + #[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux|Darwin')] public function testSaveMode(int $int, string $string): void { // Initialize mode diff --git a/tests/system/Cache/Handlers/MemcachedHandlerTest.php b/tests/system/Cache/Handlers/MemcachedHandlerTest.php index 06ee0c567239..a5aca356aa90 100644 --- a/tests/system/Cache/Handlers/MemcachedHandlerTest.php +++ b/tests/system/Cache/Handlers/MemcachedHandlerTest.php @@ -19,10 +19,9 @@ use Exception; /** - * @group CacheLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('CacheLive')] 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 59e68346517b..209c7ea45509 100644 --- a/tests/system/Cache/Handlers/PredisHandlerTest.php +++ b/tests/system/Cache/Handlers/PredisHandlerTest.php @@ -18,10 +18,9 @@ use Config\Cache; /** - * @group CacheLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('CacheLive')] 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 c8182111971a..39e194a82bf1 100644 --- a/tests/system/Cache/Handlers/RedisHandlerTest.php +++ b/tests/system/Cache/Handlers/RedisHandlerTest.php @@ -18,10 +18,9 @@ use Config\Cache; /** - * @group CacheLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('CacheLive')] final class RedisHandlerTest extends AbstractHandlerTestCase { private Cache $config; diff --git a/tests/system/Cache/ResponseCacheTest.php b/tests/system/Cache/ResponseCacheTest.php index 059ad7d8f905..5acdc756d24b 100644 --- a/tests/system/Cache/ResponseCacheTest.php +++ b/tests/system/Cache/ResponseCacheTest.php @@ -26,12 +26,10 @@ use Exception; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ResponseCacheTest extends CIUnitTestCase { private AppConfig $appConfig; diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index fadfe365307a..f0680cec2a85 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -34,14 +34,11 @@ use Tests\Support\Filters\RedirectFilter; /** - * @runTestsInSeparateProcesses - * - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CodeIgniterTest extends CIUnitTestCase { private CodeIgniter $codeigniter; @@ -839,10 +836,9 @@ public function testPageCacheSendSecureHeaders(): void /** * @param array|bool $cacheQueryStringValue * - * @dataProvider providePageCacheWithCacheQueryString - * * @see https://github.com/codeigniter4/CodeIgniter4/pull/6410 */ + #[\PHPUnit\Framework\Attributes\DataProvider('providePageCacheWithCacheQueryString')] public function testPageCacheWithCacheQueryString( $cacheQueryStringValue, int $expectedPagesInCache, diff --git a/tests/system/Commands/BaseCommandTest.php b/tests/system/Commands/BaseCommandTest.php index 7c5aba288db5..2ca2138a6b9a 100644 --- a/tests/system/Commands/BaseCommandTest.php +++ b/tests/system/Commands/BaseCommandTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class BaseCommandTest extends CIUnitTestCase { private Logger $logger; diff --git a/tests/system/Commands/CellGeneratorTest.php b/tests/system/Commands/CellGeneratorTest.php index 84c7a0243be7..e13fa624f5c2 100644 --- a/tests/system/Commands/CellGeneratorTest.php +++ b/tests/system/Commands/CellGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CellGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ClearCacheTest.php b/tests/system/Commands/ClearCacheTest.php index 7e669cc9c851..0f68a8229a6b 100644 --- a/tests/system/Commands/ClearCacheTest.php +++ b/tests/system/Commands/ClearCacheTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ClearCacheTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ClearDebugbarTest.php b/tests/system/Commands/ClearDebugbarTest.php index 1e86406f7054..6c17d5c28a3c 100644 --- a/tests/system/Commands/ClearDebugbarTest.php +++ b/tests/system/Commands/ClearDebugbarTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ClearDebugbarTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ClearLogsTest.php b/tests/system/Commands/ClearLogsTest.php index afdd7a56541c..247b3fe1f6f3 100644 --- a/tests/system/Commands/ClearLogsTest.php +++ b/tests/system/Commands/ClearLogsTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ClearLogsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/CommandGeneratorTest.php b/tests/system/Commands/CommandGeneratorTest.php index a661f4a7783b..0efb8b80352f 100644 --- a/tests/system/Commands/CommandGeneratorTest.php +++ b/tests/system/Commands/CommandGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CommandGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index 3a0c0adfbd7d..02bcd465c542 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CommandTest extends CIUnitTestCase { use StreamFilterTrait; @@ -129,9 +128,7 @@ public function testInexistentCommandsButWithManyAlternatives(): void $this->assertStringContainsString(':clear', $this->getBuffer()); } - /** - * @dataProvider provideCommandParsesArgsCorrectly - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideCommandParsesArgsCorrectly')] public function testCommandParsesArgsCorrectly(string $input, array $expected): void { ParamsReveal::$args = null; diff --git a/tests/system/Commands/ConfigGeneratorTest.php b/tests/system/Commands/ConfigGeneratorTest.php index c4e9f644a71f..145b7e7af1cc 100644 --- a/tests/system/Commands/ConfigGeneratorTest.php +++ b/tests/system/Commands/ConfigGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ConfigGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ConfigurableSortImportsTest.php b/tests/system/Commands/ConfigurableSortImportsTest.php index 3fbec68b0c89..23b6b6424732 100644 --- a/tests/system/Commands/ConfigurableSortImportsTest.php +++ b/tests/system/Commands/ConfigurableSortImportsTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ConfigurableSortImportsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ControllerGeneratorTest.php b/tests/system/Commands/ControllerGeneratorTest.php index e13c8aec839e..5e86a0bbb337 100644 --- a/tests/system/Commands/ControllerGeneratorTest.php +++ b/tests/system/Commands/ControllerGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ControllerGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/CreateDatabaseTest.php b/tests/system/Commands/CreateDatabaseTest.php index 790b0c6c57b0..8bc4489533e9 100644 --- a/tests/system/Commands/CreateDatabaseTest.php +++ b/tests/system/Commands/CreateDatabaseTest.php @@ -22,10 +22,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class CreateDatabaseTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Database/MigrateStatusTest.php b/tests/system/Commands/Database/MigrateStatusTest.php index 33b7edde379d..9fc3cd370b6b 100644 --- a/tests/system/Commands/Database/MigrateStatusTest.php +++ b/tests/system/Commands/Database/MigrateStatusTest.php @@ -19,10 +19,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class MigrateStatusTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Database/ShowTableInfoMockIOTest.php b/tests/system/Commands/Database/ShowTableInfoMockIOTest.php index f6f66bc223b4..44130bd6b6d4 100644 --- a/tests/system/Commands/Database/ShowTableInfoMockIOTest.php +++ b/tests/system/Commands/Database/ShowTableInfoMockIOTest.php @@ -19,10 +19,9 @@ use CodeIgniter\Test\Mock\MockInputOutput; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ShowTableInfoMockIOTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Commands/Database/ShowTableInfoTest.php b/tests/system/Commands/Database/ShowTableInfoTest.php index 79972377f1e6..97dbc26b5bf5 100644 --- a/tests/system/Commands/Database/ShowTableInfoTest.php +++ b/tests/system/Commands/Database/ShowTableInfoTest.php @@ -21,10 +21,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ShowTableInfoTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Commands/DatabaseCommandsTest.php b/tests/system/Commands/DatabaseCommandsTest.php index 8a28ebf5fe86..5df1e5ba761d 100644 --- a/tests/system/Commands/DatabaseCommandsTest.php +++ b/tests/system/Commands/DatabaseCommandsTest.php @@ -17,10 +17,9 @@ use CodeIgniter\Test\StreamFilterTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DatabaseCommandsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/EntityGeneratorTest.php b/tests/system/Commands/EntityGeneratorTest.php index fd84207f8f14..b5c35c809adb 100644 --- a/tests/system/Commands/EntityGeneratorTest.php +++ b/tests/system/Commands/EntityGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class EntityGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/EnvironmentCommandTest.php b/tests/system/Commands/EnvironmentCommandTest.php index d087fdda64f1..54a6fe2fae00 100644 --- a/tests/system/Commands/EnvironmentCommandTest.php +++ b/tests/system/Commands/EnvironmentCommandTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class EnvironmentCommandTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/FilterCheckTest.php b/tests/system/Commands/FilterCheckTest.php index de543936293b..52bf0edae044 100644 --- a/tests/system/Commands/FilterCheckTest.php +++ b/tests/system/Commands/FilterCheckTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FilterCheckTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/FilterGeneratorTest.php b/tests/system/Commands/FilterGeneratorTest.php index fbb911ab2624..80a7bbb6a981 100644 --- a/tests/system/Commands/FilterGeneratorTest.php +++ b/tests/system/Commands/FilterGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FilterGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php index 80d0879bc958..42d27c7604c9 100644 --- a/tests/system/Commands/GenerateKeyTest.php +++ b/tests/system/Commands/GenerateKeyTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class GenerateKeyTest extends CIUnitTestCase { use StreamFilterTrait; @@ -86,10 +85,8 @@ public function testGenerateKeyShowsEncodedKey(): void $this->assertStringContainsString('hex2bin:', $this->getBuffer()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testGenerateKeyCreatesNewKey(): void { command('key:generate'); diff --git a/tests/system/Commands/GeneratorsTest.php b/tests/system/Commands/GeneratorsTest.php index 3f4bffb95a77..5677c5daba73 100644 --- a/tests/system/Commands/GeneratorsTest.php +++ b/tests/system/Commands/GeneratorsTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class GeneratorsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/HelpCommandTest.php b/tests/system/Commands/HelpCommandTest.php index 91832e44e7b2..3370f14f0f92 100644 --- a/tests/system/Commands/HelpCommandTest.php +++ b/tests/system/Commands/HelpCommandTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class HelpCommandTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/InfoCacheTest.php b/tests/system/Commands/InfoCacheTest.php index f587f63ffeb1..c894d0ce24e0 100644 --- a/tests/system/Commands/InfoCacheTest.php +++ b/tests/system/Commands/InfoCacheTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class InfoCacheTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/MigrationGeneratorTest.php b/tests/system/Commands/MigrationGeneratorTest.php index 148faed28d1e..302fdafc544e 100644 --- a/tests/system/Commands/MigrationGeneratorTest.php +++ b/tests/system/Commands/MigrationGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class MigrationGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/MigrationIntegrationTest.php b/tests/system/Commands/MigrationIntegrationTest.php index ba9c3c93d923..75c5cc00ea44 100644 --- a/tests/system/Commands/MigrationIntegrationTest.php +++ b/tests/system/Commands/MigrationIntegrationTest.php @@ -17,10 +17,9 @@ use CodeIgniter\Test\StreamFilterTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class MigrationIntegrationTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ModelGeneratorTest.php b/tests/system/Commands/ModelGeneratorTest.php index 4f780740a7cc..c78f29a41010 100644 --- a/tests/system/Commands/ModelGeneratorTest.php +++ b/tests/system/Commands/ModelGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ModelGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/PublishCommandTest.php b/tests/system/Commands/PublishCommandTest.php index 67ad141735d4..c44f7bb6cbad 100644 --- a/tests/system/Commands/PublishCommandTest.php +++ b/tests/system/Commands/PublishCommandTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PublishCommandTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index 634078e98409..4260d6885208 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RoutesTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ScaffoldGeneratorTest.php b/tests/system/Commands/ScaffoldGeneratorTest.php index 92cba333448f..28682b5c53a4 100644 --- a/tests/system/Commands/ScaffoldGeneratorTest.php +++ b/tests/system/Commands/ScaffoldGeneratorTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ScaffoldGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/SeederGeneratorTest.php b/tests/system/Commands/SeederGeneratorTest.php index 2ac08d508c71..278244217640 100644 --- a/tests/system/Commands/SeederGeneratorTest.php +++ b/tests/system/Commands/SeederGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SeederGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/TestGeneratorTest.php b/tests/system/Commands/TestGeneratorTest.php index 8ffe89c3de55..5a8936d7dee6 100644 --- a/tests/system/Commands/TestGeneratorTest.php +++ b/tests/system/Commands/TestGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TestGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Translation/LocalizationFinderTest.php b/tests/system/Commands/Translation/LocalizationFinderTest.php index 722a812785ac..60046829b801 100644 --- a/tests/system/Commands/Translation/LocalizationFinderTest.php +++ b/tests/system/Commands/Translation/LocalizationFinderTest.php @@ -20,10 +20,9 @@ use Locale; /** - * @group Others - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class LocalizationFinderTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Utilities/ConfigCheckTest.php b/tests/system/Commands/Utilities/ConfigCheckTest.php index b7e3890a5e61..d5fcf9b20498 100644 --- a/tests/system/Commands/Utilities/ConfigCheckTest.php +++ b/tests/system/Commands/Utilities/ConfigCheckTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ConfigCheckTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index fae294afb2ff..198a1a710c7e 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class NamespacesTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php index c1e8f81f3d4f..25fd288bd5e1 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class AutoRouteCollectorTest extends CIUnitTestCase { public function testGet(): void diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php index f906a9298505..cf1e9e0a5e61 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class AutoRouteCollectorTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php index dd60518b57d9..ee9e339283ad 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ControllerMethodReaderTest extends CIUnitTestCase { private function createControllerMethodReader( diff --git a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php index 90160f39a194..ee74ca9dcdce 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ControllerFinderTest extends CIUnitTestCase { public function testFind(): void diff --git a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php index 6e01ba162331..d48e470e8dd6 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ControllerMethodReaderTest extends CIUnitTestCase { public function testRead(): void diff --git a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php index b4925efa936a..d213c2eb5b50 100644 --- a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FilterCollectorTest extends CIUnitTestCase { public function testGet(): void diff --git a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php index 495fbb46f31b..492686122e80 100644 --- a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php @@ -32,9 +32,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FilterFinderTest extends CIUnitTestCase { use ConfigFromArrayTrait; diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index e075f984aa6b..ddae1636396f 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -18,14 +18,11 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SampleURIGeneratorTest extends CIUnitTestCase { - /** - * @dataProvider provideGet - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideGet')] public function testGet(string $routeKey, string $expected): void { $generator = new SampleURIGenerator(); diff --git a/tests/system/Commands/ValidationGeneratorTest.php b/tests/system/Commands/ValidationGeneratorTest.php index 4a853fb61c54..7fd20feeaa6d 100644 --- a/tests/system/Commands/ValidationGeneratorTest.php +++ b/tests/system/Commands/ValidationGeneratorTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ValidationGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/CommonFunctionsSendTest.php b/tests/system/CommonFunctionsSendTest.php index ee4090264da2..6e0b8b342451 100644 --- a/tests/system/CommonFunctionsSendTest.php +++ b/tests/system/CommonFunctionsSendTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class CommonFunctionsSendTest extends CIUnitTestCase { protected function setUp(): void @@ -36,10 +35,9 @@ protected function setUp(): void /** * Make sure cookies are set by RedirectResponse this way * See https://github.com/codeigniter4/CodeIgniter4/issues/1393 - * - * @runInSeparateProcess - * @preserveGlobalState disabled */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testRedirectResponseCookiesSent(): void { $loginTime = time(); diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index 7e1e9d27c349..b57458414fa7 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -46,12 +46,10 @@ use Tests\Support\Models\JobModel; /** - * @backupGlobals enabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class CommonFunctionsTest extends CIUnitTestCase { private ?App $config = null; @@ -269,10 +267,8 @@ public function testEscapeRecursiveArrayRaw(): void $this->assertSame($data, esc($data, 'raw')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSessionInstance(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -284,10 +280,8 @@ public function testSessionInstance(): void $this->assertInstanceOf(Session::class, session()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSessionVariable(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -301,10 +295,8 @@ public function testSessionVariable(): void $this->assertSame('Hi there', session('notbogus')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSessionVariableNotThere(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -429,10 +421,8 @@ public function testModelExistsAbsoluteClassname(): void $this->assertInstanceOf(JobModel::class, model(JobModel::class)); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testOldInput(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -468,10 +458,8 @@ public function testOldInput(): void $this->assertSame('fritz', old('zibble')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testOldInputSerializeData(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -507,10 +495,9 @@ public function testOldInputSerializeData(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492 - * - * @runInSeparateProcess - * @preserveGlobalState disabled */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testOldInputArray(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -628,10 +615,8 @@ public function testRedirectResponseCookies1(): void $this->assertTrue($answer1->hasCookie('login_time')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testTrace(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -655,10 +640,8 @@ public function testViewNotSaveData(): void $this->assertStringContainsString('

is_not

', view('\Tests\Support\View\Views\simples')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testForceHttpsNullRequestAndResponse(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -709,11 +692,10 @@ public function testForceHttpsWithBaseUrlSubFolder(): void } /** - * @dataProvider provideCleanPathActuallyCleaningThePaths - * * @param mixed $input * @param mixed $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideCleanPathActuallyCleaningThePaths')] public function testCleanPathActuallyCleaningThePaths($input, $expected): void { $this->assertSame($expected, clean_path($input)); @@ -774,10 +756,8 @@ public function testDWithCSP(): void Kint::$cli_detection = $cliDetection; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testTraceWithCSP(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/CommonHelperTest.php b/tests/system/CommonHelperTest.php index 5195412db940..e0d51327a525 100644 --- a/tests/system/CommonHelperTest.php +++ b/tests/system/CommonHelperTest.php @@ -22,11 +22,9 @@ /** * @internal - * - * @group Others - * - * @covers ::helper */ +#[\PHPUnit\Framework\Attributes\Group('Others')] +#[\PHPUnit\Framework\Attributes\CoversFunction('helper')] final class CommonHelperTest extends CIUnitTestCase { private array $dummyHelpers = [ diff --git a/tests/system/CommonSingleServiceTest.php b/tests/system/CommonSingleServiceTest.php index 13344db12142..f85d8101a0c6 100644 --- a/tests/system/CommonSingleServiceTest.php +++ b/tests/system/CommonSingleServiceTest.php @@ -23,14 +23,11 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CommonSingleServiceTest extends CIUnitTestCase { - /** - * @dataProvider provideServiceNames - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideServiceNames')] public function testSingleServiceWithNoParamsSupplied(string $service): void { Services::injectMock('security', new MockSecurity(new SecurityConfig())); @@ -44,9 +41,7 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void $this->assertNotSame($service1, $service2); } - /** - * @dataProvider provideServiceNames - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideServiceNames')] public function testSingleServiceWithAtLeastOneParamSupplied(string $service): void { if ($service === 'commands') { diff --git a/tests/system/Config/BaseConfigTest.php b/tests/system/Config/BaseConfigTest.php index 1b59fc623e52..f17dc71fb6c5 100644 --- a/tests/system/Config/BaseConfigTest.php +++ b/tests/system/Config/BaseConfigTest.php @@ -26,9 +26,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class BaseConfigTest extends CIUnitTestCase { private string $fixturesFolder; @@ -99,10 +98,8 @@ public function testUseDefaultValueTypeStringValue(): void $this->assertSame('123456', $config->password); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testServerValues(): void { $_SERVER = [ @@ -195,10 +192,8 @@ public function testSetsDefaultValues(): void $this->assertSame('bar', $config->second); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void { $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); @@ -210,10 +205,8 @@ public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void $this->assertSame('OpenSSL', $config->driver); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSetDefaultValuesEncryptionUsingBase64(): void { $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); diff --git a/tests/system/Config/DotEnvTest.php b/tests/system/Config/DotEnvTest.php index d5ad1448a036..9e47578206ed 100644 --- a/tests/system/Config/DotEnvTest.php +++ b/tests/system/Config/DotEnvTest.php @@ -19,12 +19,10 @@ use TypeError; /** - * @backupGlobals enabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class DotEnvTest extends CIUnitTestCase { private ?vfsStreamDirectory $root; @@ -62,9 +60,7 @@ public function testReturnsFalseIfCannotFindFile(): void $this->assertFalse($dotenv->load()); } - /** - * @dataProvider provideLoadsVars - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideLoadsVars')] public function testLoadsVars(string $expected, string $varname): void { $dotenv = new DotEnv($this->fixturesFolder); @@ -88,10 +84,8 @@ public static function provideLoadsVars(): iterable ]; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testLoadsHex2Bin(): void { $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); @@ -102,10 +96,8 @@ public function testLoadsHex2Bin(): void $this->assertSame('OpenSSL', getenv('encryption.driver')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testLoadsBase64(): void { $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); diff --git a/tests/system/Config/FactoriesTest.php b/tests/system/Config/FactoriesTest.php index dfca8511ada5..dbb2aec291da 100644 --- a/tests/system/Config/FactoriesTest.php +++ b/tests/system/Config/FactoriesTest.php @@ -28,9 +28,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FactoriesTest extends CIUnitTestCase { protected function setUp(): void @@ -438,9 +437,7 @@ public function testGetComponentInstances() return $data; } - /** - * @depends testGetComponentInstances - */ + #[\PHPUnit\Framework\Attributes\Depends('testGetComponentInstances')] public function testSetComponentInstances(array $data) { $before = Factories::getComponentInstances('config'); @@ -457,9 +454,7 @@ public function testSetComponentInstances(array $data) return $data; } - /** - * @depends testSetComponentInstances - */ + #[\PHPUnit\Framework\Attributes\Depends('testSetComponentInstances')] public function testIsUpdated(array $data): void { Factories::reset(); diff --git a/tests/system/Config/MimesTest.php b/tests/system/Config/MimesTest.php index bc500caaa2fa..daa377ff9e34 100644 --- a/tests/system/Config/MimesTest.php +++ b/tests/system/Config/MimesTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class MimesTest extends CIUnitTestCase { public static function provideGuessExtensionFromType(): iterable @@ -49,9 +48,7 @@ public static function provideGuessExtensionFromType(): iterable ]; } - /** - * @dataProvider provideGuessExtensionFromType - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideGuessExtensionFromType')] public function testGuessExtensionFromType(?string $expected, string $mime): void { $this->assertSame($expected, Mimes::guessExtensionFromType($mime)); @@ -83,9 +80,7 @@ public static function provideGuessTypeFromExtension(): iterable ]; } - /** - * @dataProvider provideGuessTypeFromExtension - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideGuessTypeFromExtension')] public function testGuessTypeFromExtension(?string $expected, string $ext): void { $this->assertSame($expected, Mimes::guessTypeFromExtension($ext)); diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index 24d2afb7302e..177091dc5c07 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -51,9 +51,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class ServicesTest extends CIUnitTestCase { private array $original; @@ -241,30 +240,24 @@ public function testNewViewcell(): void $this->assertInstanceOf(Cell::class, $actual); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testNewSession(): void { $actual = Services::session(); $this->assertInstanceOf(Session::class, $actual); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testNewSessionWithNullConfig(): void { $actual = Services::session(null, false); $this->assertInstanceOf(Session::class, $actual); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testCallStatic(): void { // __callStatic should kick in for this but fail @@ -275,10 +268,8 @@ public function testCallStatic(): void $this->assertInstanceOf(Session::class, $actual); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testCallStaticDirectly(): void { // $actual = \CodeIgniter\Config\Services::SeSsIoN(null, false); // original @@ -286,10 +277,8 @@ public function testCallStaticDirectly(): void $this->assertInstanceOf(Session::class, $actual); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testMockInjection(): void { Services::injectMock('response', new MockResponse(new App())); @@ -308,10 +297,8 @@ public function testMockInjection(): void $this->assertSame($response, $response3); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testReset(): void { Services::injectMock('response', new MockResponse(new App())); @@ -327,10 +314,8 @@ public function testReset(): void $this->assertNotSame($response2, $response); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testResetSingle(): void { Services::injectMock('response', new MockResponse(new App())); diff --git a/tests/system/ControllerTest.php b/tests/system/ControllerTest.php index 00a144e1b01c..30505f0f711a 100644 --- a/tests/system/ControllerTest.php +++ b/tests/system/ControllerTest.php @@ -32,12 +32,10 @@ * Not a lot of business logic, so concentrate on making sure * we can exercise everything without blowing up :-/ * - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ControllerTest extends CIUnitTestCase { private App $config; diff --git a/tests/system/Cookie/CookieStoreTest.php b/tests/system/Cookie/CookieStoreTest.php index a7014b9a0997..22f01169e28b 100644 --- a/tests/system/Cookie/CookieStoreTest.php +++ b/tests/system/Cookie/CookieStoreTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CookieStoreTest extends CIUnitTestCase { private array $defaults; diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index bdb9b7498f94..a7bf0b7790a8 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CookieTest extends CIUnitTestCase { private array $defaults; @@ -80,9 +79,7 @@ public function testConfigInjectionForDefaults(): void Cookie::setDefaults($old); } - /** - * @dataProvider provideConfigPrefix - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideConfigPrefix')] public function testConfigPrefix(string $configPrefix, string $optionPrefix, string $expected): void { $config = new CookieConfig(); @@ -167,10 +164,9 @@ public function testExpirationTime(): void } /** - * @dataProvider provideInvalidExpires - * * @param bool|float|string $expires */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideInvalidExpires')] public function testInvalidExpires($expires): void { $this->expectException(CookieException::class); @@ -190,9 +186,7 @@ public static function provideInvalidExpires(): iterable } } - /** - * @dataProvider provideSetCookieHeaderCreation - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSetCookieHeaderCreation')] public function testSetCookieHeaderCreation(string $header, array $changed): void { $cookie = Cookie::fromHeaderString($header); diff --git a/tests/system/DataConverter/DataConverterTest.php b/tests/system/DataConverter/DataConverterTest.php index e5ae5e7abe90..f2c36a4dbd56 100644 --- a/tests/system/DataConverter/DataConverterTest.php +++ b/tests/system/DataConverter/DataConverterTest.php @@ -23,9 +23,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DataConverterTest extends CIUnitTestCase { public function testInstantiate(): void @@ -39,9 +38,7 @@ public function testInstantiate(): void $this->assertInstanceOf(DataConverter::class, $converter); } - /** - * @dataProvider provideConvertDataFromDB - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideConvertDataFromDB')] public function testConvertDataFromDB(array $types, array $dbData, array $expected): void { $converter = $this->createDataConverter($types); @@ -51,9 +48,7 @@ public function testConvertDataFromDB(array $types, array $dbData, array $expect $this->assertSame($expected, $data); } - /** - * @dataProvider provideConvertDataToDB - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideConvertDataToDB')] public function testConvertDataToDB(array $types, array $phpData, array $expected): void { $converter = $this->createDataConverter($types); diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 6c7624ce795a..38bc943b2e47 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class BaseConnectionTest extends CIUnitTestCase { private array $options = [ @@ -180,9 +179,8 @@ public function testMagicGetMissing(): void /** * These tests are intended to confirm the current behavior. * We do not know if all of these are the correct behavior. - * - * @dataProvider provideProtectIdentifiers */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideProtectIdentifiers')] public function testProtectIdentifiers( bool $prefixSingle, bool $protectIdentifiers, @@ -286,9 +284,8 @@ public static function provideProtectIdentifiers(): iterable /** * These tests are intended to confirm the current behavior. - * - * @dataProvider provideEscapeIdentifiers */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideEscapeIdentifiers')] public function testEscapeIdentifiers(string $item, string $expected): void { $db = new MockConnection($this->options); @@ -310,9 +307,7 @@ public static function provideEscapeIdentifiers(): iterable ]; } - /** - * @dataProvider provideEscapeIdentifier - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideEscapeIdentifier')] public function testEscapeIdentifier(string $item, string $expected): void { $db = new MockConnection($this->options); diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php index d4685ae2e989..16e640d1b257 100644 --- a/tests/system/Database/BaseQueryTest.php +++ b/tests/system/Database/BaseQueryTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class BaseQueryTest extends CIUnitTestCase { protected $db; @@ -185,11 +184,10 @@ public static function provideIsWriteType(): iterable } /** - * @dataProvider provideIsWriteType - * * @param mixed $expected * @param mixed $sql */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideIsWriteType')] public function testIsWriteType($expected, $sql): void { $query = new Query($this->db); @@ -598,11 +596,10 @@ public static function provideHighlightQueryKeywords(): iterable } /** - * @dataProvider provideHighlightQueryKeywords - * * @param mixed $expected * @param mixed $sql */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideHighlightQueryKeywords')] public function testHighlightQueryKeywords($expected, $sql): void { $query = new Query($this->db); diff --git a/tests/system/Database/Builder/AliasTest.php b/tests/system/Database/Builder/AliasTest.php index 3e4c88ec9af5..5b5303d3c0d2 100644 --- a/tests/system/Database/Builder/AliasTest.php +++ b/tests/system/Database/Builder/AliasTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class AliasTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/BaseTest.php b/tests/system/Database/Builder/BaseTest.php index bcb4bcfb8822..90901597728b 100644 --- a/tests/system/Database/Builder/BaseTest.php +++ b/tests/system/Database/Builder/BaseTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class BaseTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/CountTest.php b/tests/system/Database/Builder/CountTest.php index 0ba9ac7832e2..2bdf3ea3e63e 100644 --- a/tests/system/Database/Builder/CountTest.php +++ b/tests/system/Database/Builder/CountTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CountTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/DeleteTest.php b/tests/system/Database/Builder/DeleteTest.php index 87cbdf0366fe..9a83941a4806 100644 --- a/tests/system/Database/Builder/DeleteTest.php +++ b/tests/system/Database/Builder/DeleteTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DeleteTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/DistinctTest.php b/tests/system/Database/Builder/DistinctTest.php index 7000a001cde0..5b91f9b90ded 100644 --- a/tests/system/Database/Builder/DistinctTest.php +++ b/tests/system/Database/Builder/DistinctTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DistinctTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/EmptyTest.php b/tests/system/Database/Builder/EmptyTest.php index 176fc8738251..2b2b1c0089ee 100644 --- a/tests/system/Database/Builder/EmptyTest.php +++ b/tests/system/Database/Builder/EmptyTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class EmptyTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/FromTest.php b/tests/system/Database/Builder/FromTest.php index e003353c12f8..92f87d6b6571 100644 --- a/tests/system/Database/Builder/FromTest.php +++ b/tests/system/Database/Builder/FromTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FromTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/GetTest.php b/tests/system/Database/Builder/GetTest.php index 3daf4a6831d6..b483bd4cdf3b 100644 --- a/tests/system/Database/Builder/GetTest.php +++ b/tests/system/Database/Builder/GetTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class GetTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/GroupTest.php b/tests/system/Database/Builder/GroupTest.php index c6f2b24667b0..e8ddb0d1e2b8 100644 --- a/tests/system/Database/Builder/GroupTest.php +++ b/tests/system/Database/Builder/GroupTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class GroupTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/InsertTest.php b/tests/system/Database/Builder/InsertTest.php index 55faceaa5657..d5f23af92111 100644 --- a/tests/system/Database/Builder/InsertTest.php +++ b/tests/system/Database/Builder/InsertTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class InsertTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/JoinTest.php b/tests/system/Database/Builder/JoinTest.php index 83c7ea4f3ab9..900e43fa45ec 100644 --- a/tests/system/Database/Builder/JoinTest.php +++ b/tests/system/Database/Builder/JoinTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class JoinTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/LikeTest.php b/tests/system/Database/Builder/LikeTest.php index 5cdae0729d70..5051b8d1275d 100644 --- a/tests/system/Database/Builder/LikeTest.php +++ b/tests/system/Database/Builder/LikeTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class LikeTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/LimitTest.php b/tests/system/Database/Builder/LimitTest.php index 04d4668ec356..14a8523f69f1 100644 --- a/tests/system/Database/Builder/LimitTest.php +++ b/tests/system/Database/Builder/LimitTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class LimitTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/OrderTest.php b/tests/system/Database/Builder/OrderTest.php index 1dc4ba4052ae..59a16caecf8b 100644 --- a/tests/system/Database/Builder/OrderTest.php +++ b/tests/system/Database/Builder/OrderTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class OrderTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/PrefixTest.php b/tests/system/Database/Builder/PrefixTest.php index 5ff7ccb720a1..88f6269df230 100644 --- a/tests/system/Database/Builder/PrefixTest.php +++ b/tests/system/Database/Builder/PrefixTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PrefixTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/ReplaceTest.php b/tests/system/Database/Builder/ReplaceTest.php index 24a68cffff8e..a5ecdbb6ce47 100644 --- a/tests/system/Database/Builder/ReplaceTest.php +++ b/tests/system/Database/Builder/ReplaceTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ReplaceTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/SelectTest.php b/tests/system/Database/Builder/SelectTest.php index 6a9c32183afc..48521d299901 100644 --- a/tests/system/Database/Builder/SelectTest.php +++ b/tests/system/Database/Builder/SelectTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SelectTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/TruncateTest.php b/tests/system/Database/Builder/TruncateTest.php index 4cf6d05d1ed9..43ad872188cd 100644 --- a/tests/system/Database/Builder/TruncateTest.php +++ b/tests/system/Database/Builder/TruncateTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TruncateTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/UnionTest.php b/tests/system/Database/Builder/UnionTest.php index d0487259445c..8baad8174399 100644 --- a/tests/system/Database/Builder/UnionTest.php +++ b/tests/system/Database/Builder/UnionTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class UnionTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/UpdateTest.php b/tests/system/Database/Builder/UpdateTest.php index de338111c4a9..2df5a28842d9 100644 --- a/tests/system/Database/Builder/UpdateTest.php +++ b/tests/system/Database/Builder/UpdateTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class UpdateTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/WhenTest.php b/tests/system/Database/Builder/WhenTest.php index b70a8e82e7b9..7d2b07e428a3 100644 --- a/tests/system/Database/Builder/WhenTest.php +++ b/tests/system/Database/Builder/WhenTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class WhenTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index e48f0c6711a9..3afc27932ccc 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class WhereTest extends CIUnitTestCase { /** @@ -403,10 +402,9 @@ public static function provideWhereInvalidKeyThrowInvalidArgumentException(): it } /** - * @dataProvider provideWhereInvalidKeyThrowInvalidArgumentException - * * @param mixed $key */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideWhereInvalidKeyThrowInvalidArgumentException')] public function testWhereInvalidKeyThrowInvalidArgumentException($key): void { $this->expectException('InvalidArgumentException'); @@ -425,10 +423,9 @@ public static function provideWhereInEmptyValuesThrowInvalidArgumentException(): } /** - * @dataProvider provideWhereInEmptyValuesThrowInvalidArgumentException - * * @param mixed $values */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideWhereInEmptyValuesThrowInvalidArgumentException')] public function testWhereInEmptyValuesThrowInvalidArgumentException($values): void { $this->expectException('InvalidArgumentException'); diff --git a/tests/system/Database/ConfigTest.php b/tests/system/Database/ConfigTest.php index c35b0f60f202..74ac4a141fdb 100644 --- a/tests/system/Database/ConfigTest.php +++ b/tests/system/Database/ConfigTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ConfigTest extends CIUnitTestCase { use ReflectionHelper; @@ -194,10 +193,9 @@ public function testConnectionGroupWithDSNPostgreNative(): void } /** - * @dataProvider provideConvertDSN - * * @see https://github.com/codeigniter4/CodeIgniter4/issues/7550 */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideConvertDSN')] public function testConvertDSN(string $input, string $expected): void { // @TODO This format is for PDO_PGSQL. diff --git a/tests/system/Database/DatabaseSeederTest.php b/tests/system/Database/DatabaseSeederTest.php index 5d0258c57dc2..895d5fc5f6e0 100644 --- a/tests/system/Database/DatabaseSeederTest.php +++ b/tests/system/Database/DatabaseSeederTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DatabaseSeederTest extends CIUnitTestCase { public function testInstantiateNoSeedPath(): void diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php index 597e66aaf967..07affb5e5082 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php @@ -22,10 +22,9 @@ * DatabaseTestCaseMigrationOnce1Test and DatabaseTestCaseMigrationOnce2Test * show $migrateOnce applies per test case file. * - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DatabaseTestCaseMigrationOnce1Test extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php index 17def3edec19..c20033eaf980 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php @@ -22,10 +22,9 @@ * DatabaseTestCaseMigrationOnce1Test and DatabaseTestCaseMigrationOnce2Test * show $migrateOnce applies per test case file. * - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DatabaseTestCaseMigrationOnce2Test extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/DatabaseTestCaseTest.php b/tests/system/Database/DatabaseTestCaseTest.php index 3224efe054ce..533a31a5bece 100644 --- a/tests/system/Database/DatabaseTestCaseTest.php +++ b/tests/system/Database/DatabaseTestCaseTest.php @@ -21,10 +21,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DatabaseTestCaseTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Forge/CreateTableTest.php b/tests/system/Database/Forge/CreateTableTest.php index 1e52d348a04b..7ee4f40bd0f8 100644 --- a/tests/system/Database/Forge/CreateTableTest.php +++ b/tests/system/Database/Forge/CreateTableTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CreateTableTest extends CIUnitTestCase { public function testCreateTableWithDefaultRawSql(): void diff --git a/tests/system/Database/Forge/DropForeignKeyTest.php b/tests/system/Database/Forge/DropForeignKeyTest.php index 98acf337b7fb..b788d25247d0 100644 --- a/tests/system/Database/Forge/DropForeignKeyTest.php +++ b/tests/system/Database/Forge/DropForeignKeyTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DropForeignKeyTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Live/AliasTest.php b/tests/system/Database/Live/AliasTest.php index c55e08a0345e..1abaef6a29fd 100644 --- a/tests/system/Database/Live/AliasTest.php +++ b/tests/system/Database/Live/AliasTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class AliasTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/BadQueryTest.php b/tests/system/Database/Live/BadQueryTest.php index c07963cf2b61..b2da47b1fcfe 100644 --- a/tests/system/Database/Live/BadQueryTest.php +++ b/tests/system/Database/Live/BadQueryTest.php @@ -19,10 +19,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class BadQueryTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/ConnectTest.php b/tests/system/Database/Live/ConnectTest.php index 777c074ad136..b04cf2fe2e3d 100644 --- a/tests/system/Database/Live/ConnectTest.php +++ b/tests/system/Database/Live/ConnectTest.php @@ -20,10 +20,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ConnectTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/CountTest.php b/tests/system/Database/Live/CountTest.php index 0df9132e808a..d475e961f2bc 100644 --- a/tests/system/Database/Live/CountTest.php +++ b/tests/system/Database/Live/CountTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class CountTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DatabaseTestTraitCaseTest.php b/tests/system/Database/Live/DatabaseTestTraitCaseTest.php index 8c4c2d4ab4bc..4c1467bc48d2 100644 --- a/tests/system/Database/Live/DatabaseTestTraitCaseTest.php +++ b/tests/system/Database/Live/DatabaseTestTraitCaseTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DatabaseTestTraitCaseTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DbDebugTest.php b/tests/system/Database/Live/DbDebugTest.php index 5939ff0df127..1c878578026a 100644 --- a/tests/system/Database/Live/DbDebugTest.php +++ b/tests/system/Database/Live/DbDebugTest.php @@ -18,10 +18,9 @@ use CodeIgniter\Test\DatabaseTestTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DbDebugTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DbUtilsTest.php b/tests/system/Database/Live/DbUtilsTest.php index ac1aa660cbf4..039ebd926911 100644 --- a/tests/system/Database/Live/DbUtilsTest.php +++ b/tests/system/Database/Live/DbUtilsTest.php @@ -20,10 +20,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DbUtilsTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DeleteTest.php b/tests/system/Database/Live/DeleteTest.php index 3a8d10b03020..5ed001c5eb42 100644 --- a/tests/system/Database/Live/DeleteTest.php +++ b/tests/system/Database/Live/DeleteTest.php @@ -21,10 +21,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DeleteTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/EmptyTest.php b/tests/system/Database/Live/EmptyTest.php index 4790addd9650..88305c57d7ae 100644 --- a/tests/system/Database/Live/EmptyTest.php +++ b/tests/system/Database/Live/EmptyTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class EmptyTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/EscapeTest.php b/tests/system/Database/Live/EscapeTest.php index 0f931cdbe85c..9f0a76184af1 100644 --- a/tests/system/Database/Live/EscapeTest.php +++ b/tests/system/Database/Live/EscapeTest.php @@ -19,10 +19,9 @@ use CodeIgniter\Test\DatabaseTestTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class EscapeTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/FabricatorLiveTest.php b/tests/system/Database/Live/FabricatorLiveTest.php index 9b161778b0e0..19770bea6a83 100644 --- a/tests/system/Database/Live/FabricatorLiveTest.php +++ b/tests/system/Database/Live/FabricatorLiveTest.php @@ -21,10 +21,9 @@ use Tests\Support\Models\ValidModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class FabricatorLiveTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index 8061e80d7241..0fa79a255f5f 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -24,10 +24,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ForgeTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/FromTest.php b/tests/system/Database/Live/FromTest.php index ee7a429c1f22..312fd5e30416 100644 --- a/tests/system/Database/Live/FromTest.php +++ b/tests/system/Database/Live/FromTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class FromTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GetNumRowsTest.php b/tests/system/Database/Live/GetNumRowsTest.php index cea8ef4b0e49..1f2ba9ddcb67 100644 --- a/tests/system/Database/Live/GetNumRowsTest.php +++ b/tests/system/Database/Live/GetNumRowsTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetNumRowsTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GetTest.php b/tests/system/Database/Live/GetTest.php index f666d3aa629d..ce4cfce4a9d2 100644 --- a/tests/system/Database/Live/GetTest.php +++ b/tests/system/Database/Live/GetTest.php @@ -20,10 +20,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GetVersionTest.php b/tests/system/Database/Live/GetVersionTest.php index 65cca3e21df9..d6a60f039a9c 100644 --- a/tests/system/Database/Live/GetVersionTest.php +++ b/tests/system/Database/Live/GetVersionTest.php @@ -17,10 +17,9 @@ use CodeIgniter\Test\DatabaseTestTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetVersionTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GroupTest.php b/tests/system/Database/Live/GroupTest.php index a242546ebcd0..dda699ba5bf6 100644 --- a/tests/system/Database/Live/GroupTest.php +++ b/tests/system/Database/Live/GroupTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GroupTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/IncrementTest.php b/tests/system/Database/Live/IncrementTest.php index e6bd52a3b96d..314897454ed9 100644 --- a/tests/system/Database/Live/IncrementTest.php +++ b/tests/system/Database/Live/IncrementTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class IncrementTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/InsertTest.php b/tests/system/Database/Live/InsertTest.php index 265c0b407246..1e6720225a76 100644 --- a/tests/system/Database/Live/InsertTest.php +++ b/tests/system/Database/Live/InsertTest.php @@ -21,10 +21,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class InsertTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/JoinTest.php b/tests/system/Database/Live/JoinTest.php index 046270c5fd5b..979a516e2030 100644 --- a/tests/system/Database/Live/JoinTest.php +++ b/tests/system/Database/Live/JoinTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class JoinTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/LikeTest.php b/tests/system/Database/Live/LikeTest.php index 3b79598e3613..d74544387e09 100644 --- a/tests/system/Database/Live/LikeTest.php +++ b/tests/system/Database/Live/LikeTest.php @@ -19,10 +19,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class LikeTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/LimitTest.php b/tests/system/Database/Live/LimitTest.php index 546096eb9be5..b0f1df6ee6ab 100644 --- a/tests/system/Database/Live/LimitTest.php +++ b/tests/system/Database/Live/LimitTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class LimitTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/MetadataTest.php b/tests/system/Database/Live/MetadataTest.php index 4d6927f2d800..2e2182fa835a 100644 --- a/tests/system/Database/Live/MetadataTest.php +++ b/tests/system/Database/Live/MetadataTest.php @@ -19,10 +19,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class MetadataTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php b/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php index 5b9bc3b16701..478fded783d4 100644 --- a/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php @@ -17,10 +17,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/MySQLi/NumberNativeTest.php b/tests/system/Database/Live/MySQLi/NumberNativeTest.php index 5ba37eaf804e..051e64cfad71 100644 --- a/tests/system/Database/Live/MySQLi/NumberNativeTest.php +++ b/tests/system/Database/Live/MySQLi/NumberNativeTest.php @@ -19,10 +19,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class NumberNativeTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/MySQLi/RawSqlTest.php b/tests/system/Database/Live/MySQLi/RawSqlTest.php index 84949848b5f3..77aeddfd4ab4 100644 --- a/tests/system/Database/Live/MySQLi/RawSqlTest.php +++ b/tests/system/Database/Live/MySQLi/RawSqlTest.php @@ -20,10 +20,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class RawSqlTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php index c2f2b377387e..8ce809c29af8 100644 --- a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php +++ b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php @@ -17,10 +17,9 @@ use CodeIgniter\Test\DatabaseTestTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class CallStoredProcedureTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php index 809a58e30264..074b77d4e8bc 100644 --- a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php @@ -19,10 +19,9 @@ use stdClass; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/OCI8/LastInsertIDTest.php b/tests/system/Database/Live/OCI8/LastInsertIDTest.php index eef3be40bc85..9b6e46ebc713 100644 --- a/tests/system/Database/Live/OCI8/LastInsertIDTest.php +++ b/tests/system/Database/Live/OCI8/LastInsertIDTest.php @@ -19,10 +19,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class LastInsertIDTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/OrderTest.php b/tests/system/Database/Live/OrderTest.php index 9109c88f066a..9057fb172032 100644 --- a/tests/system/Database/Live/OrderTest.php +++ b/tests/system/Database/Live/OrderTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class OrderTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php b/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php index 04adeb0bda53..ea80dbb6d5f4 100644 --- a/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php @@ -17,10 +17,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/PreparedQueryTest.php b/tests/system/Database/Live/PreparedQueryTest.php index cf9bf4d24d67..0cd0c23d597e 100644 --- a/tests/system/Database/Live/PreparedQueryTest.php +++ b/tests/system/Database/Live/PreparedQueryTest.php @@ -23,10 +23,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class PreparedQueryTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/PretendTest.php b/tests/system/Database/Live/PretendTest.php index e915cd7ff567..f6cb14fc9467 100644 --- a/tests/system/Database/Live/PretendTest.php +++ b/tests/system/Database/Live/PretendTest.php @@ -18,10 +18,9 @@ use CodeIgniter\Test\DatabaseTestTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class PretendTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php b/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php index 05f77981cff0..2c074bd57d4d 100644 --- a/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php @@ -17,10 +17,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/SQLite3/AlterTableTest.php b/tests/system/Database/Live/SQLite3/AlterTableTest.php index 1c47fb607c4a..0d01d4f4c51a 100644 --- a/tests/system/Database/Live/SQLite3/AlterTableTest.php +++ b/tests/system/Database/Live/SQLite3/AlterTableTest.php @@ -21,12 +21,10 @@ use Config\Database; /** - * @group DatabaseLive - * - * @requires extension sqlite3 - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('sqlite3')] final class AlterTableTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php b/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php index cf14c0070119..aa7da330a2e8 100644 --- a/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php +++ b/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php @@ -18,10 +18,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ForgeModifyColumnTest extends CIUnitTestCase { private Forge $forge; diff --git a/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php b/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php index 164845a8f9d8..cd463186c4dc 100644 --- a/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php @@ -17,10 +17,9 @@ use Config\Database; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php index 72662be16d1d..8352fdcb8b31 100644 --- a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php +++ b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php @@ -20,10 +20,9 @@ use stdClass; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class GetIndexDataTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Live/SelectTest.php b/tests/system/Database/Live/SelectTest.php index b66b26fbe960..7afbcbf7fdd8 100644 --- a/tests/system/Database/Live/SelectTest.php +++ b/tests/system/Database/Live/SelectTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class SelectTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/TransactionDBDebugFalseTest.php b/tests/system/Database/Live/TransactionDBDebugFalseTest.php index 5bf0f288e2f9..326dedbe9983 100644 --- a/tests/system/Database/Live/TransactionDBDebugFalseTest.php +++ b/tests/system/Database/Live/TransactionDBDebugFalseTest.php @@ -14,10 +14,9 @@ namespace CodeIgniter\Database\Live; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class TransactionDBDebugFalseTest extends TransactionDBDebugTrueTest { protected function setUp(): void diff --git a/tests/system/Database/Live/TransactionDBDebugTrueTest.php b/tests/system/Database/Live/TransactionDBDebugTrueTest.php index e9a39847b939..33131c5540f0 100644 --- a/tests/system/Database/Live/TransactionDBDebugTrueTest.php +++ b/tests/system/Database/Live/TransactionDBDebugTrueTest.php @@ -20,12 +20,11 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal * * @no-final */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] class TransactionDBDebugTrueTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/TransactionTest.php b/tests/system/Database/Live/TransactionTest.php index 06a0abf886c2..578664d26afe 100644 --- a/tests/system/Database/Live/TransactionTest.php +++ b/tests/system/Database/Live/TransactionTest.php @@ -20,10 +20,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class TransactionTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/UnionTest.php b/tests/system/Database/Live/UnionTest.php index f30625ee3187..98bcc1bbd427 100644 --- a/tests/system/Database/Live/UnionTest.php +++ b/tests/system/Database/Live/UnionTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class UnionTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/UpdateTest.php b/tests/system/Database/Live/UpdateTest.php index 12f94503d793..5b020d511bf1 100644 --- a/tests/system/Database/Live/UpdateTest.php +++ b/tests/system/Database/Live/UpdateTest.php @@ -22,10 +22,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class UpdateTest extends CIUnitTestCase { use DatabaseTestTrait; @@ -113,9 +112,7 @@ public function testUpdateWithWhereAndLimit(): void } } - /** - * @dataProvider provideUpdateBatch - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUpdateBatch')] public function testUpdateBatch(string $constraints, array $data, array $expected): void { $table = 'type_test'; diff --git a/tests/system/Database/Live/UpsertTest.php b/tests/system/Database/Live/UpsertTest.php index 76329a432843..b3f2d7f9ba97 100644 --- a/tests/system/Database/Live/UpsertTest.php +++ b/tests/system/Database/Live/UpsertTest.php @@ -23,10 +23,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class UpsertTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/WhereTest.php b/tests/system/Database/Live/WhereTest.php index 8742cfee6bf9..8acc190bfb1c 100644 --- a/tests/system/Database/Live/WhereTest.php +++ b/tests/system/Database/Live/WhereTest.php @@ -18,10 +18,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class WhereTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/WriteTypeQueryTest.php b/tests/system/Database/Live/WriteTypeQueryTest.php index 56b700e76fbc..44bd4e99f10e 100644 --- a/tests/system/Database/Live/WriteTypeQueryTest.php +++ b/tests/system/Database/Live/WriteTypeQueryTest.php @@ -19,10 +19,9 @@ use Tests\Support\Database\Seeds\CITestSeeder; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class WriteTypeQueryTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Migrations/MigrationRunnerTest.php b/tests/system/Database/Migrations/MigrationRunnerTest.php index be40e676c529..0c979a3b2afc 100644 --- a/tests/system/Database/Migrations/MigrationRunnerTest.php +++ b/tests/system/Database/Migrations/MigrationRunnerTest.php @@ -28,10 +28,9 @@ use Tests\Support\MigrationTestMigrations\Database\Migrations\Migration_some_migration; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class MigrationRunnerTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Migrations/MigrationTest.php b/tests/system/Database/Migrations/MigrationTest.php index 21c08fd303cc..83873992c411 100644 --- a/tests/system/Database/Migrations/MigrationTest.php +++ b/tests/system/Database/Migrations/MigrationTest.php @@ -18,10 +18,9 @@ use CodeIgniter\Test\DatabaseTestTrait; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class MigrationTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/RawSqlTest.php b/tests/system/Database/RawSqlTest.php index 4915752ed389..6c58c2ad96f5 100644 --- a/tests/system/Database/RawSqlTest.php +++ b/tests/system/Database/RawSqlTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RawSqlTest extends CIUnitTestCase { public function testCanConvertToString(): void diff --git a/tests/system/Debug/ExceptionHandlerTest.php b/tests/system/Debug/ExceptionHandlerTest.php index 6516eff34c4e..551298ebdd3d 100644 --- a/tests/system/Debug/ExceptionHandlerTest.php +++ b/tests/system/Debug/ExceptionHandlerTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ExceptionHandlerTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index c71cb0be936f..087639a2611c 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ExceptionsTest extends CIUnitTestCase { use ReflectionHelper; @@ -54,9 +53,7 @@ protected function setUp(): void $this->exception = new Exceptions(new ExceptionsConfig()); } - /** - * @requires PHP >= 8.1 - */ + #[\PHPUnit\Framework\Attributes\RequiresPhp('>= 8.1')] public function testDeprecationsOnPhp81DoNotThrow(): void { $config = new ExceptionsConfig(); diff --git a/tests/system/Debug/TimerTest.php b/tests/system/Debug/TimerTest.php index f93374a32246..68848d51bf24 100644 --- a/tests/system/Debug/TimerTest.php +++ b/tests/system/Debug/TimerTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TimerTest extends CIUnitTestCase { /** diff --git a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php index 8da3c5e6115d..c48632a929a9 100644 --- a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php +++ b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DatabaseTest extends CIUnitTestCase { public function testDisplay(): void diff --git a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php index 94297c6d1c63..38a6ca8e2bb6 100644 --- a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php +++ b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class HistoryTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/DebugTraceableTraitTest.php b/tests/system/DebugTraceableTraitTest.php index 776bad36c9b5..b610b687569b 100644 --- a/tests/system/DebugTraceableTraitTest.php +++ b/tests/system/DebugTraceableTraitTest.php @@ -19,11 +19,9 @@ /** * @internal - * - * @group Others - * - * @covers \CodeIgniter\Exceptions\DebugTraceableTrait */ +#[\PHPUnit\Framework\Attributes\Group('Others')] +#[\PHPUnit\Framework\Attributes\CoversClass(DebugTraceableTrait::class)] final class DebugTraceableTraitTest extends CIUnitTestCase { public function testFactoryInstanceReturnsWhereItIsRaised(): void diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index 1950fbbf6328..c0f431690194 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class EmailTest extends CIUnitTestCase { public function testEmailValidation(): void @@ -43,10 +42,9 @@ public static function provideEmailSendWithClearance(): iterable } /** - * @dataProvider provideEmailSendWithClearance - * * @param mixed $autoClear */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideEmailSendWithClearance')] public function testEmailSendWithClearance($autoClear): void { $email = $this->createMockEmail(); diff --git a/tests/system/Encryption/EncryptionTest.php b/tests/system/Encryption/EncryptionTest.php index c92af195657d..10e6d7f1a041 100644 --- a/tests/system/Encryption/EncryptionTest.php +++ b/tests/system/Encryption/EncryptionTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class EncryptionTest extends CIUnitTestCase { private Encryption $encryption; diff --git a/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php b/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php index bec040d45ba0..ef194273d9ec 100644 --- a/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php +++ b/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class OpenSSLHandlerTest extends CIUnitTestCase { private Encryption $encryption; diff --git a/tests/system/Encryption/Handlers/SodiumHandlerTest.php b/tests/system/Encryption/Handlers/SodiumHandlerTest.php index 8c6c9299fbf3..1657451d36c1 100644 --- a/tests/system/Encryption/Handlers/SodiumHandlerTest.php +++ b/tests/system/Encryption/Handlers/SodiumHandlerTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SodiumHandlerTest extends CIUnitTestCase { private Encryption $encryption; diff --git a/tests/system/Entity/EntityTest.php b/tests/system/Entity/EntityTest.php index 37e65c497e57..158aea67a958 100644 --- a/tests/system/Entity/EntityTest.php +++ b/tests/system/Entity/EntityTest.php @@ -29,9 +29,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class EntityTest extends CIUnitTestCase { use ReflectionHelper; diff --git a/tests/system/Events/EventsTest.php b/tests/system/Events/EventsTest.php index 289f4f2c0676..385c9f8d9582 100644 --- a/tests/system/Events/EventsTest.php +++ b/tests/system/Events/EventsTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class EventsTest extends CIUnitTestCase { /** @@ -47,10 +46,8 @@ protected function tearDown(): void Events::simulate(false); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testInitialize(): void { /** diff --git a/tests/system/Files/FileCollectionTest.php b/tests/system/Files/FileCollectionTest.php index 8aa2e8098c2b..334ba739c00f 100644 --- a/tests/system/Files/FileCollectionTest.php +++ b/tests/system/Files/FileCollectionTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileCollectionTest extends CIUnitTestCase { /** diff --git a/tests/system/Files/FileTest.php b/tests/system/Files/FileTest.php index 384f94073857..658a7f7c8f3b 100644 --- a/tests/system/Files/FileTest.php +++ b/tests/system/Files/FileTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileTest extends CIUnitTestCase { public function testNewGoodChecked(): void diff --git a/tests/system/Files/FileWithVfsTest.php b/tests/system/Files/FileWithVfsTest.php index eb23d51b5831..8482dfcd9bbb 100644 --- a/tests/system/Files/FileWithVfsTest.php +++ b/tests/system/Files/FileWithVfsTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileWithVfsTest extends CIUnitTestCase { // For VFS stuff diff --git a/tests/system/Filters/CSRFTest.php b/tests/system/Filters/CSRFTest.php index 873ff05b8740..824cc6f1fdb9 100644 --- a/tests/system/Filters/CSRFTest.php +++ b/tests/system/Filters/CSRFTest.php @@ -20,12 +20,10 @@ use CodeIgniter\Test\CIUnitTestCase; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CSRFTest extends CIUnitTestCase { private \Config\Filters $config; diff --git a/tests/system/Filters/CorsTest.php b/tests/system/Filters/CorsTest.php index a628bccfd162..c27a754cf90b 100644 --- a/tests/system/Filters/CorsTest.php +++ b/tests/system/Filters/CorsTest.php @@ -30,9 +30,8 @@ * https://github.com/asm89/stack-cors/blob/b6920bd8996449400ac976e083b55fb45f035467/tests/CorsTest.php * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CorsTest extends CIUnitTestCase { private Cors $cors; diff --git a/tests/system/Filters/DebugToolbarTest.php b/tests/system/Filters/DebugToolbarTest.php index f293eb1def25..3a50e689c184 100644 --- a/tests/system/Filters/DebugToolbarTest.php +++ b/tests/system/Filters/DebugToolbarTest.php @@ -21,12 +21,10 @@ use Config\Filters as FilterConfig; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DebugToolbarTest extends CIUnitTestCase { /** diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index 9ce2c1b28985..0c772cf65ce2 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -42,12 +42,10 @@ require_once __DIR__ . '/fixtures/Role.php'; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FiltersTest extends CIUnitTestCase { use ConfigFromArrayTrait; @@ -230,10 +228,9 @@ public static function provideProcessMethodProcessGlobalsWithExcept(): iterable } /** - * @dataProvider provideProcessMethodProcessGlobalsWithExcept - * * @param array|string $except */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideProcessMethodProcessGlobalsWithExcept')] public function testProcessMethodProcessGlobalsWithExcept($except): void { $_SERVER['REQUEST_METHOD'] = 'GET'; @@ -584,10 +581,9 @@ public function testOtherResult(): void } /** - * @dataProvider provideBeforeExcept - * * @param array|string $except */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideBeforeExcept')] public function testBeforeExcept(string $uri, $except, array $expected): void { $_SERVER['REQUEST_METHOD'] = 'GET'; diff --git a/tests/system/Filters/HoneypotTest.php b/tests/system/Filters/HoneypotTest.php index cb2d804d4cbc..2735b9b67dd1 100644 --- a/tests/system/Filters/HoneypotTest.php +++ b/tests/system/Filters/HoneypotTest.php @@ -22,12 +22,10 @@ use Config\Honeypot; /** - * @backupGlobals enabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class HoneypotTest extends CIUnitTestCase { private \Config\Filters $config; @@ -92,10 +90,8 @@ public function testBeforeClean(): void $this->assertSame($expected, $request); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testAfter(): void { $this->config->globals = [ @@ -114,10 +110,8 @@ public function testAfter(): void $this->assertStringContainsString($this->honey->name, $this->response->getBody()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testAfterNotApplicable(): void { $this->config->globals = [ diff --git a/tests/system/Filters/InvalidCharsTest.php b/tests/system/Filters/InvalidCharsTest.php index db2eb6a5b0fa..b7fcf154178b 100644 --- a/tests/system/Filters/InvalidCharsTest.php +++ b/tests/system/Filters/InvalidCharsTest.php @@ -23,9 +23,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class InvalidCharsTest extends CIUnitTestCase { private InvalidChars $invalidChars; @@ -66,9 +65,7 @@ private function createRequest(): IncomingRequest return $request; } - /** - * @doesNotPerformAssertions - */ + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testBeforeDoNothingWhenCLIRequest(): void { $cliRequest = new CLIRequest(new MockAppConfig()); @@ -76,9 +73,7 @@ public function testBeforeDoNothingWhenCLIRequest(): void $this->invalidChars->before($cliRequest); } - /** - * @doesNotPerformAssertions - */ + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] public function testBeforeValidString(): void { $_POST['val'] = [ @@ -114,11 +109,8 @@ public function testBeforeInvalidControlCharCausesException(): void $this->invalidChars->before($this->request); } - /** - * @doesNotPerformAssertions - * - * @dataProvider provideCheckControlStringWithLineBreakAndTabReturnsTheString - */ + #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] + #[\PHPUnit\Framework\Attributes\DataProvider('provideCheckControlStringWithLineBreakAndTabReturnsTheString')] public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $input): void { $_GET['val'] = $input; @@ -137,9 +129,7 @@ public static function provideCheckControlStringWithLineBreakAndTabReturnsTheStr ]; } - /** - * @dataProvider provideCheckControlStringWithControlCharsCausesException - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideCheckControlStringWithControlCharsCausesException')] public function testCheckControlStringWithControlCharsCausesException(string $input): void { $this->expectException(SecurityException::class); diff --git a/tests/system/Filters/SecureHeadersTest.php b/tests/system/Filters/SecureHeadersTest.php index 89dbf126e2a8..6958663426d2 100644 --- a/tests/system/Filters/SecureHeadersTest.php +++ b/tests/system/Filters/SecureHeadersTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SecureHeadersTest extends CIUnitTestCase { public function testAfter(): void diff --git a/tests/system/Format/FormatTest.php b/tests/system/Format/FormatTest.php index 6abda45fbb6f..e580d19ae85d 100644 --- a/tests/system/Format/FormatTest.php +++ b/tests/system/Format/FormatTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FormatTest extends CIUnitTestCase { private Format $format; diff --git a/tests/system/Format/JSONFormatterTest.php b/tests/system/Format/JSONFormatterTest.php index 18f7ef7d3daa..025b6b2a7593 100644 --- a/tests/system/Format/JSONFormatterTest.php +++ b/tests/system/Format/JSONFormatterTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class JSONFormatterTest extends CIUnitTestCase { private JSONFormatter $jsonFormatter; diff --git a/tests/system/Format/XMLFormatterTest.php b/tests/system/Format/XMLFormatterTest.php index c9601020eaa8..be118820237b 100644 --- a/tests/system/Format/XMLFormatterTest.php +++ b/tests/system/Format/XMLFormatterTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class XMLFormatterTest extends CIUnitTestCase { private XMLFormatter $xmlFormatter; @@ -103,9 +102,7 @@ public function testValidatingXmlTags(): void $this->assertSame($expected, $this->xmlFormatter->format($data)); } - /** - * @dataProvider provideValidatingInvalidTags - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidatingInvalidTags')] public function testValidatingInvalidTags(string $expected, array $input): void { $expectedXML = <<assertSame('apple', $request->header('fruit')->getValue()); } - /** - * @backupGlobals enabled - */ + #[\PHPUnit\Framework\Attributes\BackupGlobals(true)] public function testOptionsHeadersNotUsingPopulate(): void { $_SERVER['HTTP_HOST'] = 'site1.com'; @@ -248,9 +245,7 @@ public function testHeaderContentLengthNotSharedBetweenRequests(): void $this->assertNull($request->header('Content-Length')); } - /** - * @backupGlobals enabled - */ + #[\PHPUnit\Framework\Attributes\BackupGlobals(true)] public function testHeaderContentLengthNotSharedBetweenClients(): void { $_SERVER['HTTP_CONTENT_LENGTH'] = '10'; diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index 6502579eadf4..86baa46626a2 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -25,9 +25,8 @@ * See https://cspvalidator.org/ * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class ContentSecurityPolicyTest extends CIUnitTestCase { private ?Response $response = null; @@ -70,10 +69,8 @@ protected function work(string $parm = 'Hello') return $buffer; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testExistence(): void { $this->prepare(); @@ -82,10 +79,8 @@ public function testExistence(): void $this->assertHeaderEmitted('Content-Security-Policy:'); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testReportOnly(): void { $this->prepare(); @@ -95,10 +90,8 @@ public function testReportOnly(): void $this->assertHeaderEmitted('Content-Security-Policy:'); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testDefaults(): void { $this->prepare(); @@ -114,10 +107,8 @@ public function testDefaults(): void $this->assertStringContainsString("style-src 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testChildSrc(): void { $this->prepare(); @@ -131,10 +122,8 @@ public function testChildSrc(): void $this->assertStringContainsString("child-src 'self' good.com;", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testConnectSrc(): void { $this->prepare(); @@ -147,10 +136,8 @@ public function testConnectSrc(): void $this->assertStringContainsString("connect-src 'self' iffy.com maybe.com;", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testFontSrc(): void { $this->prepare(); @@ -165,10 +152,8 @@ public function testFontSrc(): void $this->assertStringContainsString('font-src fontsrus.com;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testFormAction(): void { $this->prepare(); @@ -183,10 +168,8 @@ public function testFormAction(): void $this->assertStringNotContainsString("form-action 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testFrameAncestor(): void { $this->prepare(); @@ -200,10 +183,8 @@ public function testFrameAncestor(): void $this->assertStringContainsString("frame-ancestors 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testFrameSrc(): void { $this->prepare(); @@ -217,10 +198,8 @@ public function testFrameSrc(): void $this->assertStringContainsString("frame-src 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testImageSrc(): void { $this->prepare(); @@ -234,10 +213,8 @@ public function testImageSrc(): void $this->assertStringContainsString("img-src 'self' cdn.cloudy.com;", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testMediaSrc(): void { $this->prepare(); @@ -251,10 +228,8 @@ public function testMediaSrc(): void $this->assertStringContainsString("media-src 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testManifestSrc(): void { $this->prepare(); @@ -268,10 +243,8 @@ public function testManifestSrc(): void $this->assertStringContainsString('manifest-src cdn.cloudy.com;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testPluginType(): void { $this->prepare(); @@ -285,10 +258,8 @@ public function testPluginType(): void $this->assertStringContainsString("plugin-types 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testPluginArray(): void { $this->prepare(); @@ -300,10 +271,8 @@ public function testPluginArray(): void $this->assertStringContainsString('plugin-types application/x-shockwave-flash application/wacky-hacky;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testObjectSrc(): void { $this->prepare(); @@ -317,10 +286,8 @@ public function testObjectSrc(): void $this->assertStringContainsString("object-src 'self' cdn.cloudy.com;", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testScriptSrc(): void { $this->prepare(); @@ -334,10 +301,8 @@ public function testScriptSrc(): void $this->assertStringContainsString("script-src 'self' cdn.cloudy.com;", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testStyleSrc(): void { $this->prepare(); @@ -351,10 +316,8 @@ public function testStyleSrc(): void $this->assertStringContainsString("style-src 'self' cdn.cloudy.com;", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testBaseURIDefault(): void { $this->prepare(); @@ -364,10 +327,8 @@ public function testBaseURIDefault(): void $this->assertStringContainsString("base-uri 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testBaseURI(): void { $this->prepare(); @@ -378,10 +339,8 @@ public function testBaseURI(): void $this->assertStringContainsString('base-uri example.com;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testBaseURIRich(): void { $this->prepare(); @@ -392,10 +351,8 @@ public function testBaseURIRich(): void $this->assertStringContainsString("base-uri 'self' example.com;", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testDefaultSrc(): void { $this->prepare(); @@ -408,10 +365,8 @@ public function testDefaultSrc(): void $this->assertStringContainsString('default-src iffy.com;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testReportURI(): void { $this->prepare(); @@ -423,10 +378,8 @@ public function testReportURI(): void $this->assertStringContainsString('report-uri http://example.com/csptracker;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSandboxFlags(): void { $this->prepare(); @@ -439,10 +392,8 @@ public function testSandboxFlags(): void $this->assertStringContainsString('sandbox allow-popups allow-top-navigation;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testUpgradeInsecureRequests(): void { $this->prepare(); @@ -453,10 +404,8 @@ public function testUpgradeInsecureRequests(): void $this->assertStringContainsString('upgrade-insecure-requests;', $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testBodyEmpty(): void { $this->prepare(); @@ -466,10 +415,8 @@ public function testBodyEmpty(): void $this->assertSame($body, $this->response->getBody()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testBodyScriptNonce(): void { $this->prepare(); @@ -543,10 +490,8 @@ public function testBodyStyleNonceDisableAutoNonce(): void $result->assertHeader('Content-Security-Policy'); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testBodyStyleNonce(): void { $this->prepare(); @@ -582,10 +527,8 @@ public function testBodyStyleNonceCustomStyleTag(): void $this->assertStringContainsString('nonce=', $response->getBody()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testHeaderWrongCaseNotFound(): void { $this->prepare(); @@ -595,10 +538,8 @@ public function testHeaderWrongCaseNotFound(): void $this->assertNull($result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testHeaderIgnoreCase(): void { $this->prepare(); @@ -608,10 +549,8 @@ public function testHeaderIgnoreCase(): void $this->assertStringContainsString("base-uri 'self';", $result); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testCSPDisabled(): void { $this->prepare(false); @@ -639,10 +578,8 @@ public function testGetStyleNonce(): void $this->assertMatchesRegularExpression('/\A[0-9a-z]{24}\z/', $nonce); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testHeaderScriptNonceEmittedOnceGetScriptNonceCalled(): void { $this->prepare(); diff --git a/tests/system/HTTP/CorsTest.php b/tests/system/HTTP/CorsTest.php index 8b15fb8d4c83..dac9aaa000af 100644 --- a/tests/system/HTTP/CorsTest.php +++ b/tests/system/HTTP/CorsTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CorsTest extends CIUnitTestCase { /** diff --git a/tests/system/HTTP/DownloadResponseTest.php b/tests/system/HTTP/DownloadResponseTest.php index b1071e39dc01..1ee24ed58692 100644 --- a/tests/system/HTTP/DownloadResponseTest.php +++ b/tests/system/HTTP/DownloadResponseTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class DownloadResponseTest extends CIUnitTestCase { protected function setUp(): void @@ -317,10 +316,8 @@ public function testPretendOutput(): void $this->assertSame(file_get_contents(__FILE__), $actual); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testRealOutput(): void { $response = new DownloadResponse('unit-test.php', false); diff --git a/tests/system/HTTP/Files/FileCollectionTest.php b/tests/system/HTTP/Files/FileCollectionTest.php index 3b565156aa6b..b2e026ac2374 100644 --- a/tests/system/HTTP/Files/FileCollectionTest.php +++ b/tests/system/HTTP/Files/FileCollectionTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileCollectionTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index df79faa1a15f..1eb476e67222 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileMovingTest extends CIUnitTestCase { private ?vfsStreamDirectory $root; diff --git a/tests/system/HTTP/HeaderTest.php b/tests/system/HTTP/HeaderTest.php index 910c04923566..f07ce98ca49f 100644 --- a/tests/system/HTTP/HeaderTest.php +++ b/tests/system/HTTP/HeaderTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class HeaderTest extends CIUnitTestCase { public function testHeaderStoresBasics(): void diff --git a/tests/system/HTTP/IncomingRequestDetectingTest.php b/tests/system/HTTP/IncomingRequestDetectingTest.php index 6f52bcc1baf4..85e948a8240f 100644 --- a/tests/system/HTTP/IncomingRequestDetectingTest.php +++ b/tests/system/HTTP/IncomingRequestDetectingTest.php @@ -17,12 +17,10 @@ use Config\App; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class IncomingRequestDetectingTest extends CIUnitTestCase { private IncomingRequest $request; diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index e0d827523405..da4e55d4ca5f 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -24,12 +24,10 @@ use TypeError; /** - * @backupGlobals enabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class IncomingRequestTest extends CIUnitTestCase { private Request $request; @@ -144,10 +142,9 @@ public function testCanGetOldInputArrayWithSESSION(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492 - * - * @runInSeparateProcess - * @preserveGlobalState disabled */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testCanGetOldInputArrayWithSessionService(): void { $locations = [ @@ -659,14 +656,13 @@ public static function provideCanGrabGetRawInputVar(): iterable } /** - * @dataProvider provideCanGrabGetRawInputVar - * * @param string $rawstring * @param mixed $var * @param mixed $expected * @param mixed $filter * @param mixed $flag */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideCanGrabGetRawInputVar')] public function testCanGrabGetRawInputVar($rawstring, $var, $expected, $filter, $flag): void { $config = new App(); @@ -677,9 +673,7 @@ public function testCanGrabGetRawInputVar($rawstring, $var, $expected, $filter, $this->assertSame($expected, $request->getRawInputVar($var, $filter, $flag)); } - /** - * @dataProvider provideIsHTTPMethods - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideIsHTTPMethods')] public function testIsHTTPMethodLowerCase(string $value): void { $request = $this->request->withMethod($value); @@ -700,9 +694,7 @@ public static function provideIsHTTPMethods(): iterable ]; } - /** - * @dataProvider provideIsHTTPMethods - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideIsHTTPMethods')] public function testIsHTTPMethodUpperCase(string $value): void { $request = $this->request->withMethod($value); @@ -922,11 +914,10 @@ public static function provideExtensionPHP(): iterable } /** - * @dataProvider provideExtensionPHP - * * @param mixed $path * @param mixed $detectPath */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideExtensionPHP')] public function testExtensionPHP($path, $detectPath): void { $config = new App(); diff --git a/tests/system/HTTP/MessageTest.php b/tests/system/HTTP/MessageTest.php index c91b8ab9255f..2359f5cf8c68 100644 --- a/tests/system/HTTP/MessageTest.php +++ b/tests/system/HTTP/MessageTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class MessageTest extends CIUnitTestCase { private ?Message $message; @@ -208,10 +207,9 @@ public static function provideArrayHeaderValue(): iterable } /** - * @dataProvider provideArrayHeaderValue - * * @param array $arrayHeaderValue */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayHeaderValue')] public function testSetHeaderWithExistingArrayValuesAppendStringValue($arrayHeaderValue): void { $this->message->setHeader('Accept', $arrayHeaderValue); @@ -221,10 +219,9 @@ public function testSetHeaderWithExistingArrayValuesAppendStringValue($arrayHead } /** - * @dataProvider provideArrayHeaderValue - * * @param array $arrayHeaderValue */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayHeaderValue')] public function testSetHeaderWithExistingArrayValuesAppendArrayValue($arrayHeaderValue): void { $this->message->setHeader('Accept', $arrayHeaderValue); diff --git a/tests/system/HTTP/NegotiateTest.php b/tests/system/HTTP/NegotiateTest.php index 8ace30f86aaa..ed7ee482c369 100644 --- a/tests/system/HTTP/NegotiateTest.php +++ b/tests/system/HTTP/NegotiateTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class NegotiateTest extends CIUnitTestCase { private ?IncomingRequest $request; diff --git a/tests/system/HTTP/OutgoingRequestTest.php b/tests/system/HTTP/OutgoingRequestTest.php index 123f4acc706b..bc1e8b58f13e 100644 --- a/tests/system/HTTP/OutgoingRequestTest.php +++ b/tests/system/HTTP/OutgoingRequestTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class OutgoingRequestTest extends CIUnitTestCase { public function testCreateWithHeader(): void diff --git a/tests/system/HTTP/RedirectExceptionTest.php b/tests/system/HTTP/RedirectExceptionTest.php index e7e01f539650..afa7ca278a5d 100644 --- a/tests/system/HTTP/RedirectExceptionTest.php +++ b/tests/system/HTTP/RedirectExceptionTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RedirectExceptionTest extends TestCase { protected function setUp(): void diff --git a/tests/system/HTTP/RedirectResponseTest.php b/tests/system/HTTP/RedirectResponseTest.php index 4abc965d59da..c31295415abb 100644 --- a/tests/system/HTTP/RedirectResponseTest.php +++ b/tests/system/HTTP/RedirectResponseTest.php @@ -26,9 +26,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class RedirectResponseTest extends CIUnitTestCase { /** @@ -129,10 +128,8 @@ public function testRedirectRelativeConvertsToFullURI(): void $this->assertSame('http://example.com/index.php/foo', $response->getHeaderLine('Location')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testWithInput(): void { $_SESSION = []; @@ -149,10 +146,8 @@ public function testWithInput(): void $this->assertSame('baz', $_SESSION['_ci_old_input']['post']['bar']); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testWithValidationErrors(): void { $_SESSION = []; @@ -169,10 +164,8 @@ public function testWithValidationErrors(): void $this->assertArrayHasKey('_ci_validation_errors', $_SESSION); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testWith(): void { $_SESSION = []; @@ -185,10 +178,8 @@ public function testWith(): void $this->assertArrayHasKey('foo', $_SESSION); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testRedirectBack(): void { $_SERVER['HTTP_REFERER'] = 'http://somewhere.com'; @@ -202,10 +193,8 @@ public function testRedirectBack(): void $this->assertSame('http://somewhere.com', $returned->header('location')->getValue()); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testRedirectBackMissing(): void { $_SESSION = []; @@ -218,11 +207,10 @@ public function testRedirectBackMissing(): void } /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * * @see https://github.com/codeigniter4/CodeIgniter4/issues/2119 */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testRedirectRouteBaseUrl(): void { $config = new App(); @@ -258,10 +246,8 @@ public function testWithCookies(): void $this->assertTrue($response->hasCookie('foo', 'bar')); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testWithCookiesWithEmptyCookies(): void { $_SESSION = []; diff --git a/tests/system/HTTP/RequestTest.php b/tests/system/HTTP/RequestTest.php index aea3f56b140f..f0298aaa30e2 100644 --- a/tests/system/HTTP/RequestTest.php +++ b/tests/system/HTTP/RequestTest.php @@ -18,12 +18,10 @@ use Config\App; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RequestTest extends CIUnitTestCase { private Request $request; diff --git a/tests/system/HTTP/ResponseCookieTest.php b/tests/system/HTTP/ResponseCookieTest.php index 6f5f039a1983..a220e3678395 100644 --- a/tests/system/HTTP/ResponseCookieTest.php +++ b/tests/system/HTTP/ResponseCookieTest.php @@ -23,9 +23,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ResponseCookieTest extends CIUnitTestCase { private array $defaults; diff --git a/tests/system/HTTP/ResponseSendTest.php b/tests/system/HTTP/ResponseSendTest.php index 6159ee1140ba..beee6886371c 100644 --- a/tests/system/HTTP/ResponseSendTest.php +++ b/tests/system/HTTP/ResponseSendTest.php @@ -25,9 +25,8 @@ * test cases need to be run as separate processes. * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class ResponseSendTest extends CIUnitTestCase { /** @@ -43,11 +42,8 @@ final class ResponseSendTest extends CIUnitTestCase * The tests includes a basic sanity check, to make sure that * the body we thought would be sent actually was. */ - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testHeadersMissingDate(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -81,10 +77,9 @@ public function testHeadersMissingDate(): void /** * This test does not test that CSP is handled properly - * it makes sure that sending gives CSP a chance to do its thing. - * - * @runInSeparateProcess - * @preserveGlobalState disabled */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testHeadersWithCSP(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -121,10 +116,9 @@ public function testHeadersWithCSP(): void * Make sure cookies are set by RedirectResponse this way * * @see https://github.com/codeigniter4/CodeIgniter4/issues/1393 - * - * @runInSeparateProcess - * @preserveGlobalState disabled */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testRedirectResponseCookies(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index f8de63d1f1b0..bba85116f12c 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ResponseTest extends CIUnitTestCase { private array $server; @@ -270,9 +269,7 @@ public function testRedirectSetsDefaultCodeAndLocationHeader(): void $this->assertSame(302, $response->getStatusCode()); } - /** - * @dataProvider provideRedirect - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRedirect')] public function testRedirect( string $server, string $protocol, @@ -316,9 +313,7 @@ public static function provideRedirect(): iterable ]; } - /** - * @dataProvider provideRedirectWithIIS - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRedirectWithIIS')] public function testRedirectWithIIS( string $protocol, string $method, diff --git a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php index f6386b858165..3f84409d3dcf 100644 --- a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php +++ b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php @@ -18,12 +18,10 @@ use Config\App; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SiteURIFactoryDetectRoutePathTest extends CIUnitTestCase { protected function setUp(): void @@ -280,11 +278,10 @@ public function testPathInfoSubfolder(): void } /** - * @dataProvider provideExtensionPHP - * * @param string $path * @param string $detectPath */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideExtensionPHP')] public function testExtensionPHP($path, $detectPath): void { $config = new App(); diff --git a/tests/system/HTTP/SiteURIFactoryTest.php b/tests/system/HTTP/SiteURIFactoryTest.php index 9b0a55d20b5f..2203e3453b09 100644 --- a/tests/system/HTTP/SiteURIFactoryTest.php +++ b/tests/system/HTTP/SiteURIFactoryTest.php @@ -18,12 +18,10 @@ use Config\App; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SiteURIFactoryTest extends CIUnitTestCase { protected function setUp(): void @@ -87,9 +85,7 @@ public function testCreateFromGlobalsAllowedHost(): void $this->assertSame('woot', $uri->getRoutePath()); } - /** - * @dataProvider provideCreateFromStringWithIndexPage - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideCreateFromStringWithIndexPage')] public function testCreateFromStringWithIndexPage( string $uriString, string $expectUriString, @@ -130,9 +126,7 @@ public static function provideCreateFromStringWithIndexPage(): iterable ]; } - /** - * @dataProvider provideCreateFromStringWithoutIndexPage - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideCreateFromStringWithoutIndexPage')] public function testCreateFromStringWithoutIndexPage( string $uriString, string $expectUriString, diff --git a/tests/system/HTTP/SiteURITest.php b/tests/system/HTTP/SiteURITest.php index 80deeddc2879..b8cac4d7058f 100644 --- a/tests/system/HTTP/SiteURITest.php +++ b/tests/system/HTTP/SiteURITest.php @@ -20,17 +20,13 @@ use Config\App; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SiteURITest extends CIUnitTestCase { - /** - * @dataProvider provideConstructor - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideConstructor')] public function testConstructor( string $baseURL, string $indexPage, @@ -327,9 +323,7 @@ public function testConstructorInvalidBaseURL(): void new SiteURI($config); } - /** - * @dataProvider provideSetPath - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSetPath')] public function testSetPath( string $baseURL, string $indexPage, diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 0211d6d2e1f9..9b5f7ba1d32f 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -20,12 +20,10 @@ use Config\App; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class URITest extends CIUnitTestCase { public function testConstructorSetsAllParts(): void @@ -127,9 +125,7 @@ public function testCanCastAsString(): void $this->assertSame($expected, (string) $uri); } - /** - * @dataProvider provideSimpleUri - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSimpleUri')] public function testSimpleUri(string $url, string $expectedURL, string $expectedPath): void { $uri = new URI($url); @@ -401,9 +397,7 @@ public function testSetPathSetsValue(): void $this->assertSame($expected, (string) $uri); } - /** - * @dataProvider provideSetPath - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSetPath')] public function testSetPath(string $path, string $expectedURL, string $expectedPath): void { $url = 'http://example.com/'; @@ -514,11 +508,10 @@ public static function providePathGetsFiltered(): iterable } /** - * @dataProvider providePathGetsFiltered - * * @param string $path * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('providePathGetsFiltered')] public function testPathGetsFiltered($path, $expected): void { $uri = new URI(); @@ -630,11 +623,10 @@ public static function provideAuthorityReturnsExceptedValues(): iterable } /** - * @dataProvider provideAuthorityReturnsExceptedValues - * * @param string $url * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAuthorityReturnsExceptedValues')] public function testAuthorityReturnsExceptedValues($url, $expected): void { $uri = new URI($url); @@ -657,11 +649,10 @@ public static function provideAuthorityRemovesDefaultPorts(): iterable } /** - * @dataProvider provideAuthorityRemovesDefaultPorts - * * @param string $scheme * @param int $port */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAuthorityRemovesDefaultPorts')] public function testAuthorityRemovesDefaultPorts($scheme, $port): void { $url = "{$scheme}://example.com:{$port}/path"; @@ -780,11 +771,10 @@ public static function provideRemoveDotSegments(): iterable } /** - * @dataProvider provideRemoveDotSegments - * * @param string $path * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRemoveDotSegments')] public function testRemoveDotSegments($path, $expected): void { $this->assertSame($expected, URI::removeDotSegments($path)); @@ -821,11 +811,10 @@ public static function defaultResolutions(): iterable } /** - * @dataProvider defaultResolutions - * * @param string $rel * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('defaultResolutions')] public function testResolveRelativeURI($rel, $expected): void { $base = 'http://a/b/c/d'; @@ -837,11 +826,10 @@ public function testResolveRelativeURI($rel, $expected): void } /** - * @dataProvider defaultResolutions - * * @param string $rel * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('defaultResolutions')] public function testResolveRelativeURIHTTPS($rel, $expected): void { $base = 'https://a/b/c/d'; diff --git a/tests/system/HTTP/UserAgentTest.php b/tests/system/HTTP/UserAgentTest.php index 30d175b7ff55..2d03f8cae933 100644 --- a/tests/system/HTTP/UserAgentTest.php +++ b/tests/system/HTTP/UserAgentTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class UserAgentTest extends CIUnitTestCase { private string $_user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27'; diff --git a/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php b/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php index 602c4d0209d8..9332bcccf5b4 100644 --- a/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php +++ b/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php @@ -17,10 +17,9 @@ use InvalidArgumentException; /** - * @group Others - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ArrayHelperDotKeyExistsTest extends CIUnitTestCase { private array $array = [ diff --git a/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php b/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php index 7fed620641df..5d8c9fa3d42c 100644 --- a/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php +++ b/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php @@ -16,10 +16,9 @@ use CodeIgniter\Test\CIUnitTestCase; /** - * @group Others - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ArrayHelperRecursiveDiffTest extends CIUnitTestCase { private array $compareWith; diff --git a/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php b/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php index 861d6ede713f..314d406671ea 100644 --- a/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php +++ b/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php @@ -16,10 +16,9 @@ use CodeIgniter\Test\CIUnitTestCase; /** - * @group Others - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ArrayHelperSortValuesByNaturalTest extends CIUnitTestCase { private array $arrayWithStringValues = [ diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index c7beb0e405b4..5cb240c57fad 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ArrayHelperTest extends CIUnitTestCase { protected function setUp(): void @@ -210,11 +209,10 @@ public function testArrayDotIgnoresLastWildcard(): void } /** - * @dataProvider provideArrayDeepSearch - * * @param int|string $key * @param array|string|null $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayDeepSearch')] public function testArrayDeepSearch($key, $expected): void { $data = [ @@ -248,9 +246,7 @@ public function testArrayDeepSearchReturnNullEmptyArray(): void $this->assertNull(array_deep_search('key644', $data)); } - /** - * @dataProvider provideSortByMultipleKeys - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysWithArray(array $data, array $sortColumns, array $expected): void { $success = array_sort_by_multiple_keys($data, $sortColumns); @@ -259,9 +255,7 @@ public function testArraySortByMultipleKeysWithArray(array $data, array $sortCol $this->assertSame($expected, array_column($data, 'name')); } - /** - * @dataProvider provideSortByMultipleKeys - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysWithObjects(array $data, array $sortColumns, array $expected): void { // Morph to objects @@ -275,9 +269,7 @@ public function testArraySortByMultipleKeysWithObjects(array $data, array $sortC $this->assertSame($expected, array_column((array) $data, 'name')); } - /** - * @dataProvider provideSortByMultipleKeys - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysFailsEmptyParameter(array $data, array $sortColumns, array $expected): void { // Both filled @@ -298,10 +290,9 @@ public function testArraySortByMultipleKeysFailsEmptyParameter(array $data, arra } /** - * @dataProvider provideSortByMultipleKeys - * * @param mixed $data */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysFailsInconsistentArraySizes($data): void { $this->expectException(ValueError::class); @@ -394,9 +385,7 @@ public static function provideSortByMultipleKeys(): iterable ]; } - /** - * @dataProvider provideArrayFlattening - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayFlattening')] public function testArrayFlattening(array $input, array $expected): void { $this->assertSame($expected, array_flatten_with_dots($input)); @@ -494,9 +483,7 @@ public static function provideArrayFlattening(): iterable ]; } - /** - * @dataProvider provideArrayGroupByIncludeEmpty - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayGroupByIncludeEmpty')] public function testArrayGroupByIncludeEmpty(array $indexes, array $data, array $expected): void { $actual = array_group_by($data, $indexes, true); @@ -504,9 +491,7 @@ public function testArrayGroupByIncludeEmpty(array $indexes, array $data, array $this->assertSame($expected, $actual, 'array including empty not the same'); } - /** - * @dataProvider provideArrayGroupByExcludeEmpty - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayGroupByExcludeEmpty')] public function testArrayGroupByExcludeEmpty(array $indexes, array $data, array $expected): void { $actual = array_group_by($data, $indexes, false); diff --git a/tests/system/Helpers/CookieHelperTest.php b/tests/system/Helpers/CookieHelperTest.php index 8325104ca73a..40e02a808b1a 100755 --- a/tests/system/Helpers/CookieHelperTest.php +++ b/tests/system/Helpers/CookieHelperTest.php @@ -28,9 +28,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CookieHelperTest extends CIUnitTestCase { private IncomingRequest $request; diff --git a/tests/system/Helpers/DateHelperTest.php b/tests/system/Helpers/DateHelperTest.php index ef0d2afa939e..3ac268fbf264 100644 --- a/tests/system/Helpers/DateHelperTest.php +++ b/tests/system/Helpers/DateHelperTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DateHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 619f22f08938..4e7cbe7e1045 100644 --- a/tests/system/Helpers/FilesystemHelperTest.php +++ b/tests/system/Helpers/FilesystemHelperTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FilesystemHelperTest extends CIUnitTestCase { /** diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php index b623068943fe..cc9e16edb155 100644 --- a/tests/system/Helpers/FormHelperTest.php +++ b/tests/system/Helpers/FormHelperTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class FormHelperTest extends CIUnitTestCase { protected function setUp(): void @@ -953,10 +952,8 @@ public function testSetCheckboxWithUnchecked(): void ); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSetRadioFromSessionOldInput(): void { $_SESSION = [ @@ -973,10 +970,8 @@ public function testSetRadioFromSessionOldInput(): void unset($_SESSION['_ci_old_input']); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSetRadioFromPost(): void { $_POST['bar'] = 'baz'; @@ -986,10 +981,8 @@ public function testSetRadioFromPost(): void $this->assertSame('', set_radio('bar', 'boop', true)); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testSetRadioFromPostWithValueZero(): void { $_POST['bar'] = '0'; diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php index ecce00af6783..c66e4b3d0ff8 100755 --- a/tests/system/Helpers/HTMLHelperTest.php +++ b/tests/system/Helpers/HTMLHelperTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class HTMLHelperTest extends CIUnitTestCase { private array $tracks; diff --git a/tests/system/Helpers/InflectorHelperTest.php b/tests/system/Helpers/InflectorHelperTest.php index d6f07f59c4f0..a20d39f26f59 100755 --- a/tests/system/Helpers/InflectorHelperTest.php +++ b/tests/system/Helpers/InflectorHelperTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class InflectorHelperTest extends CIUnitTestCase { protected function setUp(): void @@ -261,9 +260,7 @@ public static function provideOrdinal(): iterable ]; } - /** - * @dataProvider provideOrdinal - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideOrdinal')] public function testOrdinal(string $suffix, int $number): void { $this->assertSame($suffix, ordinal($number)); diff --git a/tests/system/Helpers/NumberHelperTest.php b/tests/system/Helpers/NumberHelperTest.php index 8e410e121679..0a2f112dc9e2 100755 --- a/tests/system/Helpers/NumberHelperTest.php +++ b/tests/system/Helpers/NumberHelperTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class NumberHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Helpers/SecurityHelperTest.php b/tests/system/Helpers/SecurityHelperTest.php index 7a237b34fe1a..7d0821e7a572 100644 --- a/tests/system/Helpers/SecurityHelperTest.php +++ b/tests/system/Helpers/SecurityHelperTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SecurityHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Helpers/TextHelperTest.php b/tests/system/Helpers/TextHelperTest.php index 1cc4def05869..e32a8b2c0a8a 100755 --- a/tests/system/Helpers/TextHelperTest.php +++ b/tests/system/Helpers/TextHelperTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TextHelperTest extends CIUnitTestCase { private string $_long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; diff --git a/tests/system/Helpers/URLHelper/CurrentUrlTest.php b/tests/system/Helpers/URLHelper/CurrentUrlTest.php index ab5c5c381f49..77c6d85ae3c5 100644 --- a/tests/system/Helpers/URLHelper/CurrentUrlTest.php +++ b/tests/system/Helpers/URLHelper/CurrentUrlTest.php @@ -28,12 +28,10 @@ * that rely on the "current" URL. * Includes: current_url, uri_string, uri_is * - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CurrentUrlTest extends CIUnitTestCase { private App $config; @@ -282,9 +280,7 @@ public static function provideUrlIs(): iterable ]; } - /** - * @dataProvider provideUrlIs - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlIs')] public function testUrlIs(string $currentPath, string $testPath, bool $expected): void { $_SERVER['HTTP_HOST'] = 'example.com'; @@ -295,9 +291,7 @@ public function testUrlIs(string $currentPath, string $testPath, bool $expected) $this->assertSame($expected, url_is($testPath)); } - /** - * @dataProvider provideUrlIs - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlIs')] public function testUrlIsNoIndex(string $currentPath, string $testPath, bool $expected): void { $_SERVER['HTTP_HOST'] = 'example.com'; @@ -310,9 +304,7 @@ public function testUrlIsNoIndex(string $currentPath, string $testPath, bool $ex $this->assertSame($expected, url_is($testPath)); } - /** - * @dataProvider provideUrlIs - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlIs')] public function testUrlIsWithSubfolder(string $currentPath, string $testPath, bool $expected): void { $_SERVER['HTTP_HOST'] = 'example.com'; diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index 1a15bb4c1fac..4f3c47803ea4 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -25,12 +25,10 @@ use InvalidArgumentException; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class MiscUrlTest extends CIUnitTestCase { private App $config; @@ -55,12 +53,9 @@ protected function tearDown(): void $_SERVER = []; } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * - * @group SeparateProcess - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] public function testPreviousURLUsesSessionFirst(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -93,12 +88,9 @@ private function createRequest(string $uri): void Factories::injectMock('config', 'App', $this->config); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * - * @group SeparateProcess - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] public function testPreviousURLUsesRefererIfNeeded(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -183,13 +175,12 @@ public static function provideAnchor(): iterable } /** - * @dataProvider provideAnchor - * * @param mixed $expected * @param mixed $uri * @param mixed $title * @param mixed $attributes */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchor')] public function testAnchor($expected = '', $uri = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -248,13 +239,12 @@ public static function provideAnchorNoindex(): iterable } /** - * @dataProvider provideAnchorNoindex - * * @param mixed $expected * @param mixed $uri * @param mixed $title * @param mixed $attributes */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorNoindex')] public function testAnchorNoindex($expected = '', $uri = '', $title = '', $attributes = ''): void { $this->config->indexPage = ''; @@ -305,13 +295,12 @@ public static function provideAnchorTargetted(): iterable } /** - * @dataProvider provideAnchorTargetted - * * @param mixed $expected * @param mixed $uri * @param mixed $title * @param mixed $attributes */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorTargetted')] public function testAnchorTargetted($expected = '', $uri = '', $title = '', $attributes = ''): void { $this->config->indexPage = ''; @@ -351,13 +340,12 @@ public static function provideAnchorExamples(): iterable } /** - * @dataProvider provideAnchorExamples - * * @param mixed $expected * @param mixed $uri * @param mixed $title * @param mixed $attributes */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorExamples')] public function testAnchorExamples($expected = '', $uri = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -409,13 +397,12 @@ public static function provideAnchorPopup(): iterable } /** - * @dataProvider provideAnchorPopup - * * @param mixed $expected * @param mixed $uri * @param mixed $title * @param mixed $attributes */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorPopup')] public function testAnchorPopup($expected = '', $uri = '', $title = '', $attributes = false): void { $uriString = 'http://example.com/'; @@ -448,13 +435,12 @@ public static function provideMailto(): iterable } /** - * @dataProvider provideMailto - * * @param mixed $expected * @param mixed $email * @param mixed $title * @param mixed $attributes */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMailto')] public function testMailto($expected = '', $email = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -487,13 +473,12 @@ public static function provideSafeMailto(): iterable } /** - * @dataProvider provideSafeMailto - * * @param mixed $expected * @param mixed $email * @param mixed $title * @param mixed $attributes */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSafeMailto')] public function testSafeMailto($expected = '', $email = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -553,11 +538,10 @@ public static function provideAutoLinkUrl(): iterable } /** - * @dataProvider provideAutoLinkUrl - * * @param mixed $in * @param mixed $out */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAutoLinkUrl')] public function testAutoLinkUrl($in, $out): void { $this->assertSame($out, auto_link($in, 'url')); @@ -602,11 +586,10 @@ public static function provideAutoLinkEmail(): iterable } /** - * @dataProvider provideAutoLinkEmail - * * @param mixed $in * @param mixed $out */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAutoLinkEmail')] public function testAutoLinkEmail($in, $out): void { $this->assertSame($out, auto_link($in, 'email')); @@ -651,11 +634,10 @@ public static function provideAutolinkBoth(): iterable } /** - * @dataProvider provideAutolinkBoth - * * @param mixed $in * @param mixed $out */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAutolinkBoth')] public function testAutolinkBoth($in, $out): void { $this->assertSame($out, auto_link($in)); @@ -700,11 +682,10 @@ public static function provideAutoLinkPopup(): iterable } /** - * @dataProvider provideAutoLinkPopup - * * @param mixed $in * @param mixed $out */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAutoLinkPopup')] public function testAutoLinkPopup($in, $out): void { $this->assertSame($out, auto_link($in, 'url', true)); @@ -789,9 +770,7 @@ public static function providePrepUrl(): iterable ]; } - /** - * @dataProvider providePrepUrl - */ + #[\PHPUnit\Framework\Attributes\DataProvider('providePrepUrl')] public function testPrepUrl(string $input, string $expected, bool $secure): void { $this->assertSame($expected, prep_url($input, $secure)); @@ -855,9 +834,7 @@ public function testMbUrlTitleExtraDashes(): void } } - /** - * @dataProvider provideUrlTo - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlTo')] public function testUrlTo(string $expected, string $input, ...$args): void { $_SERVER['HTTP_HOST'] = 'example.com'; @@ -871,9 +848,7 @@ public function testUrlTo(string $expected, string $input, ...$args): void $this->assertSame($expected, url_to($input, ...$args)); } - /** - * @dataProvider provideUrlToThrowsOnEmptyOrMissingRoute - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlToThrowsOnEmptyOrMissingRoute')] public function testUrlToThrowsOnEmptyOrMissingRoute(string $route): void { $this->expectException(RouterException::class); diff --git a/tests/system/Helpers/URLHelper/SiteUrlCliTest.php b/tests/system/Helpers/URLHelper/SiteUrlCliTest.php index 526d2250f2c7..0bd9a0d5f720 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlCliTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlCliTest.php @@ -24,12 +24,10 @@ * site_url() these functions are tested * simultaneously. * - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SiteUrlCliTest extends CIUnitTestCase { private App $config; @@ -71,9 +69,8 @@ private function createRequest(?App $config = null): void * @param string $path * @param string $expectedSiteUrl * @param string $expectedBaseUrl - * - * @dataProvider provideUrls */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUrls')] public function testUrls( $baseURL, $indexPage, diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index 41c1cfc7974b..8bf26f67d7e0 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -27,12 +27,10 @@ * site_url() these functions are tested * simultaneously. * - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SiteUrlTest extends CIUnitTestCase { private App $config; @@ -81,9 +79,8 @@ private function createRequest(?App $config = null, $body = null, ?string $path * @param string $path * @param string $expectedSiteUrl * @param string $expectedBaseUrl - * - * @dataProvider provideUrls */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUrls')] public function testUrls( $baseURL, $indexPage, diff --git a/tests/system/Helpers/XMLHelperTest.php b/tests/system/Helpers/XMLHelperTest.php index c508c9f95905..af1852a32b12 100644 --- a/tests/system/Helpers/XMLHelperTest.php +++ b/tests/system/Helpers/XMLHelperTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class XMLHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/HomeTest.php b/tests/system/HomeTest.php index b620335f2cca..4347beb2ca8f 100644 --- a/tests/system/HomeTest.php +++ b/tests/system/HomeTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class HomeTest extends CIUnitTestCase { use FeatureTestTrait; diff --git a/tests/system/Honeypot/HoneypotTest.php b/tests/system/Honeypot/HoneypotTest.php index c243645d905b..30128b8d03f7 100644 --- a/tests/system/Honeypot/HoneypotTest.php +++ b/tests/system/Honeypot/HoneypotTest.php @@ -25,12 +25,10 @@ use Config\Honeypot as HoneypotConfig; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class HoneypotTest extends CIUnitTestCase { private HoneypotConfig $config; diff --git a/tests/system/HotReloader/DirectoryHasherTest.php b/tests/system/HotReloader/DirectoryHasherTest.php index 4df7e69fd924..31d65a819376 100644 --- a/tests/system/HotReloader/DirectoryHasherTest.php +++ b/tests/system/HotReloader/DirectoryHasherTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DirectoryHasherTest extends CIUnitTestCase { private DirectoryHasher $hasher; diff --git a/tests/system/I18n/TimeDifferenceTest.php b/tests/system/I18n/TimeDifferenceTest.php index e1b242fc72c5..bb45a2388b9a 100644 --- a/tests/system/I18n/TimeDifferenceTest.php +++ b/tests/system/I18n/TimeDifferenceTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TimeDifferenceTest extends CIUnitTestCase { private string $currentLocale; diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index f966e3750ce9..20857cd633cf 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TimeLegacyTest extends CIUnitTestCase { private string $currentLocale; @@ -1152,9 +1151,7 @@ public function testSetTestNowWithFaLocale(): void $this->assertSame('2017-03-10T12:00:00+09:00', $now); } - /** - * @dataProvider provideToStringDoesNotDependOnLocale - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideToStringDoesNotDependOnLocale')] public function testToStringDoesNotDependOnLocale(string $locale): void { Locale::setDefault($locale); diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index 8e85e8cff3e3..d4bdaba8f349 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TimeTest extends CIUnitTestCase { private string $currentLocale; @@ -1168,9 +1167,7 @@ public function testSetTestNowWithFaLocale(): void $this->assertSame('2017-03-10T12:00:00+09:00', $now); } - /** - * @dataProvider provideToStringDoesNotDependOnLocale - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideToStringDoesNotDependOnLocale')] public function testToStringDoesNotDependOnLocale(string $locale): void { Locale::setDefault($locale); diff --git a/tests/system/Images/BaseHandlerTest.php b/tests/system/Images/BaseHandlerTest.php index bcaf035ed30e..b6fe8c0b4ac7 100644 --- a/tests/system/Images/BaseHandlerTest.php +++ b/tests/system/Images/BaseHandlerTest.php @@ -30,9 +30,8 @@ * testing saving only. * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class BaseHandlerTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Images/GDHandlerTest.php b/tests/system/Images/GDHandlerTest.php index 5d39a3c93fd2..15df5d13bc1e 100644 --- a/tests/system/Images/GDHandlerTest.php +++ b/tests/system/Images/GDHandlerTest.php @@ -30,9 +30,8 @@ * Was unable to test fontPath & related logic. * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class GDHandlerTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Images/ImageMagickHandlerTest.php b/tests/system/Images/ImageMagickHandlerTest.php index 2edc1c60e714..e9a04d2eafc5 100644 --- a/tests/system/Images/ImageMagickHandlerTest.php +++ b/tests/system/Images/ImageMagickHandlerTest.php @@ -31,11 +31,9 @@ * Was unable to test fontPath & related logic. * * @internal - * - * @group Others - * - * @requires extension imagick */ +#[\PHPUnit\Framework\Attributes\Group('Others')] +#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('imagick')] final class ImageMagickHandlerTest extends CIUnitTestCase { private string $root; @@ -80,9 +78,7 @@ protected function setUp(): void $this->handler = Services::image('imagick', $config, false); } - /** - * @dataProvider provideNonexistentLibraryPathTerminatesProcessing - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideNonexistentLibraryPathTerminatesProcessing')] public function testNonexistentLibraryPathTerminatesProcessing(string $path, string $invalidPath): void { $this->expectException(ImageException::class); diff --git a/tests/system/Images/ImageTest.php b/tests/system/Images/ImageTest.php index c3c4b119a6fb..d9b4418e3bd0 100644 --- a/tests/system/Images/ImageTest.php +++ b/tests/system/Images/ImageTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ImageTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index b318d28fc19a..1dbb239f662b 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class LanguageTest extends CIUnitTestCase { private Language $lang; @@ -266,10 +265,9 @@ public static function provideBundleUniqueKeys(): iterable * There's not a whole lot that can be done with message bundles, * but we can at least try loading them ... more accurate code coverage? * - * @dataProvider provideBundleUniqueKeys - * * @param mixed $bundle */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideBundleUniqueKeys')] public function testBundleUniqueKeys($bundle): void { $messages = require SYSTEMPATH . 'Language/en/' . $bundle . '.php'; diff --git a/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php b/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php index 228e358e3ba1..c3f37654a55b 100644 --- a/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php +++ b/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ChromeLoggerHandlerTest extends CIUnitTestCase { public function testCanHandleLogLevel(): void diff --git a/tests/system/Log/Handlers/ErrorlogHandlerTest.php b/tests/system/Log/Handlers/ErrorlogHandlerTest.php index cde1c2e983c8..052aeabb2611 100644 --- a/tests/system/Log/Handlers/ErrorlogHandlerTest.php +++ b/tests/system/Log/Handlers/ErrorlogHandlerTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ErrorlogHandlerTest extends CIUnitTestCase { public function testHandlerThrowsOnInvalidMessageType(): void diff --git a/tests/system/Log/Handlers/FileHandlerTest.php b/tests/system/Log/Handlers/FileHandlerTest.php index 3b3ee9c53b56..25c323d9332e 100644 --- a/tests/system/Log/Handlers/FileHandlerTest.php +++ b/tests/system/Log/Handlers/FileHandlerTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileHandlerTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Log/LoggerTest.php b/tests/system/Log/LoggerTest.php index e76e60cbd4c3..0611fe532649 100644 --- a/tests/system/Log/LoggerTest.php +++ b/tests/system/Log/LoggerTest.php @@ -24,9 +24,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class LoggerTest extends CIUnitTestCase { protected function tearDown(): void diff --git a/tests/system/Models/AffectedRowsTest.php b/tests/system/Models/AffectedRowsTest.php index 9c7d60267ebc..07da816981a0 100644 --- a/tests/system/Models/AffectedRowsTest.php +++ b/tests/system/Models/AffectedRowsTest.php @@ -16,10 +16,9 @@ use Tests\Support\Models\UserModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class AffectedRowsTest extends LiveModelTestCase { /** diff --git a/tests/system/Models/CountAllModelTest.php b/tests/system/Models/CountAllModelTest.php index 836a6e08a13f..8a3a3af617ca 100644 --- a/tests/system/Models/CountAllModelTest.php +++ b/tests/system/Models/CountAllModelTest.php @@ -16,10 +16,9 @@ use Tests\Support\Models\UserModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class CountAllModelTest extends LiveModelTestCase { /** diff --git a/tests/system/Models/DataConverterModelTest.php b/tests/system/Models/DataConverterModelTest.php index c22fa39b5050..ce404ab21e02 100644 --- a/tests/system/Models/DataConverterModelTest.php +++ b/tests/system/Models/DataConverterModelTest.php @@ -19,10 +19,9 @@ use Tests\Support\Models\UserCastsTimestampModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DataConverterModelTest extends LiveModelTestCase { protected $migrate = true; diff --git a/tests/system/Models/DeleteModelTest.php b/tests/system/Models/DeleteModelTest.php index bd2af1f4ad0d..a8e36ee1bb08 100644 --- a/tests/system/Models/DeleteModelTest.php +++ b/tests/system/Models/DeleteModelTest.php @@ -20,10 +20,9 @@ use Tests\Support\Models\UserModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DeleteModelTest extends LiveModelTestCase { public function testDeleteBasics(): void @@ -154,10 +153,9 @@ public function testOnlyDeleted(): void * When executing a soft delete * Then an exception should not be thrown * - * @dataProvider emptyPkValues - * * @param int|string|null $emptyValue */ + #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] public function testDontThrowExceptionWhenSoftDeleteConditionIsSetWithEmptyValue($emptyValue): void { $this->createModel(UserModel::class); @@ -168,10 +166,9 @@ public function testDontThrowExceptionWhenSoftDeleteConditionIsSetWithEmptyValue } /** - * @dataProvider emptyPkValues - * * @param int|string|null $emptyValue */ + #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] public function testThrowExceptionWhenSoftDeleteParamIsEmptyValue($emptyValue): void { $this->expectException(DatabaseException::class); @@ -183,10 +180,9 @@ public function testThrowExceptionWhenSoftDeleteParamIsEmptyValue($emptyValue): } /** - * @dataProvider emptyPkValues - * * @param int|string|null $emptyValue */ + #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] public function testDontDeleteRowsWhenSoftDeleteParamIsEmpty($emptyValue): void { $this->seeInDatabase('user', ['name' => 'Derek Jones', 'deleted_at IS NULL' => null]); @@ -243,10 +239,9 @@ public function testPurgeDeletedWithSoftDeleteFalse(): void } /** - * @dataProvider emptyPkValues - * * @param int|string|null $id */ + #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] public function testDeleteThrowDatabaseExceptionWithoutWhereClause($id): void { // BaseBuilder throws Exception. @@ -262,10 +257,9 @@ public function testDeleteThrowDatabaseExceptionWithoutWhereClause($id): void } /** - * @dataProvider emptyPkValues - * * @param int|string|null $id */ + #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] public function testDeleteWithSoftDeleteThrowDatabaseExceptionWithoutWhereClause($id): void { // Model throws Exception. diff --git a/tests/system/Models/EventsModelTest.php b/tests/system/Models/EventsModelTest.php index 52130f73f9f8..2ec66e73228f 100644 --- a/tests/system/Models/EventsModelTest.php +++ b/tests/system/Models/EventsModelTest.php @@ -17,10 +17,9 @@ use Tests\Support\Models\EventModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class EventsModelTest extends LiveModelTestCase { /** diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index b0b835bc1067..6ec8452ac95f 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -22,10 +22,9 @@ use Tests\Support\Models\UserModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class FindModelTest extends LiveModelTestCase { public function testFindReturnsRow(): void @@ -179,11 +178,10 @@ public function testFirst(): void } /** - * @dataProvider provideFirstAggregate - * * @param mixed $groupBy * @param mixed $total */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideFirstAggregate')] public function testFirstAggregate($groupBy, $total): void { $this->createModel(UserModel::class); @@ -215,11 +213,10 @@ public static function provideFirstAggregate(): iterable } /** - * @dataProvider provideAggregateAndGroupBy - * * @param mixed $aggregate * @param mixed $groupBy */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAggregateAndGroupBy')] public function testFirstRespectsSoftDeletes($aggregate, $groupBy): void { $this->db->table('user') @@ -261,11 +258,10 @@ public function testFirstRespectsSoftDeletes($aggregate, $groupBy): void } /** - * @dataProvider provideAggregateAndGroupBy - * * @param mixed $aggregate * @param mixed $groupBy */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAggregateAndGroupBy')] public function testFirstRecoverTempUseSoftDeletes($aggregate, $groupBy): void { $this->createModel(UserModel::class); diff --git a/tests/system/Models/GeneralModelTest.php b/tests/system/Models/GeneralModelTest.php index b119e6f1550b..7f04b7add02a 100644 --- a/tests/system/Models/GeneralModelTest.php +++ b/tests/system/Models/GeneralModelTest.php @@ -25,9 +25,8 @@ * features without requiring a database connection. * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class GeneralModelTest extends CIUnitTestCase { /** diff --git a/tests/system/Models/GetCompiledModelTest.php b/tests/system/Models/GetCompiledModelTest.php index fd12cc880065..c495ba75b55b 100644 --- a/tests/system/Models/GetCompiledModelTest.php +++ b/tests/system/Models/GetCompiledModelTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class GetCompiledModelTest extends CIUnitTestCase { private ?object $model = null; diff --git a/tests/system/Models/InsertModelTest.php b/tests/system/Models/InsertModelTest.php index 25e844dd5cb0..6b00ba1260a1 100644 --- a/tests/system/Models/InsertModelTest.php +++ b/tests/system/Models/InsertModelTest.php @@ -26,10 +26,9 @@ use Tests\Support\Models\WithoutAutoIncrementModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class InsertModelTest extends LiveModelTestCase { public function testSetWorksWithInsert(): void diff --git a/tests/system/Models/MiscellaneousModelTest.php b/tests/system/Models/MiscellaneousModelTest.php index 83b72cd13d78..4388e691463a 100644 --- a/tests/system/Models/MiscellaneousModelTest.php +++ b/tests/system/Models/MiscellaneousModelTest.php @@ -22,10 +22,9 @@ use Tests\Support\Models\ValidModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class MiscellaneousModelTest extends LiveModelTestCase { public function testChunk(): void diff --git a/tests/system/Models/PaginateModelTest.php b/tests/system/Models/PaginateModelTest.php index 570a53b5792a..b6fa8e27e845 100644 --- a/tests/system/Models/PaginateModelTest.php +++ b/tests/system/Models/PaginateModelTest.php @@ -17,10 +17,9 @@ use Tests\Support\Models\ValidModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class PaginateModelTest extends LiveModelTestCase { public function testPaginate(): void diff --git a/tests/system/Models/ReplaceModelTest.php b/tests/system/Models/ReplaceModelTest.php index 59780cce3eef..35ae1b207da7 100644 --- a/tests/system/Models/ReplaceModelTest.php +++ b/tests/system/Models/ReplaceModelTest.php @@ -16,10 +16,9 @@ use Tests\Support\Models\UserModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ReplaceModelTest extends LiveModelTestCase { public function testReplaceRespectsUseTimestamps(): void diff --git a/tests/system/Models/SaveModelTest.php b/tests/system/Models/SaveModelTest.php index e4a012803067..a3186a470f74 100644 --- a/tests/system/Models/SaveModelTest.php +++ b/tests/system/Models/SaveModelTest.php @@ -26,10 +26,9 @@ use Tests\Support\Models\WithoutAutoIncrementModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class SaveModelTest extends LiveModelTestCase { public function testSaveNewRecordObject(): void diff --git a/tests/system/Models/TimestampModelTest.php b/tests/system/Models/TimestampModelTest.php index 7d27d18800d5..d99ab50bfc9c 100644 --- a/tests/system/Models/TimestampModelTest.php +++ b/tests/system/Models/TimestampModelTest.php @@ -18,10 +18,9 @@ use Tests\Support\Models\UserTimestampModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class TimestampModelTest extends LiveModelTestCase { protected $migrate = true; diff --git a/tests/system/Models/UpdateModelTest.php b/tests/system/Models/UpdateModelTest.php index 866fc4b8661e..3296a2a211ef 100644 --- a/tests/system/Models/UpdateModelTest.php +++ b/tests/system/Models/UpdateModelTest.php @@ -31,10 +31,9 @@ use Tests\Support\Models\WithoutAutoIncrementModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class UpdateModelTest extends LiveModelTestCase { public function testSetWorksWithUpdate(): void @@ -552,10 +551,9 @@ public function testUpdateWithSetAndEscape(): void } /** - * @dataProvider provideUpdateThrowDatabaseExceptionWithoutWhereClause - * * @param false|null $id */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideUpdateThrowDatabaseExceptionWithoutWhereClause')] public function testUpdateThrowDatabaseExceptionWithoutWhereClause($id, string $exception, string $exceptionMessage): void { $this->expectException($exception); diff --git a/tests/system/Models/ValidationModelRuleGroupTest.php b/tests/system/Models/ValidationModelRuleGroupTest.php index e1de82841832..2a7a7b75258d 100644 --- a/tests/system/Models/ValidationModelRuleGroupTest.php +++ b/tests/system/Models/ValidationModelRuleGroupTest.php @@ -24,10 +24,9 @@ use Tests\Support\Models\ValidModelRuleGroup; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ValidationModelRuleGroupTest extends LiveModelTestCase { protected function setUp(): void diff --git a/tests/system/Models/ValidationModelTest.php b/tests/system/Models/ValidationModelTest.php index 99780faeba73..753c437250cd 100644 --- a/tests/system/Models/ValidationModelTest.php +++ b/tests/system/Models/ValidationModelTest.php @@ -23,10 +23,9 @@ use Tests\Support\Models\ValidModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class ValidationModelTest extends LiveModelTestCase { protected function setUp(): void diff --git a/tests/system/Models/WhenWhenNotModelTest.php b/tests/system/Models/WhenWhenNotModelTest.php index 3039fc0b57b5..61bf3f375216 100644 --- a/tests/system/Models/WhenWhenNotModelTest.php +++ b/tests/system/Models/WhenWhenNotModelTest.php @@ -16,10 +16,9 @@ use Tests\Support\Models\SecondaryModel; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class WhenWhenNotModelTest extends LiveModelTestCase { public function testWhenWithTrueCondition(): void diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index f35f30a361d2..795401ecb71d 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PagerRendererTest extends CIUnitTestCase { private string $expect; diff --git a/tests/system/Pager/PagerTest.php b/tests/system/Pager/PagerTest.php index b7f9866579ab..6da74a9bce2d 100644 --- a/tests/system/Pager/PagerTest.php +++ b/tests/system/Pager/PagerTest.php @@ -25,12 +25,10 @@ use Config\Services; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PagerTest extends CIUnitTestCase { private ?Pager $pager = null; diff --git a/tests/system/Publisher/ContentReplacerTest.php b/tests/system/Publisher/ContentReplacerTest.php index 758075f1fc7f..2c7f5db96685 100644 --- a/tests/system/Publisher/ContentReplacerTest.php +++ b/tests/system/Publisher/ContentReplacerTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ContentReplacerTest extends CIUnitTestCase { public function testReplace(): void diff --git a/tests/system/Publisher/PublisherContentReplaceTest.php b/tests/system/Publisher/PublisherContentReplaceTest.php index ca3cc8fbef1e..4549ed662d5b 100644 --- a/tests/system/Publisher/PublisherContentReplaceTest.php +++ b/tests/system/Publisher/PublisherContentReplaceTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PublisherContentReplaceTest extends CIUnitTestCase { private string $file; diff --git a/tests/system/Publisher/PublisherInputTest.php b/tests/system/Publisher/PublisherInputTest.php index af6f3323969d..d3fcc9fe436b 100644 --- a/tests/system/Publisher/PublisherInputTest.php +++ b/tests/system/Publisher/PublisherInputTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PublisherInputTest extends CIUnitTestCase { /** diff --git a/tests/system/Publisher/PublisherOutputTest.php b/tests/system/Publisher/PublisherOutputTest.php index 816f045d2b21..6c4670c282ec 100644 --- a/tests/system/Publisher/PublisherOutputTest.php +++ b/tests/system/Publisher/PublisherOutputTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PublisherOutputTest extends CIUnitTestCase { /** diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index ac4dce6b52fa..952c3c4608ca 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -23,9 +23,8 @@ * file properly prevent disallowed actions. * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PublisherRestrictionsTest extends CIUnitTestCase { /** @@ -48,9 +47,7 @@ public function testImmutableRestrictions(): void $this->assertArrayNotHasKey(SUPPORTPATH, $restrictions); } - /** - * @dataProvider provideDefaultPublicRestrictions - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideDefaultPublicRestrictions')] public function testDefaultPublicRestrictions(string $path): void { $publisher = new Publisher(ROOTPATH, FCPATH); @@ -80,9 +77,7 @@ public static function provideDefaultPublicRestrictions(): iterable ]; } - /** - * @dataProvider provideDestinations - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideDestinations')] public function testDestinations(string $destination, bool $allowed): void { config('Publisher')->restrictions = [ diff --git a/tests/system/Publisher/PublisherSupportTest.php b/tests/system/Publisher/PublisherSupportTest.php index e62ed76a48dd..2dd26c2c7a9f 100644 --- a/tests/system/Publisher/PublisherSupportTest.php +++ b/tests/system/Publisher/PublisherSupportTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class PublisherSupportTest extends CIUnitTestCase { /** diff --git a/tests/system/RESTful/ResourceControllerTest.php b/tests/system/RESTful/ResourceControllerTest.php index 471ae58157c5..22fd3a0e10f8 100644 --- a/tests/system/RESTful/ResourceControllerTest.php +++ b/tests/system/RESTful/ResourceControllerTest.php @@ -37,14 +37,11 @@ * so we need to make sure that the methods routed to * return correct responses. * - * @runTestsInSeparateProcesses - * - * @preserveGlobalState disabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] +#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class ResourceControllerTest extends CIUnitTestCase { private CodeIgniter $codeigniter; diff --git a/tests/system/RESTful/ResourcePresenterTest.php b/tests/system/RESTful/ResourcePresenterTest.php index 975f0d2b9e0c..f2d37b1c9ce9 100644 --- a/tests/system/RESTful/ResourcePresenterTest.php +++ b/tests/system/RESTful/ResourcePresenterTest.php @@ -31,14 +31,11 @@ * so we need to make sure that the methods routed to * return correct responses. * - * @runTestsInSeparateProcesses - * - * @preserveGlobalState disabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] +#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class ResourcePresenterTest extends CIUnitTestCase { private CodeIgniter $codeigniter; diff --git a/tests/system/Router/AutoRouterImprovedTest.php b/tests/system/Router/AutoRouterImprovedTest.php index 6c531db06a8b..f476cb2aa27b 100644 --- a/tests/system/Router/AutoRouterImprovedTest.php +++ b/tests/system/Router/AutoRouterImprovedTest.php @@ -28,9 +28,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class AutoRouterImprovedTest extends CIUnitTestCase { private RouteCollection $collection; @@ -458,9 +457,7 @@ public function testDoesNotTranslateDashInParam(): void $this->assertSame(['a-b'], $params); } - /** - * @dataProvider provideTranslateUriToCamelCase - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideTranslateUriToCamelCase')] public function testTranslateUriToCamelCase( string $uri, ?string $expDirectory, @@ -532,9 +529,7 @@ public static function provideTranslateUriToCamelCase(): iterable ]; } - /** - * @dataProvider provideRejectTranslateUriToCamelCase - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRejectTranslateUriToCamelCase')] public function testRejectTranslateUriToCamelCase(string $uri, string $expMsg): void { $this->expectException(PageNotFoundException::class); diff --git a/tests/system/Router/DefinedRouteCollectorTest.php b/tests/system/Router/DefinedRouteCollectorTest.php index 779639204ded..8707a6bceafd 100644 --- a/tests/system/Router/DefinedRouteCollectorTest.php +++ b/tests/system/Router/DefinedRouteCollectorTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DefinedRouteCollectorTest extends CIUnitTestCase { private function createRouteCollection(array $config = [], $moduleConfig = null): RouteCollection diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index cbde8a16a118..701d79f7bdc1 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RouteCollectionReverseRouteTest extends CIUnitTestCase { protected function setUp(): void @@ -143,9 +142,7 @@ public static function provideReverseRoutingDefaultNamespaceAppController(): ite ]; } - /** - * @dataProvider provideReverseRoutingDefaultNamespaceAppController - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideReverseRoutingDefaultNamespaceAppController')] public function testReverseRoutingDefaultNamespaceAppController(string $controller): void { $routes = $this->getCollector(); diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index 400f9a99ca29..0911b486d7a1 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -25,9 +25,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RouteCollectionTest extends CIUnitTestCase { protected function setUp(): void @@ -485,9 +484,7 @@ static function ($routes): void { $this->assertSame($expected, $routes->getRoutes()); } - /** - * @dataProvider provideNestedGroupingWorksWithRootPrefix - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideNestedGroupingWorksWithRootPrefix')] public function testNestedGroupingWorksWithRootPrefix( string $group, string $subgroup, @@ -1323,9 +1320,7 @@ static function (): void {}, $this->assertSame($options, ['as' => 'admin', 'foo' => 'baz']); } - /** - * @dataProvider provideRoutesOptionsWithSameFromTwoRoutes - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRoutesOptionsWithSameFromTwoRoutes')] public function testRoutesOptionsWithSameFromTwoRoutes(array $options1, array $options2): void { $routes = $this->getCollector(); @@ -1772,10 +1767,9 @@ public static function provideRouteDefaultNamespace(): iterable } /** - * @dataProvider provideRouteDefaultNamespace - * * @param mixed $namespace */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRouteDefaultNamespace')] public function testAutoRoutesControllerNameReturnsFQCN($namespace): void { $routes = $this->getCollector(); @@ -1793,10 +1787,9 @@ public function testAutoRoutesControllerNameReturnsFQCN($namespace): void } /** - * @dataProvider provideRouteDefaultNamespace - * * @param mixed $namespace */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRouteDefaultNamespace')] public function testRoutesControllerNameReturnsFQCN($namespace): void { Services::request()->setMethod(Method::GET); diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index fb71568e8af3..09f710978d42 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -29,9 +29,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RouterTest extends CIUnitTestCase { private RouteCollection $collection; @@ -913,9 +912,7 @@ public function testSetDirectoryInvalid(): void $this->assertSame('', $router->directory()); } - /** - * @dataProvider provideRedirectRoute - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRedirectRoute')] public function testRedirectRoute( string $route, string $redirectFrom, diff --git a/tests/system/Security/CheckPhpIniTest.php b/tests/system/Security/CheckPhpIniTest.php index 9028a676ca90..08c49c3094fb 100644 --- a/tests/system/Security/CheckPhpIniTest.php +++ b/tests/system/Security/CheckPhpIniTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CheckPhpIniTest extends CIUnitTestCase { public function testCheckIni(): void diff --git a/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php b/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php index 6ea63b694ddc..dd4cd16847aa 100644 --- a/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php +++ b/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php @@ -25,9 +25,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SecurityCSRFCookieRandomizeTokenTest extends CIUnitTestCase { /** diff --git a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php index c2d11db26a05..3d6386d70036 100644 --- a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php +++ b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php @@ -35,14 +35,11 @@ use PHPUnit\Framework\Attributes\WithoutErrorHandler; /** - * @runTestsInSeparateProcesses - * - * @preserveGlobalState disabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] +#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class SecurityCSRFSessionRandomizeTokenTest extends CIUnitTestCase { /** diff --git a/tests/system/Security/SecurityCSRFSessionTest.php b/tests/system/Security/SecurityCSRFSessionTest.php index 397932889182..90bb0e49c014 100644 --- a/tests/system/Security/SecurityCSRFSessionTest.php +++ b/tests/system/Security/SecurityCSRFSessionTest.php @@ -33,14 +33,11 @@ use Config\Session as SessionConfig; /** - * @runTestsInSeparateProcesses - * - * @preserveGlobalState disabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] +#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class SecurityCSRFSessionTest extends CIUnitTestCase { /** diff --git a/tests/system/Security/SecurityTest.php b/tests/system/Security/SecurityTest.php index e8b93cf7ab05..d449e6b2dec4 100644 --- a/tests/system/Security/SecurityTest.php +++ b/tests/system/Security/SecurityTest.php @@ -26,12 +26,10 @@ use Config\Services; /** - * @backupGlobals enabled - * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SecurityTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php index f7f9f855895a..f239402acc08 100644 --- a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php +++ b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php @@ -17,10 +17,9 @@ use Config\Session as SessionConfig; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class MySQLiHandlerTest extends AbstractHandlerTestCase { protected function setUp(): void diff --git a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php index deae7988c04c..58dd19ab50e8 100644 --- a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php +++ b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php @@ -17,10 +17,9 @@ use Config\Session as SessionConfig; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class PostgreHandlerTest extends AbstractHandlerTestCase { protected function setUp(): void diff --git a/tests/system/Session/Handlers/Database/RedisHandlerTest.php b/tests/system/Session/Handlers/Database/RedisHandlerTest.php index 8d5a76c9be14..aa03d39e6c7f 100644 --- a/tests/system/Session/Handlers/Database/RedisHandlerTest.php +++ b/tests/system/Session/Handlers/Database/RedisHandlerTest.php @@ -18,12 +18,10 @@ use Config\Session as SessionConfig; /** - * @group DatabaseLive - * - * @requires extension redis - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('redis')] final class RedisHandlerTest extends CIUnitTestCase { private string $sessionDriver = RedisHandler::class; @@ -136,9 +134,7 @@ public function testSecondaryReadAfterClose(): void $handler->close(); } - /** - * @dataProvider provideSetSavePath - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSetSavePath')] public function testSetSavePath(string $savePath, array $expected): void { $option = ['savePath' => $savePath]; diff --git a/tests/system/Session/SessionTest.php b/tests/system/Session/SessionTest.php index 63009e5230a0..26b4a02558e4 100644 --- a/tests/system/Session/SessionTest.php +++ b/tests/system/Session/SessionTest.php @@ -24,14 +24,11 @@ use Config\Session as SessionConfig; /** - * @runTestsInSeparateProcesses - * - * @preserveGlobalState disabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] +#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class SessionTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/SparkTest.php b/tests/system/SparkTest.php index 17a6be99c891..66f8a3dc3809 100644 --- a/tests/system/SparkTest.php +++ b/tests/system/SparkTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SparkTest extends CIUnitTestCase { public function testCanUseOption(): void diff --git a/tests/system/SuperglobalsTest.php b/tests/system/SuperglobalsTest.php index 54ab69958ec4..fa61bc8f30f8 100644 --- a/tests/system/SuperglobalsTest.php +++ b/tests/system/SuperglobalsTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class SuperglobalsTest extends CIUnitTestCase { public function testSetGet(): void diff --git a/tests/system/Test/BootstrapFCPATHTest.php b/tests/system/Test/BootstrapFCPATHTest.php index 9a6976a8b516..7f664b5bb183 100644 --- a/tests/system/Test/BootstrapFCPATHTest.php +++ b/tests/system/Test/BootstrapFCPATHTest.php @@ -24,9 +24,8 @@ * from correctFCPATH(); * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class BootstrapFCPATHTest extends CIUnitTestCase { private string $currentDir = __DIR__; diff --git a/tests/system/Test/ControllerTestTraitTest.php b/tests/system/Test/ControllerTestTraitTest.php index 94146215bc13..b5f2bdd516be 100644 --- a/tests/system/Test/ControllerTestTraitTest.php +++ b/tests/system/Test/ControllerTestTraitTest.php @@ -27,14 +27,11 @@ /** * Exercise our Controller class. * - * @runTestsInSeparateProcesses - * - * @preserveGlobalState disabled - * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] +#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class ControllerTestTraitTest extends CIUnitTestCase { use ControllerTestTrait; diff --git a/tests/system/Test/DOMParserTest.php b/tests/system/Test/DOMParserTest.php index 73d38a0e809d..1d086db48c37 100644 --- a/tests/system/Test/DOMParserTest.php +++ b/tests/system/Test/DOMParserTest.php @@ -15,9 +15,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DOMParserTest extends CIUnitTestCase { protected function setUp(): void @@ -91,10 +90,9 @@ public static function provideText(): iterable } /** - * @dataProvider provideText - * * @param string $text */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideText')] public function testSeeText($text): void { $dom = new DOMParser(); @@ -139,10 +137,9 @@ public function testSeeFail(): void } /** - * @dataProvider provideText - * * @param string $text */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideText')] public function testSeeElement($text): void { $dom = new DOMParser(); diff --git a/tests/system/Test/FabricatorTest.php b/tests/system/Test/FabricatorTest.php index f00cf6f5f81a..236b6ab126a8 100644 --- a/tests/system/Test/FabricatorTest.php +++ b/tests/system/Test/FabricatorTest.php @@ -23,9 +23,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FabricatorTest extends CIUnitTestCase { /** diff --git a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php index 568bbb25d05f..9b1f451c6565 100644 --- a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php +++ b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php @@ -18,10 +18,9 @@ use Config\Services; /** - * @group Others - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FeatureTestAutoRoutingImprovedTest extends CIUnitTestCase { use FeatureTestTrait; diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index bd746c7a9c57..b259448f2e90 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -24,10 +24,9 @@ use Config\Services; /** - * @group DatabaseLive - * * @internal */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class FeatureTestTraitTest extends CIUnitTestCase { use FeatureTestTrait; @@ -359,12 +358,11 @@ public static function provideOpenCliRoutesFromHttpGot404(): iterable } /** - * @dataProvider provideOpenCliRoutesFromHttpGot404 - * * @param mixed $from * @param mixed $to * @param mixed $httpGet */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideOpenCliRoutesFromHttpGot404')] public function testOpenCliRoutesFromHttpGot404($from, $to, $httpGet): void { $this->expectException(PageNotFoundException::class); diff --git a/tests/system/Test/FilterTestTraitTest.php b/tests/system/Test/FilterTestTraitTest.php index 911a03740f18..e8ed466e6dff 100644 --- a/tests/system/Test/FilterTestTraitTest.php +++ b/tests/system/Test/FilterTestTraitTest.php @@ -27,9 +27,8 @@ * - class: \Tests\Support\Filters\Customfilter::class * * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FilterTestTraitTest extends CIUnitTestCase { use FilterTestTrait; diff --git a/tests/system/Test/IniTestTraitTest.php b/tests/system/Test/IniTestTraitTest.php index d577a23deb56..70c78f2f1c79 100644 --- a/tests/system/Test/IniTestTraitTest.php +++ b/tests/system/Test/IniTestTraitTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class IniTestTraitTest extends CIUnitTestCase { use IniTestTrait; diff --git a/tests/system/Test/ReflectionHelperTest.php b/tests/system/Test/ReflectionHelperTest.php index 324a56c7f285..caa7aa41fe1e 100644 --- a/tests/system/Test/ReflectionHelperTest.php +++ b/tests/system/Test/ReflectionHelperTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ReflectionHelperTest extends CIUnitTestCase { public function testGetPrivatePropertyWithObject(): void diff --git a/tests/system/Test/TestCaseEmissionsTest.php b/tests/system/Test/TestCaseEmissionsTest.php index 26d7ee7898d3..22c2844f29ca 100644 --- a/tests/system/Test/TestCaseEmissionsTest.php +++ b/tests/system/Test/TestCaseEmissionsTest.php @@ -23,9 +23,8 @@ * test cases need to be run as separate processes. * * @internal - * - * @group SeparateProcess */ +#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] final class TestCaseEmissionsTest extends CIUnitTestCase { /** @@ -41,11 +40,8 @@ final class TestCaseEmissionsTest extends CIUnitTestCase * The tests includes a basic sanity check, to make sure that * the body we thought would be sent actually was. */ - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testHeadersEmitted(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -74,10 +70,8 @@ public function testHeadersEmitted(): void $this->assertHeaderEmitted('set-cookie: FOO=bar', true); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] public function testHeadersNotEmitted(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/Test/TestCaseTest.php b/tests/system/Test/TestCaseTest.php index 6521029636d3..f939b055ac20 100644 --- a/tests/system/Test/TestCaseTest.php +++ b/tests/system/Test/TestCaseTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TestCaseTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Test/TestLoggerTest.php b/tests/system/Test/TestLoggerTest.php index facf492c83b6..5ea2003942d3 100644 --- a/tests/system/Test/TestLoggerTest.php +++ b/tests/system/Test/TestLoggerTest.php @@ -17,14 +17,11 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TestLoggerTest extends CIUnitTestCase { - /** - * @dataProvider provideDidLogMethod - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideDidLogMethod')] public function testDidLogMethod(bool $expected, string $level, string $message, bool $exact): void { (new TestLogger(new Logger()))->log('error', 'Some variable did not contain a value.'); diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 3157a31b18d5..6794d222d68d 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TestResponseTest extends CIUnitTestCase { private ?TestResponse $testResponse = null; @@ -34,9 +33,7 @@ protected function setUp(): void parent::setUp(); } - /** - * @dataProvider provideHttpStatusCodes - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideHttpStatusCodes')] public function testIsOK(int $code, bool $isOk): void { $this->getTestResponse('Hello World'); @@ -224,9 +221,7 @@ public function testAssertStatus(): void $this->testResponse->assertStatus(201); } - /** - * @dataProvider provideHttpStatusCodes - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideHttpStatusCodes')] public function testAssertIsOK(int $code, bool $isOk): void { $this->getTestResponse('

Hello World

', ['statusCode' => $code]); diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 683d1ad50145..0b8bfdb726b5 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ThrottleTest extends CIUnitTestCase { private CacheInterface $cache; @@ -190,9 +189,7 @@ public function testFlooding(): void $this->assertEqualsWithDelta(10.0, round($this->cache->get('throttler_127.0.0.1')), PHP_FLOAT_EPSILON); } - /** - * @dataProvider provideTokenTimeCalculationUCs - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideTokenTimeCalculationUCs')] public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $checkInputs): void { $key = 'testkey'; diff --git a/tests/system/Typography/TypographyTest.php b/tests/system/Typography/TypographyTest.php index 23547a6e0a0e..9774c6f19b61 100644 --- a/tests/system/Typography/TypographyTest.php +++ b/tests/system/Typography/TypographyTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TypographyTest extends CIUnitTestCase { private Typography $typography; diff --git a/tests/system/Validation/CreditCardRulesTest.php b/tests/system/Validation/CreditCardRulesTest.php index 911365538e57..496a5e3c835e 100644 --- a/tests/system/Validation/CreditCardRulesTest.php +++ b/tests/system/Validation/CreditCardRulesTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CreditCardRulesTest extends CIUnitTestCase { private Validation $validation; @@ -50,9 +49,7 @@ protected function setUp(): void $this->validation->reset(); } - /** - * @dataProvider provideValidCCNumber - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidCCNumber')] public function testValidCCNumber(string $type, ?string $number, bool $expected): void { $data = ['cc' => $number]; diff --git a/tests/system/Validation/DatabaseRelatedRulesTest.php b/tests/system/Validation/DatabaseRelatedRulesTest.php index d8795fac46c4..af811eddb4bc 100644 --- a/tests/system/Validation/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/DatabaseRelatedRulesTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group DatabaseLive */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] final class DatabaseRelatedRulesTest extends StrictDatabaseRelatedRulesTest { protected array $config = [ diff --git a/tests/system/Validation/DotArrayFilterTest.php b/tests/system/Validation/DotArrayFilterTest.php index 67274860ed35..c1b2ac7fc523 100644 --- a/tests/system/Validation/DotArrayFilterTest.php +++ b/tests/system/Validation/DotArrayFilterTest.php @@ -17,9 +17,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DotArrayFilterTest extends CIUnitTestCase { public function testRunReturnEmptyArray(): void diff --git a/tests/system/Validation/FileRulesTest.php b/tests/system/Validation/FileRulesTest.php index a29c95c18add..8083d95939e1 100644 --- a/tests/system/Validation/FileRulesTest.php +++ b/tests/system/Validation/FileRulesTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileRulesTest extends CIUnitTestCase { private Validation $validation; diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index 75d0cc968135..62c8ce257b31 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -21,10 +21,9 @@ /** * @internal * - * @group Others - * * @no-final */ +#[\PHPUnit\Framework\Attributes\Group('Others')] class FormatRulesTest extends CIUnitTestCase { public const ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHLIJKLMNOPQRSTUVWXYZ'; @@ -86,9 +85,7 @@ public function testRegexMatchFalse(): void $this->assertFalse($this->validation->run($data)); } - /** - * @dataProvider provideValidUrl - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidUrl')] public function testValidURL(?string $url, bool $isLoose, bool $isStrict): void { $data = [ @@ -102,9 +99,7 @@ public function testValidURL(?string $url, bool $isLoose, bool $isStrict): void $this->assertSame($isLoose, $this->validation->run($data)); } - /** - * @dataProvider provideValidUrl - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidUrl')] public function testValidURLStrict(?string $url, bool $isLoose, bool $isStrict): void { $data = [ @@ -230,9 +225,7 @@ public static function provideValidUrl(): iterable ]; } - /** - * @dataProvider provideValidEmail - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidEmail')] public function testValidEmail(?string $email, bool $expected): void { $data = [ @@ -246,9 +239,7 @@ public function testValidEmail(?string $email, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - /** - * @dataProvider provideValidEmails - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidEmails')] public function testValidEmails(?string $email, bool $expected): void { $data = [ @@ -310,9 +301,7 @@ public static function provideValidEmails(): iterable ]; } - /** - * @dataProvider provideValidIP - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidIP')] public function testValidIP(?string $ip, ?string $which, bool $expected): void { $data = [ @@ -378,10 +367,9 @@ public static function provideValidIP(): iterable } /** - * @dataProvider provideString - * * @param int|string $str */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideString')] public function testString($str, bool $expected): void { $data = [ @@ -413,9 +401,7 @@ public static function provideString(): iterable ]; } - /** - * @dataProvider provideAlpha - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAlpha')] public function testAlpha(?string $str, bool $expected): void { $data = [ @@ -455,9 +441,7 @@ public static function provideAlpha(): iterable ]; } - /** - * @dataProvider provideAlphaSpace - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAlphaSpace')] public function testAlphaSpace(?string $value, bool $expected): void { $data = [ @@ -501,9 +485,7 @@ public static function provideAlphaSpace(): iterable ]; } - /** - * @dataProvider alphaNumericProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('alphaNumericProvider')] public function testAlphaNumeric(?string $str, bool $expected): void { $data = [ @@ -539,9 +521,7 @@ public static function alphaNumericProvider(): iterable ]; } - /** - * @dataProvider provideAlphaNumericPunct - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAlphaNumericPunct')] public function testAlphaNumericPunct(?string $str, bool $expected): void { $data = [ @@ -633,9 +613,7 @@ public static function provideAlphaNumericPunct(): iterable ]; } - /** - * @dataProvider alphaNumericProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('alphaNumericProvider')] public function testAlphaNumericSpace(?string $str, bool $expected): void { $data = [ @@ -671,9 +649,7 @@ public function alphaNumericSpaceProvider(): Generator ]; } - /** - * @dataProvider provideAlphaDash - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideAlphaDash')] public function testAlphaDash(?string $str, bool $expected): void { $data = [ @@ -709,9 +685,7 @@ public static function provideAlphaDash(): iterable ]; } - /** - * @dataProvider provideHex - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideHex')] public function testHex(?string $str, bool $expected): void { $data = [ @@ -747,9 +721,7 @@ public static function provideHex(): iterable ]; } - /** - * @dataProvider provideNumeric - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideNumeric')] public function testNumeric(?string $str, bool $expected): void { $data = [ @@ -804,10 +776,9 @@ public static function provideNumeric(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5374 * - * @dataProvider provideInvalidIntegerType - * * @param mixed $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideInvalidIntegerType')] public function testIntegerWithInvalidTypeData($value, bool $expected): void { $this->validation->setRules([ @@ -823,10 +794,9 @@ public function testIntegerWithInvalidTypeData($value, bool $expected): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5374 * - * @dataProvider provideInvalidIntegerType - * * @param mixed $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideInvalidIntegerType')] public function testNumericWithInvalidTypeData($value, bool $expected): void { $this->validation->setRules([ @@ -869,9 +839,7 @@ public static function provideInvalidIntegerType(): iterable ]; } - /** - * @dataProvider provideInteger - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideInteger')] public function testInteger(?string $str, bool $expected): void { $data = [ @@ -923,9 +891,7 @@ public static function provideInteger(): iterable ]; } - /** - * @dataProvider provideDecimal - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideDecimal')] public function testDecimal(?string $str, bool $expected): void { $data = [ @@ -981,9 +947,7 @@ public static function provideDecimal(): iterable ]; } - /** - * @dataProvider provideNatural - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideNatural')] public function testNatural(?string $str, bool $expected): void { $data = [ @@ -1023,9 +987,7 @@ public static function provideNatural(): iterable ]; } - /** - * @dataProvider provideNaturalNoZero - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideNaturalNoZero')] public function testNaturalNoZero(?string $str, bool $expected): void { $data = [ @@ -1065,9 +1027,7 @@ public static function provideNaturalNoZero(): iterable ]; } - /** - * @dataProvider provideBase64 - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideBase64')] public function testBase64(?string $str, bool $expected): void { $data = [ @@ -1099,9 +1059,7 @@ public static function provideBase64(): iterable ]; } - /** - * @dataProvider provideJson - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideJson')] public function testJson(?string $str, bool $expected): void { $data = [ @@ -1157,9 +1115,7 @@ public static function provideJson(): iterable ]; } - /** - * @dataProvider provideTimeZone - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideTimeZone')] public function testTimeZone(?string $str, bool $expected): void { $data = [ @@ -1195,9 +1151,7 @@ public static function provideTimeZone(): iterable ]; } - /** - * @dataProvider provideValidDate - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidDate')] public function testValidDate(?string $str, ?string $format, bool $expected): void { $data = [ diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 54b0756c094c..6ea38beea074 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -21,10 +21,9 @@ /** * @internal * - * @group Others - * * @no-final */ +#[\PHPUnit\Framework\Attributes\Group('Others')] class RulesTest extends CIUnitTestCase { protected Validation $validation; @@ -54,9 +53,7 @@ protected function setUp(): void $this->validation->reset(); } - /** - * @dataProvider provideRequired - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRequired')] public function testRequired(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'required']); @@ -76,9 +73,7 @@ public static function provideRequired(): iterable ]; } - /** - * @dataProvider provideIfExist - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideIfExist')] public function testIfExist(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); @@ -129,9 +124,7 @@ public static function provideIfExist(): iterable ]; } - /** - * @dataProvider providePermitEmpty - */ + #[\PHPUnit\Framework\Attributes\DataProvider('providePermitEmpty')] public function testPermitEmpty(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); @@ -298,9 +291,7 @@ public static function providePermitEmpty(): iterable ]; } - /** - * @dataProvider provideMatches - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMatches')] public function testMatches(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'matches[bar]']); @@ -322,9 +313,7 @@ public static function provideMatches(): iterable ]; } - /** - * @dataProvider provideMatchesNestedCases - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMatchesNestedCases')] public function testMatchesNested(array $data, bool $expected): void { $this->validation->setRules(['nested.foo' => 'matches[nested.bar]']); @@ -339,9 +328,7 @@ public static function provideMatchesNestedCases(): iterable ]; } - /** - * @dataProvider provideDiffers - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideDiffers')] public function testDiffers(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'differs[bar]']); @@ -363,18 +350,14 @@ public static function provideDiffers(): iterable ]; } - /** - * @dataProvider provideMatchesNestedCases - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMatchesNestedCases')] public function testDiffersNested(array $data, bool $expected): void { $this->validation->setRules(['nested.foo' => 'differs[nested.bar]']); $this->assertSame(! $expected, $this->validation->run($data)); } - /** - * @dataProvider provideEquals - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideEquals')] public function testEquals(array $data, string $param, bool $expected): void { $this->validation->setRules(['foo' => "equals[{$param}]"]); @@ -392,9 +375,7 @@ public static function provideEquals(): iterable ]; } - /** - * @dataProvider provideMinLengthCases - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMinLengthCases')] public function testMinLength(?string $data, string $length, bool $expected): void { $this->validation->setRules(['foo' => "min_length[{$length}]"]); @@ -411,9 +392,7 @@ public static function provideMinLengthCases(): iterable ]; } - /** - * @dataProvider provideMinLengthCases - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMinLengthCases')] public function testMaxLength(?string $data, string $length, bool $expected): void { $this->validation->setRules(['foo' => "max_length[{$length}]"]); @@ -427,10 +406,9 @@ public function testMaxLengthReturnsFalseWithNonNumericVal(): void } /** - * @dataProvider provideExactLength - * * @param int|string|null $data */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideExactLength')] public function testExactLength($data, bool $expected): void { $this->validation->setRules(['foo' => 'exact_length[3]']); @@ -457,9 +435,7 @@ public function testExactLengthDetectsBadLength(): void $this->assertFalse($this->validation->run($data)); } - /** - * @dataProvider provideGreaterThan - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThan')] public function testGreaterThan(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -482,9 +458,7 @@ public static function provideGreaterThan(): iterable ]; } - /** - * @dataProvider provideGreaterThanEqual - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThanEqual')] public function testGreaterThanEqual(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -508,9 +482,7 @@ public static function provideGreaterThanEqual(): iterable ]; } - /** - * @dataProvider provideLessThan - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideLessThan')] public function testLessThan(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -534,9 +506,7 @@ public static function provideLessThan(): iterable ]; } - /** - * @dataProvider provideLessThanEqual - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideLessThanEqual')] public function testLessThanEqual(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -560,9 +530,7 @@ public static function provideLessThanEqual(): iterable ]; } - /** - * @dataProvider provideInList - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideInList')] public function testInList(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -570,9 +538,7 @@ public function testInList(?string $first, ?string $second, bool $expected): voi $this->assertSame($expected, $this->validation->run($data)); } - /** - * @dataProvider provideInList - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideInList')] public function testNotInList(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -595,9 +561,7 @@ public static function provideInList(): iterable ]; } - /** - * @dataProvider provideRequiredWith - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWith')] public function testRequiredWith(?string $field, ?string $check, bool $expected): void { $data = [ @@ -650,9 +614,8 @@ public static function provideRequiredWith(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/7557 - * - * @dataProvider provideRequiredWithAndOtherRules */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithAndOtherRules')] public function testRequiredWithAndOtherRules(bool $expected, array $data): void { $this->validation->setRules([ @@ -686,9 +649,7 @@ public static function provideRequiredWithAndOtherRules(): iterable ]; } - /** - * @dataProvider provideRequiredWithAndOtherRuleWithValueZero - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithAndOtherRuleWithValueZero')] public function testRequiredWithAndOtherRuleWithValueZero(bool $expected, array $data): void { $this->validation->setRules([ @@ -710,9 +671,7 @@ public static function provideRequiredWithAndOtherRuleWithValueZero(): iterable ]; } - /** - * @dataProvider provideRequiredWithout - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithout')] public function testRequiredWithout(?string $field, ?string $check, bool $expected): void { $data = [ @@ -762,9 +721,7 @@ public static function provideRequiredWithout(): iterable ]; } - /** - * @dataProvider provideRequiredWithoutMultiple - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithoutMultiple')] public function testRequiredWithoutMultiple(string $foo, string $bar, string $baz, bool $result): void { $this->validation->setRules(['foo' => 'required_without[bar,baz]']); @@ -813,9 +770,7 @@ public static function provideRequiredWithoutMultiple(): iterable ]; } - /** - * @dataProvider provideRequiredWithoutMultipleWithoutFields - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithoutMultipleWithoutFields')] public function testRequiredWithoutMultipleWithoutFields(array $data, bool $result): void { $this->validation->setRules(['foo' => 'required_without[bar,baz]']); @@ -855,9 +810,7 @@ public static function provideRequiredWithoutMultipleWithoutFields(): iterable ]; } - /** - * @dataProvider provideFieldExists - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideFieldExists')] public function testFieldExists(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index 754de75a67e6..8903ab073c5b 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CreditCardRulesTest extends CIUnitTestCase { private Validation $validation; @@ -51,9 +50,7 @@ protected function setUp(): void $this->validation->reset(); } - /** - * @dataProvider provideValidCCNumber - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidCCNumber')] public function testValidCCNumber(string $type, ?string $number, bool $expected): void { $data = ['cc' => $number]; diff --git a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php index c584b572266d..208d0cb3f79e 100644 --- a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php @@ -26,9 +26,8 @@ * @internal * * @no-final - * - * @group DatabaseLive */ +#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] class DatabaseRelatedRulesTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Validation/StrictRules/FileRulesTest.php b/tests/system/Validation/StrictRules/FileRulesTest.php index d6c20dfaef6c..9a8a9f68c010 100644 --- a/tests/system/Validation/StrictRules/FileRulesTest.php +++ b/tests/system/Validation/StrictRules/FileRulesTest.php @@ -21,9 +21,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FileRulesTest extends CIUnitTestCase { private Validation $validation; diff --git a/tests/system/Validation/StrictRules/FormatRulesTest.php b/tests/system/Validation/StrictRules/FormatRulesTest.php index b6bc2d55bed4..8b08a4d300bd 100644 --- a/tests/system/Validation/StrictRules/FormatRulesTest.php +++ b/tests/system/Validation/StrictRules/FormatRulesTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class FormatRulesTest extends TraditionalFormatRulesTest { protected array $config = [ diff --git a/tests/system/Validation/StrictRules/RulesTest.php b/tests/system/Validation/StrictRules/RulesTest.php index e4a767421054..5db01491bde3 100644 --- a/tests/system/Validation/StrictRules/RulesTest.php +++ b/tests/system/Validation/StrictRules/RulesTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class RulesTest extends TraditionalRulesTest { protected Validation $validation; @@ -43,9 +42,7 @@ final class RulesTest extends TraditionalRulesTest ], ]; - /** - * @dataProvider providePermitEmptyStrict - */ + #[\PHPUnit\Framework\Attributes\DataProvider('providePermitEmptyStrict')] public function testPermitEmptyStrict(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); @@ -100,10 +97,9 @@ public static function providePermitEmptyStrict(): iterable } /** - * @dataProvider provideGreaterThanEqualStrict - * * @param int $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThanEqualStrict')] public function testGreaterThanEqualStrict($value, string $param, bool $expected): void { $this->validation->setRules(['foo' => "greater_than_equal_to[{$param}]"]); @@ -126,10 +122,9 @@ public static function provideGreaterThanEqualStrict(): iterable } /** - * @dataProvider provideGreaterThanStrict - * * @param int $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThanStrict')] public function testGreaterThanStrict($value, string $param, bool $expected): void { $this->validation->setRules(['foo' => "greater_than[{$param}]"]); @@ -153,10 +148,9 @@ public static function provideGreaterThanStrict(): iterable } /** - * @dataProvider provideLessThanStrict - * * @param int $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideLessThanStrict')] public function testLessThanStrict($value, string $param, bool $expected): void { $this->validation->setRules(['foo' => "less_than[{$param}]"]); @@ -181,10 +175,9 @@ public static function provideLessThanStrict(): iterable } /** - * @dataProvider provideLessEqualThanStrict - * * @param int $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideLessEqualThanStrict')] public function testLessEqualThanStrict($value, ?string $param, bool $expected): void { $this->validation->setRules(['foo' => "less_than_equal_to[{$param}]"]); @@ -206,9 +199,7 @@ public static function provideLessEqualThanStrict(): iterable ]; } - /** - * @dataProvider provideMatches - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideMatches')] public function testMatches(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'matches[bar]']); @@ -230,9 +221,7 @@ public static function provideMatches(): iterable ]; } - /** - * @dataProvider provideDiffers - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideDiffers')] public function testDiffers(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'differs[bar]']); diff --git a/tests/system/Validation/StrictRules/ValidationTest.php b/tests/system/Validation/StrictRules/ValidationTest.php index 3e6a1d0b5a1e..82a6944a7931 100644 --- a/tests/system/Validation/StrictRules/ValidationTest.php +++ b/tests/system/Validation/StrictRules/ValidationTest.php @@ -18,9 +18,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ValidationTest extends TraditionalValidationTest { protected static array $config = [ diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index f47e62b0f319..861e6b681d6b 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -29,10 +29,9 @@ /** * @internal * - * @group Others - * * @no-final */ +#[\PHPUnit\Framework\Attributes\Group('Others')] class ValidationTest extends CIUnitTestCase { protected Validation $validation; @@ -190,10 +189,9 @@ public function testSetRuleOverwritesRuleReverse(): void } /** - * @dataProvider provideSetRuleRulesFormat - * * @param mixed $rules */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSetRuleRulesFormat')] public function testSetRuleRulesFormat(bool $expected, $rules): void { if (! $expected) { @@ -445,10 +443,9 @@ public function testCallableRuleWithLabel(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5368 * - * @dataProvider provideCanValidatetArrayData - * * @param mixed $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideCanValidatetArrayData')] public function testCanValidatetArrayData($value, bool $expected): void { $data = []; @@ -498,10 +495,9 @@ public static function provideCanValidatetArrayData(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5374 * - * @dataProvider provideIsIntWithInvalidTypeData - * * @param mixed $value */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideIsIntWithInvalidTypeData')] public function testIsIntWithInvalidTypeData($value, bool $expected): void { $this->validation->setRules(['foo' => 'is_int']); @@ -735,11 +731,10 @@ public function testRunWithCustomErrorsAndAsteriskField(): void } /** - * @dataProvider provideRulesSetup - * * @param list|string $rules * @param string $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRulesSetup')] public function testRulesSetup($rules, $expected, array $errors = []): void { $data = ['foo' => '']; @@ -1132,9 +1127,7 @@ public function testRulesForObjectField(): void ], $this->validation->getErrors()); } - /** - * @dataProvider provideRulesForArrayField - */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideRulesForArrayField')] public function testRulesForArrayField(array $body, array $rules, array $results): void { $config = new App(); @@ -1373,10 +1366,9 @@ public function testTranslatedLabelTagReplacement(): void } /** - * @dataProvider provideIfExistRuleWithAsterisk - * * @see https://github.com/codeigniter4/CodeIgniter4/issues/4521 */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideIfExistRuleWithAsterisk')] public function testIfExistRuleWithAsterisk(bool $expected, array $rules, array $data): void { $actual = $this->validation->setRules($rules)->run($data); @@ -1443,10 +1435,9 @@ public static function provideIfExistRuleWithAsterisk(): iterable } /** - * @dataProvider provideValidationOfArrayData - * * @see https://github.com/codeigniter4/CodeIgniter4/issues/4510 */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideValidationOfArrayData')] public function testValidationOfArrayData(bool $expected, array $rules, array $data): void { $actual = $this->validation->setRules($rules)->run($data); @@ -1499,10 +1490,9 @@ public static function provideValidationOfArrayData(): iterable } /** - * @dataProvider provideSplittingOfComplexStringRules - * * @see https://github.com/codeigniter4/CodeIgniter4/issues/4929 */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideSplittingOfComplexStringRules')] public function testSplittingOfComplexStringRules(string $input, array $expected): void { $splitter = $this->getPrivateMethodInvoker($this->validation, 'splitRules'); diff --git a/tests/system/View/CellTest.php b/tests/system/View/CellTest.php index dd400e4ef7e8..145a2303327b 100644 --- a/tests/system/View/CellTest.php +++ b/tests/system/View/CellTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class CellTest extends CIUnitTestCase { private MockCache $cache; diff --git a/tests/system/View/ControlledCellTest.php b/tests/system/View/ControlledCellTest.php index 9da6d1162b85..542fc733c812 100644 --- a/tests/system/View/ControlledCellTest.php +++ b/tests/system/View/ControlledCellTest.php @@ -29,9 +29,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ControlledCellTest extends CIUnitTestCase { public function testCellRendersDefaultValues(): void diff --git a/tests/system/View/DecoratorsTest.php b/tests/system/View/DecoratorsTest.php index 225b10d18462..bf8eecfb43ab 100644 --- a/tests/system/View/DecoratorsTest.php +++ b/tests/system/View/DecoratorsTest.php @@ -23,9 +23,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class DecoratorsTest extends CIUnitTestCase { private FileLocator $loader; diff --git a/tests/system/View/ParserFilterTest.php b/tests/system/View/ParserFilterTest.php index 497dab64455e..1411eacc83a6 100644 --- a/tests/system/View/ParserFilterTest.php +++ b/tests/system/View/ParserFilterTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ParserFilterTest extends CIUnitTestCase { private FileLocator $loader; diff --git a/tests/system/View/ParserPluginTest.php b/tests/system/View/ParserPluginTest.php index 9d6b97dec716..c24b2bdb3f97 100644 --- a/tests/system/View/ParserPluginTest.php +++ b/tests/system/View/ParserPluginTest.php @@ -19,9 +19,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ParserPluginTest extends CIUnitTestCase { private Parser $parser; @@ -44,12 +43,9 @@ public function testCurrentURL(): void $this->assertSame(current_url(), $this->parser->renderString($template)); } - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * - * @group SeparateProcess - */ + #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] + #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] public function testPreviousURL(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php index e724edc1d4eb..177377c85dd3 100644 --- a/tests/system/View/ParserTest.php +++ b/tests/system/View/ParserTest.php @@ -23,9 +23,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ParserTest extends CIUnitTestCase { private FileLocator $loader; @@ -477,11 +476,10 @@ public static function provideEscHandling(): iterable } /** - * @dataProvider provideEscHandling - * * @param mixed $value * @param mixed|null $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('provideEscHandling')] public function testEscHandling($value, $expected = null): void { if ($expected === null) { diff --git a/tests/system/View/TableTest.php b/tests/system/View/TableTest.php index 2dfe08cae3a5..d8582f4d0e0e 100644 --- a/tests/system/View/TableTest.php +++ b/tests/system/View/TableTest.php @@ -20,9 +20,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class TableTest extends CIUnitTestCase { private Table $table; @@ -58,9 +57,7 @@ public function testSetCaption(): void $this->assertSame('awesome cap', $this->table->caption); } - /** - * @depends testPrepArgs - */ + #[\PHPUnit\Framework\Attributes\Depends('testPrepArgs')] public function testSetHeading(): void { // uses _prep_args internally, so we'll just do a quick @@ -150,9 +147,7 @@ public function testSetFootingWithStyle(): void ); } - /** - * @depends testPrepArgs - */ + #[\PHPUnit\Framework\Attributes\Depends('testPrepArgs')] public function testAddRow(): void { // uses _prep_args internally, so we'll just do a quick @@ -783,9 +778,7 @@ public function testInvalidCallback(): void $this->assertStringContainsString('FredBlueSmall', $generated); } - /** - * @dataProvider orderedColumnUsecases - */ + #[\PHPUnit\Framework\Attributes\DataProvider('orderedColumnUsecases')] public function testAddRowAndGenerateOrderedColumns(array $heading, array $row, string $expectContainsString): void { $this->table->setHeading($heading); @@ -797,9 +790,7 @@ public function testAddRowAndGenerateOrderedColumns(array $heading, array $row, $this->assertStringContainsString($expectContainsString, $generated); } - /** - * @dataProvider orderedColumnUsecases - */ + #[\PHPUnit\Framework\Attributes\DataProvider('orderedColumnUsecases')] public function testGenerateOrderedColumns(array $heading, array $row, string $expectContainsString): void { $this->table->setHeading($heading); diff --git a/tests/system/View/ViewTest.php b/tests/system/View/ViewTest.php index 996db86be92a..9a51d9b2eab7 100644 --- a/tests/system/View/ViewTest.php +++ b/tests/system/View/ViewTest.php @@ -22,9 +22,8 @@ /** * @internal - * - * @group Others */ +#[\PHPUnit\Framework\Attributes\Group('Others')] final class ViewTest extends CIUnitTestCase { private FileLocator $loader; From add2bbd2a8b00ab610e9b9feb03cdad64475e772 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 23 Apr 2024 00:41:49 +0800 Subject: [PATCH 098/220] Adapt FrameworkCodeTest to recognize group attributes --- tests/system/AutoReview/FrameworkCodeTest.php | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index 346be42e736e..4fbc18e20c90 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -14,16 +14,18 @@ namespace CodeIgniter\AutoReview; use FilesystemIterator; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; +use ReflectionAttribute; use ReflectionClass; use SplFileInfo; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('AutoReview')] +#[Group('AutoReview')] final class FrameworkCodeTest extends TestCase { /** @@ -31,7 +33,7 @@ final class FrameworkCodeTest extends TestCase */ private static array $testClasses = []; - private static array $recognizedGroupAnnotations = [ + private static array $recognizedGroupAttributeNames = [ 'AutoReview', 'CacheLive', 'DatabaseLive', @@ -42,8 +44,8 @@ final class FrameworkCodeTest extends TestCase /** * @param class-string $class */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideEachTestClassHasCorrectGroupAnnotation')] - public function testEachTestClassHasCorrectGroupAnnotation(string $class): void + #[\PHPUnit\Framework\Attributes\DataProvider('provideEachTestClassHasCorrectGroupAttributeName')] + public function testEachTestClassHasCorrectGroupAttributeName(string $class): void { $reflection = new ReflectionClass($class); @@ -53,27 +55,31 @@ public function testEachTestClassHasCorrectGroupAnnotation(string $class): void return; } - $docComment = (string) $reflection->getDocComment(); - $this->assertNotEmpty($docComment, sprintf('[%s] Test class is missing a class-level PHPDoc.', $class)); + $attributes = $reflection->getAttributes(Group::class); + $this->assertNotEmpty($attributes, sprintf('[%s] Test class is missing a #[Group] attribute.', $class)); - preg_match_all('/@group (\S+)/', $docComment, $matches); - array_shift($matches); - $this->assertNotEmpty($matches[0], sprintf('[%s] Test class is missing a @group annotation.', $class)); + $unrecognizedGroups = array_diff( + array_map(static function (ReflectionAttribute $attribute): string { + $groupAttribute = $attribute->newInstance(); + assert($groupAttribute instanceof Group); - $unrecognizedGroups = array_diff($matches[0], self::$recognizedGroupAnnotations); + return $groupAttribute->name(); + }, $attributes), + self::$recognizedGroupAttributeNames + ); $this->assertEmpty($unrecognizedGroups, sprintf( - "[%s] Unexpected @group annotation%s:\n%s\nExpected annotations to be in \"%s\".", + "[%s] Unexpected #[Group] attribute%s:\n%s\nExpected group names to be in \"%s\".", $class, count($unrecognizedGroups) > 1 ? 's' : '', implode("\n", array_map( - static fn (string $group): string => sprintf(' * @group %s', $group), + static fn (string $group): string => sprintf(' * #[Group(\'%s\')]', $group), $unrecognizedGroups )), - implode(', ', self::$recognizedGroupAnnotations) + implode(', ', self::$recognizedGroupAttributeNames) )); } - public static function provideEachTestClassHasCorrectGroupAnnotation(): iterable + public static function provideEachTestClassHasCorrectGroupAttributeName(): iterable { foreach (self::getTestClasses() as $class) { yield $class => [$class]; From c841fb8343c9fbdd1070cf2c9c0815fbffb14181 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 23 Apr 2024 01:29:05 +0800 Subject: [PATCH 099/220] Run rector --- tests/system/API/ResponseTraitTest.php | 3 +- tests/system/AutoReview/ComposerJsonTest.php | 6 +- tests/system/AutoReview/FrameworkCodeTest.php | 3 +- tests/system/Autoloader/AutoloaderTest.php | 9 +- .../Autoloader/FileLocatorCachedTest.php | 3 +- tests/system/Autoloader/FileLocatorTest.php | 3 +- tests/system/CLI/CLITest.php | 6 +- tests/system/CLI/ConsoleTest.php | 3 +- tests/system/Cache/CacheFactoryTest.php | 3 +- tests/system/Cache/CacheMockTest.php | 3 +- .../Cache/FactoriesCacheFileHandlerTest.php | 3 +- ...FactoriesCacheFileVarExportHandlerTest.php | 3 +- .../system/Cache/Handlers/BaseHandlerTest.php | 6 +- .../Cache/Handlers/DummyHandlerTest.php | 3 +- .../system/Cache/Handlers/FileHandlerTest.php | 13 +- .../Cache/Handlers/MemcachedHandlerTest.php | 3 +- .../Cache/Handlers/PredisHandlerTest.php | 3 +- .../Cache/Handlers/RedisHandlerTest.php | 3 +- tests/system/Cache/ResponseCacheTest.php | 6 +- tests/system/CodeIgniterTest.php | 12 +- tests/system/Commands/BaseCommandTest.php | 3 +- tests/system/Commands/CellGeneratorTest.php | 3 +- tests/system/Commands/ClearCacheTest.php | 3 +- tests/system/Commands/ClearDebugbarTest.php | 3 +- tests/system/Commands/ClearLogsTest.php | 3 +- .../system/Commands/CommandGeneratorTest.php | 3 +- tests/system/Commands/CommandTest.php | 6 +- tests/system/Commands/ConfigGeneratorTest.php | 3 +- .../Commands/ConfigurableSortImportsTest.php | 3 +- .../Commands/ControllerGeneratorTest.php | 3 +- tests/system/Commands/CreateDatabaseTest.php | 3 +- .../Commands/Database/MigrateStatusTest.php | 3 +- .../Database/ShowTableInfoMockIOTest.php | 3 +- .../Commands/Database/ShowTableInfoTest.php | 3 +- .../system/Commands/DatabaseCommandsTest.php | 3 +- tests/system/Commands/EntityGeneratorTest.php | 3 +- .../Commands/EnvironmentCommandTest.php | 3 +- tests/system/Commands/FilterCheckTest.php | 3 +- tests/system/Commands/FilterGeneratorTest.php | 3 +- tests/system/Commands/GenerateKeyTest.php | 9 +- tests/system/Commands/GeneratorsTest.php | 3 +- tests/system/Commands/HelpCommandTest.php | 3 +- tests/system/Commands/InfoCacheTest.php | 3 +- .../Commands/MigrationGeneratorTest.php | 3 +- .../Commands/MigrationIntegrationTest.php | 3 +- tests/system/Commands/ModelGeneratorTest.php | 3 +- tests/system/Commands/PublishCommandTest.php | 3 +- tests/system/Commands/RoutesTest.php | 3 +- .../system/Commands/ScaffoldGeneratorTest.php | 3 +- tests/system/Commands/SeederGeneratorTest.php | 3 +- tests/system/Commands/TestGeneratorTest.php | 3 +- .../Translation/LocalizationFinderTest.php | 3 +- .../Commands/Utilities/ConfigCheckTest.php | 3 +- .../Commands/Utilities/NamespacesTest.php | 3 +- .../Routes/AutoRouteCollectorTest.php | 3 +- .../AutoRouteCollectorTest.php | 3 +- .../ControllerMethodReaderTest.php | 3 +- .../Utilities/Routes/ControllerFinderTest.php | 3 +- .../Routes/ControllerMethodReaderTest.php | 3 +- .../Utilities/Routes/FilterCollectorTest.php | 3 +- .../Utilities/Routes/FilterFinderTest.php | 3 +- .../Routes/SampleURIGeneratorTest.php | 6 +- .../Commands/ValidationGeneratorTest.php | 3 +- tests/system/CommonFunctionsSendTest.php | 9 +- tests/system/CommonFunctionsTest.php | 47 ++++--- tests/system/CommonHelperTest.php | 6 +- tests/system/CommonSingleServiceTest.php | 8 +- tests/system/Config/BaseConfigTest.php | 17 ++- tests/system/Config/DotEnvTest.php | 19 ++- tests/system/Config/FactoriesTest.php | 8 +- tests/system/Config/MimesTest.php | 8 +- tests/system/Config/ServicesTest.php | 33 +++-- tests/system/ControllerTest.php | 6 +- tests/system/Cookie/CookieStoreTest.php | 3 +- tests/system/Cookie/CookieTest.php | 10 +- .../DataConverter/DataConverterTest.php | 8 +- tests/system/Database/BaseConnectionTest.php | 10 +- tests/system/Database/BaseQueryTest.php | 8 +- tests/system/Database/Builder/AliasTest.php | 3 +- tests/system/Database/Builder/BaseTest.php | 3 +- tests/system/Database/Builder/CountTest.php | 3 +- tests/system/Database/Builder/DeleteTest.php | 3 +- .../system/Database/Builder/DistinctTest.php | 3 +- tests/system/Database/Builder/EmptyTest.php | 3 +- tests/system/Database/Builder/FromTest.php | 3 +- tests/system/Database/Builder/GetTest.php | 3 +- tests/system/Database/Builder/GroupTest.php | 3 +- tests/system/Database/Builder/InsertTest.php | 3 +- tests/system/Database/Builder/JoinTest.php | 3 +- tests/system/Database/Builder/LikeTest.php | 3 +- tests/system/Database/Builder/LimitTest.php | 3 +- tests/system/Database/Builder/OrderTest.php | 3 +- tests/system/Database/Builder/PrefixTest.php | 3 +- tests/system/Database/Builder/ReplaceTest.php | 3 +- tests/system/Database/Builder/SelectTest.php | 3 +- .../system/Database/Builder/TruncateTest.php | 3 +- tests/system/Database/Builder/UnionTest.php | 3 +- tests/system/Database/Builder/UpdateTest.php | 3 +- tests/system/Database/Builder/WhenTest.php | 3 +- tests/system/Database/Builder/WhereTest.php | 8 +- tests/system/Database/ConfigTest.php | 6 +- tests/system/Database/DatabaseSeederTest.php | 3 +- .../DatabaseTestCaseMigrationOnce1Test.php | 3 +- .../DatabaseTestCaseMigrationOnce2Test.php | 3 +- .../system/Database/DatabaseTestCaseTest.php | 3 +- .../system/Database/Forge/CreateTableTest.php | 3 +- .../Database/Forge/DropForeignKeyTest.php | 3 +- tests/system/Database/Live/AliasTest.php | 3 +- tests/system/Database/Live/BadQueryTest.php | 3 +- tests/system/Database/Live/ConnectTest.php | 3 +- tests/system/Database/Live/CountTest.php | 3 +- .../Live/DatabaseTestTraitCaseTest.php | 3 +- tests/system/Database/Live/DbDebugTest.php | 3 +- tests/system/Database/Live/DbUtilsTest.php | 3 +- tests/system/Database/Live/DeleteTest.php | 3 +- tests/system/Database/Live/EmptyTest.php | 3 +- tests/system/Database/Live/EscapeTest.php | 3 +- .../Database/Live/FabricatorLiveTest.php | 3 +- tests/system/Database/Live/ForgeTest.php | 3 +- tests/system/Database/Live/FromTest.php | 3 +- tests/system/Database/Live/GetNumRowsTest.php | 3 +- tests/system/Database/Live/GetTest.php | 3 +- tests/system/Database/Live/GetVersionTest.php | 3 +- tests/system/Database/Live/GroupTest.php | 3 +- tests/system/Database/Live/IncrementTest.php | 3 +- tests/system/Database/Live/InsertTest.php | 3 +- tests/system/Database/Live/JoinTest.php | 3 +- tests/system/Database/Live/LikeTest.php | 15 +- tests/system/Database/Live/LimitTest.php | 3 +- tests/system/Database/Live/MetadataTest.php | 3 +- .../Live/MySQLi/GetFieldDataTestCase.php | 3 +- .../Database/Live/MySQLi/NumberNativeTest.php | 3 +- .../Database/Live/MySQLi/RawSqlTest.php | 3 +- .../Live/OCI8/CallStoredProcedureTest.php | 3 +- .../Live/OCI8/GetFieldDataTestCase.php | 3 +- .../Database/Live/OCI8/LastInsertIDTest.php | 3 +- tests/system/Database/Live/OrderTest.php | 3 +- .../Live/Postgre/GetFieldDataTestCase.php | 3 +- .../Database/Live/PreparedQueryTest.php | 3 +- tests/system/Database/Live/PretendTest.php | 3 +- .../Live/SQLSRV/GetFieldDataTestCase.php | 3 +- .../Database/Live/SQLite3/AlterTableTest.php | 6 +- .../Live/SQLite3/ForgeModifyColumnTest.php | 3 +- .../Live/SQLite3/GetFieldDataTestCase.php | 3 +- .../Live/SQLite3/GetIndexDataTest.php | 3 +- tests/system/Database/Live/SelectTest.php | 3 +- .../Live/TransactionDBDebugFalseTest.php | 3 +- .../Live/TransactionDBDebugTrueTest.php | 3 +- .../system/Database/Live/TransactionTest.php | 3 +- tests/system/Database/Live/UnionTest.php | 3 +- tests/system/Database/Live/UpdateTest.php | 6 +- tests/system/Database/Live/UpsertTest.php | 3 +- tests/system/Database/Live/WhereTest.php | 3 +- .../Database/Live/WriteTypeQueryTest.php | 3 +- .../Migrations/MigrationRunnerTest.php | 3 +- .../Database/Migrations/MigrationTest.php | 3 +- tests/system/Database/RawSqlTest.php | 3 +- tests/system/Debug/ExceptionHandlerTest.php | 3 +- tests/system/Debug/ExceptionsTest.php | 6 +- tests/system/Debug/TimerTest.php | 3 +- .../Debug/Toolbar/Collectors/DatabaseTest.php | 3 +- .../Debug/Toolbar/Collectors/HistoryTest.php | 3 +- tests/system/DebugTraceableTraitTest.php | 6 +- tests/system/Email/EmailTest.php | 6 +- tests/system/Encryption/EncryptionTest.php | 3 +- .../Handlers/OpenSSLHandlerTest.php | 3 +- .../Encryption/Handlers/SodiumHandlerTest.php | 3 +- tests/system/Entity/EntityTest.php | 3 +- tests/system/Events/EventsTest.php | 9 +- tests/system/Files/FileCollectionTest.php | 3 +- tests/system/Files/FileTest.php | 3 +- tests/system/Files/FileWithVfsTest.php | 3 +- tests/system/Filters/CSRFTest.php | 6 +- tests/system/Filters/CorsTest.php | 3 +- tests/system/Filters/DebugToolbarTest.php | 6 +- tests/system/Filters/FiltersTest.php | 11 +- tests/system/Filters/HoneypotTest.php | 16 ++- tests/system/Filters/InvalidCharsTest.php | 15 +- tests/system/Filters/SecureHeadersTest.php | 3 +- tests/system/Format/FormatTest.php | 3 +- tests/system/Format/JSONFormatterTest.php | 3 +- tests/system/Format/XMLFormatterTest.php | 6 +- tests/system/HTTP/CLIRequestTest.php | 6 +- .../HTTP/CURLRequestShareOptionsTest.php | 3 +- tests/system/HTTP/CURLRequestTest.php | 8 +- .../system/HTTP/ContentSecurityPolicyTest.php | 129 +++++++++--------- tests/system/HTTP/CorsTest.php | 3 +- tests/system/HTTP/DownloadResponseTest.php | 9 +- .../system/HTTP/Files/FileCollectionTest.php | 3 +- tests/system/HTTP/Files/FileMovingTest.php | 3 +- tests/system/HTTP/HeaderTest.php | 3 +- .../HTTP/IncomingRequestDetectingTest.php | 6 +- tests/system/HTTP/IncomingRequestTest.php | 21 +-- tests/system/HTTP/MessageTest.php | 8 +- tests/system/HTTP/NegotiateTest.php | 3 +- tests/system/HTTP/OutgoingRequestTest.php | 3 +- tests/system/HTTP/RedirectExceptionTest.php | 3 +- tests/system/HTTP/RedirectResponseTest.php | 33 +++-- tests/system/HTTP/RequestTest.php | 6 +- tests/system/HTTP/ResponseCookieTest.php | 3 +- tests/system/HTTP/ResponseSendTest.php | 17 ++- tests/system/HTTP/ResponseTest.php | 8 +- .../SiteURIFactoryDetectRoutePathTest.php | 9 +- tests/system/HTTP/SiteURIFactoryTest.php | 11 +- tests/system/HTTP/SiteURITest.php | 11 +- tests/system/HTTP/URITest.php | 23 ++-- tests/system/HTTP/UserAgentTest.php | 3 +- .../Array/ArrayHelperDotKeyExistsTest.php | 3 +- .../Array/ArrayHelperRecursiveDiffTest.php | 3 +- .../ArrayHelperSortValuesByNaturalTest.php | 3 +- tests/system/Helpers/ArrayHelperTest.php | 20 +-- tests/system/Helpers/CookieHelperTest.php | 3 +- tests/system/Helpers/DateHelperTest.php | 3 +- tests/system/Helpers/FilesystemHelperTest.php | 3 +- tests/system/Helpers/FormHelperTest.php | 17 ++- tests/system/Helpers/HTMLHelperTest.php | 3 +- tests/system/Helpers/InflectorHelperTest.php | 6 +- tests/system/Helpers/NumberHelperTest.php | 3 +- tests/system/Helpers/SecurityHelperTest.php | 3 +- tests/system/Helpers/TextHelperTest.php | 3 +- .../Helpers/URLHelper/CurrentUrlTest.php | 13 +- .../system/Helpers/URLHelper/MiscUrlTest.php | 49 ++++--- .../Helpers/URLHelper/SiteUrlCliTest.php | 9 +- .../system/Helpers/URLHelper/SiteUrlTest.php | 9 +- tests/system/Helpers/XMLHelperTest.php | 3 +- tests/system/HomeTest.php | 3 +- tests/system/Honeypot/HoneypotTest.php | 6 +- .../HotReloader/DirectoryHasherTest.php | 3 +- tests/system/I18n/TimeDifferenceTest.php | 3 +- tests/system/I18n/TimeLegacyTest.php | 6 +- tests/system/I18n/TimeTest.php | 6 +- tests/system/Images/BaseHandlerTest.php | 3 +- tests/system/Images/GDHandlerTest.php | 3 +- .../system/Images/ImageMagickHandlerTest.php | 9 +- tests/system/Images/ImageTest.php | 3 +- tests/system/Language/LanguageTest.php | 6 +- .../Log/Handlers/ChromeLoggerHandlerTest.php | 3 +- .../Log/Handlers/ErrorlogHandlerTest.php | 3 +- tests/system/Log/Handlers/FileHandlerTest.php | 3 +- tests/system/Log/LoggerTest.php | 3 +- tests/system/Models/AffectedRowsTest.php | 3 +- tests/system/Models/CountAllModelTest.php | 3 +- .../system/Models/DataConverterModelTest.php | 3 +- tests/system/Models/DeleteModelTest.php | 14 +- tests/system/Models/EventsModelTest.php | 3 +- tests/system/Models/FindModelTest.php | 10 +- tests/system/Models/GeneralModelTest.php | 3 +- tests/system/Models/GetCompiledModelTest.php | 3 +- tests/system/Models/InsertModelTest.php | 3 +- .../system/Models/MiscellaneousModelTest.php | 3 +- tests/system/Models/PaginateModelTest.php | 3 +- tests/system/Models/ReplaceModelTest.php | 3 +- tests/system/Models/SaveModelTest.php | 3 +- tests/system/Models/TimestampModelTest.php | 3 +- tests/system/Models/UpdateModelTest.php | 6 +- .../Models/ValidationModelRuleGroupTest.php | 3 +- tests/system/Models/ValidationModelTest.php | 3 +- tests/system/Models/WhenWhenNotModelTest.php | 3 +- tests/system/Pager/PagerRendererTest.php | 3 +- tests/system/Pager/PagerTest.php | 6 +- .../system/Publisher/ContentReplacerTest.php | 3 +- .../Publisher/PublisherContentReplaceTest.php | 3 +- tests/system/Publisher/PublisherInputTest.php | 3 +- .../system/Publisher/PublisherOutputTest.php | 3 +- .../Publisher/PublisherRestrictionsTest.php | 8 +- .../system/Publisher/PublisherSupportTest.php | 3 +- .../system/RESTful/ResourceControllerTest.php | 9 +- .../system/RESTful/ResourcePresenterTest.php | 9 +- .../system/Router/AutoRouterImprovedTest.php | 8 +- .../Router/DefinedRouteCollectorTest.php | 3 +- .../RouteCollectionReverseRouteTest.php | 6 +- tests/system/Router/RouteCollectionTest.php | 12 +- tests/system/Router/RouterTest.php | 6 +- tests/system/Security/CheckPhpIniTest.php | 3 +- .../SecurityCSRFCookieRandomizeTokenTest.php | 3 +- .../SecurityCSRFSessionRandomizeTokenTest.php | 9 +- .../Security/SecurityCSRFSessionTest.php | 9 +- tests/system/Security/SecurityTest.php | 6 +- .../Handlers/Database/MySQLiHandlerTest.php | 3 +- .../Handlers/Database/PostgreHandlerTest.php | 3 +- .../Handlers/Database/RedisHandlerTest.php | 9 +- tests/system/Session/SessionTest.php | 9 +- tests/system/SparkTest.php | 3 +- tests/system/SuperglobalsTest.php | 3 +- tests/system/Test/BootstrapFCPATHTest.php | 3 +- tests/system/Test/ControllerTestTraitTest.php | 9 +- tests/system/Test/DOMParserTest.php | 8 +- tests/system/Test/FabricatorTest.php | 3 +- .../FeatureTestAutoRoutingImprovedTest.php | 3 +- tests/system/Test/FeatureTestTraitTest.php | 6 +- tests/system/Test/FilterTestTraitTest.php | 3 +- tests/system/Test/IniTestTraitTest.php | 3 +- tests/system/Test/ReflectionHelperTest.php | 3 +- tests/system/Test/TestCaseEmissionsTest.php | 13 +- tests/system/Test/TestCaseTest.php | 3 +- tests/system/Test/TestLoggerTest.php | 6 +- tests/system/Test/TestResponseTest.php | 8 +- tests/system/Throttle/ThrottleTest.php | 6 +- tests/system/Typography/TypographyTest.php | 3 +- .../system/Validation/CreditCardRulesTest.php | 6 +- .../Validation/DatabaseRelatedRulesTest.php | 3 +- .../system/Validation/DotArrayFilterTest.php | 3 +- tests/system/Validation/FileRulesTest.php | 3 +- tests/system/Validation/FormatRulesTest.php | 52 +++---- tests/system/Validation/RulesTest.php | 52 +++---- .../StrictRules/CreditCardRulesTest.php | 6 +- .../StrictRules/DatabaseRelatedRulesTest.php | 3 +- .../Validation/StrictRules/FileRulesTest.php | 3 +- .../StrictRules/FormatRulesTest.php | 3 +- .../Validation/StrictRules/RulesTest.php | 18 +-- .../Validation/StrictRules/ValidationTest.php | 3 +- tests/system/Validation/ValidationTest.php | 20 +-- tests/system/View/CellTest.php | 3 +- tests/system/View/ControlledCellTest.php | 3 +- tests/system/View/DecoratorsTest.php | 3 +- tests/system/View/ParserFilterTest.php | 3 +- tests/system/View/ParserPluginTest.php | 11 +- tests/system/View/ParserTest.php | 6 +- tests/system/View/TableTest.php | 13 +- tests/system/View/ViewTest.php | 3 +- 320 files changed, 1182 insertions(+), 725 deletions(-) diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index 357acf1ad0ef..fc2c4dea2467 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\API; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Format\FormatterInterface; use CodeIgniter\Format\JSONFormatter; @@ -29,7 +30,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ResponseTraitTest extends CIUnitTestCase { private ?MockIncomingRequest $request = null; diff --git a/tests/system/AutoReview/ComposerJsonTest.php b/tests/system/AutoReview/ComposerJsonTest.php index 83f49e499beb..89f4dcdeec29 100644 --- a/tests/system/AutoReview/ComposerJsonTest.php +++ b/tests/system/AutoReview/ComposerJsonTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\AutoReview; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; use InvalidArgumentException; use JsonException; use PHPUnit\Framework\TestCase; @@ -20,8 +22,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\CoversNothing] -#[\PHPUnit\Framework\Attributes\Group('AutoReview')] +#[CoversNothing] +#[Group('AutoReview')] final class ComposerJsonTest extends TestCase { private array $devComposer; diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index 4fbc18e20c90..fcbd5851dbc1 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\AutoReview; +use PHPUnit\Framework\Attributes\DataProvider; use FilesystemIterator; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -44,7 +45,7 @@ final class FrameworkCodeTest extends TestCase /** * @param class-string $class */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideEachTestClassHasCorrectGroupAttributeName')] + #[DataProvider('provideEachTestClassHasCorrectGroupAttributeName')] public function testEachTestClassHasCorrectGroupAttributeName(string $class): void { $reflection = new ReflectionClass($class); diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index 08432101eb3b..74d3a4cace3b 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Autoloader; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use App\Controllers\Home; use Closure; use CodeIgniter\Exceptions\ConfigException; @@ -28,7 +31,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class AutoloaderTest extends CIUnitTestCase { use ReflectionHelper; @@ -389,8 +392,8 @@ public function testAutoloaderLoadsNonClassFiles(): void $loader->unregister(); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testLoadHelpers(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/Autoloader/FileLocatorCachedTest.php b/tests/system/Autoloader/FileLocatorCachedTest.php index 5348207f9aa7..68bb9245dfdd 100644 --- a/tests/system/Autoloader/FileLocatorCachedTest.php +++ b/tests/system/Autoloader/FileLocatorCachedTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Autoloader; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\FactoriesCache\FileVarExportHandler; use Config\Autoload; use Config\Modules; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileLocatorCachedTest extends FileLocatorTest { private FileVarExportHandler $handler; diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index 38d2eb98f751..8c185bbae6ea 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Autoloader; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Header; use CodeIgniter\Test\CIUnitTestCase; use Config\Autoload; @@ -23,7 +24,7 @@ * * @no-final */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] class FileLocatorTest extends CIUnitTestCase { protected FileLocatorInterface $locator; diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 062ffda752da..063f4dace051 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\CLI; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\PhpStreamWrapper; use CodeIgniter\Test\StreamFilterTrait; @@ -22,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CLITest extends CIUnitTestCase { use StreamFilterTrait; @@ -455,7 +457,7 @@ public function testWindow(): void * @param array $thead * @param array $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideTable')] + #[DataProvider('provideTable')] public function testTable($tbody, $thead, $expected): void { CLI::table($tbody, $thead); diff --git a/tests/system/CLI/ConsoleTest.php b/tests/system/CLI/ConsoleTest.php index b0100693344c..116e480f5563 100644 --- a/tests/system/CLI/ConsoleTest.php +++ b/tests/system/CLI/ConsoleTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\CLI; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CodeIgniter; use CodeIgniter\Config\DotEnv; use CodeIgniter\Events\Events; @@ -24,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ConsoleTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Cache/CacheFactoryTest.php b/tests/system/Cache/CacheFactoryTest.php index 4694dd98fb20..2a2150509001 100644 --- a/tests/system/Cache/CacheFactoryTest.php +++ b/tests/system/Cache/CacheFactoryTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Cache; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\Exceptions\CacheException; use CodeIgniter\Cache\Handlers\DummyHandler; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CacheFactoryTest extends CIUnitTestCase { private static string $directory = 'CacheFactory'; diff --git a/tests/system/Cache/CacheMockTest.php b/tests/system/Cache/CacheMockTest.php index 4275bc16bffd..6a1361d1b972 100644 --- a/tests/system/Cache/CacheMockTest.php +++ b/tests/system/Cache/CacheMockTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Cache; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\Handlers\BaseHandler; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockCache; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CacheMockTest extends CIUnitTestCase { public function testMockReturnsMockCacheClass(): void diff --git a/tests/system/Cache/FactoriesCacheFileHandlerTest.php b/tests/system/Cache/FactoriesCacheFileHandlerTest.php index 9cd3e1f182e6..769bfd2cb2db 100644 --- a/tests/system/Cache/FactoriesCacheFileHandlerTest.php +++ b/tests/system/Cache/FactoriesCacheFileHandlerTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Cache; +use PHPUnit\Framework\Attributes\Group; use Config\Cache as CacheConfig; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FactoriesCacheFileHandlerTest extends FactoriesCacheFileVarExportHandlerTest { /** diff --git a/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php b/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php index 0d1fe0b4446b..690674ccf810 100644 --- a/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php +++ b/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Cache; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\FactoriesCache\FileVarExportHandler; use CodeIgniter\Config\Factories; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ * @internal * @no-final */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] class FactoriesCacheFileVarExportHandlerTest extends CIUnitTestCase { protected FactoriesCache $cache; diff --git a/tests/system/Cache/Handlers/BaseHandlerTest.php b/tests/system/Cache/Handlers/BaseHandlerTest.php index 02e6c9907c1b..55b51abcc7cd 100644 --- a/tests/system/Cache/Handlers/BaseHandlerTest.php +++ b/tests/system/Cache/Handlers/BaseHandlerTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Cache\Handlers; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use stdClass; use Tests\Support\Cache\RestrictiveHandler; @@ -20,13 +22,13 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class BaseHandlerTest extends CIUnitTestCase { /** * @param mixed $input */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidateKeyInvalidType')] + #[DataProvider('provideValidateKeyInvalidType')] public function testValidateKeyInvalidType($input): void { $this->expectException('InvalidArgumentException'); diff --git a/tests/system/Cache/Handlers/DummyHandlerTest.php b/tests/system/Cache/Handlers/DummyHandlerTest.php index 363882bfb818..09782e3a699b 100644 --- a/tests/system/Cache/Handlers/DummyHandlerTest.php +++ b/tests/system/Cache/Handlers/DummyHandlerTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Cache\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DummyHandlerTest extends CIUnitTestCase { private DummyHandler $handler; diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index 927c2a912fc3..4cd0f638893c 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Cache\Handlers; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresOperatingSystem; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Cache\Exceptions\CacheException; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; @@ -21,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileHandlerTest extends AbstractHandlerTestCase { private static string $directory = 'FileHandler'; @@ -86,7 +89,7 @@ public function testNew(): void /** * chmod('path', 0444) does not work on Windows */ - #[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux|Darwin')] + #[RequiresOperatingSystem('Linux|Darwin')] public function testNewWithNonWritablePath(): void { $this->expectException(CacheException::class); @@ -144,7 +147,7 @@ public function testRemember(): void /** * chmod('path', 0444) does not work on Windows */ - #[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux|Darwin')] + #[RequiresOperatingSystem('Linux|Darwin')] public function testSave(): void { $this->assertTrue($this->handler->save(self::$key1, 'value')); @@ -306,8 +309,8 @@ public function testIsSupported(): void $this->assertTrue($this->handler->isSupported()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSaveMode')] - #[\PHPUnit\Framework\Attributes\RequiresOperatingSystem('Linux|Darwin')] + #[DataProvider('provideSaveMode')] + #[RequiresOperatingSystem('Linux|Darwin')] public function testSaveMode(int $int, string $string): void { // Initialize mode diff --git a/tests/system/Cache/Handlers/MemcachedHandlerTest.php b/tests/system/Cache/Handlers/MemcachedHandlerTest.php index a5aca356aa90..16990f5c87e3 100644 --- a/tests/system/Cache/Handlers/MemcachedHandlerTest.php +++ b/tests/system/Cache/Handlers/MemcachedHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Cache\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; use Config\Cache; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('CacheLive')] +#[Group('CacheLive')] 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 209c7ea45509..341ea6dcc62d 100644 --- a/tests/system/Cache/Handlers/PredisHandlerTest.php +++ b/tests/system/Cache/Handlers/PredisHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Cache\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; use Config\Cache; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('CacheLive')] +#[Group('CacheLive')] 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 39e194a82bf1..67ba3c5ebde0 100644 --- a/tests/system/Cache/Handlers/RedisHandlerTest.php +++ b/tests/system/Cache/Handlers/RedisHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Cache\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; use Config\Cache; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('CacheLive')] +#[Group('CacheLive')] final class RedisHandlerTest extends AbstractHandlerTestCase { private Cache $config; diff --git a/tests/system/Cache/ResponseCacheTest.php b/tests/system/Cache/ResponseCacheTest.php index 5acdc756d24b..8ba6d85c8d62 100644 --- a/tests/system/Cache/ResponseCacheTest.php +++ b/tests/system/Cache/ResponseCacheTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Cache; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Response; @@ -28,8 +30,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class ResponseCacheTest extends CIUnitTestCase { private AppConfig $appConfig; diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index f0680cec2a85..33368fb5cb73 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -13,6 +13,10 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use App\Controllers\Home; use CodeIgniter\Config\Services; use CodeIgniter\Debug\Timer; @@ -36,9 +40,9 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[RunTestsInSeparateProcesses] +#[BackupGlobals(true)] +#[Group('Others')] final class CodeIgniterTest extends CIUnitTestCase { private CodeIgniter $codeigniter; @@ -838,7 +842,7 @@ public function testPageCacheSendSecureHeaders(): void * * @see https://github.com/codeigniter4/CodeIgniter4/pull/6410 */ - #[\PHPUnit\Framework\Attributes\DataProvider('providePageCacheWithCacheQueryString')] + #[DataProvider('providePageCacheWithCacheQueryString')] public function testPageCacheWithCacheQueryString( $cacheQueryStringValue, int $expectedPagesInCache, diff --git a/tests/system/Commands/BaseCommandTest.php b/tests/system/Commands/BaseCommandTest.php index 2ca2138a6b9a..b9a05d51eae5 100644 --- a/tests/system/Commands/BaseCommandTest.php +++ b/tests/system/Commands/BaseCommandTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Log\Logger; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class BaseCommandTest extends CIUnitTestCase { private Logger $logger; diff --git a/tests/system/Commands/CellGeneratorTest.php b/tests/system/Commands/CellGeneratorTest.php index e13fa624f5c2..a8f4bdb460b9 100644 --- a/tests/system/Commands/CellGeneratorTest.php +++ b/tests/system/Commands/CellGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CellGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ClearCacheTest.php b/tests/system/Commands/ClearCacheTest.php index 0f68a8229a6b..7221edc43b63 100644 --- a/tests/system/Commands/ClearCacheTest.php +++ b/tests/system/Commands/ClearCacheTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\CacheFactory; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ClearCacheTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ClearDebugbarTest.php b/tests/system/Commands/ClearDebugbarTest.php index 6c17d5c28a3c..51635e5f0307 100644 --- a/tests/system/Commands/ClearDebugbarTest.php +++ b/tests/system/Commands/ClearDebugbarTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ClearDebugbarTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ClearLogsTest.php b/tests/system/Commands/ClearLogsTest.php index 247b3fe1f6f3..4a559300ed95 100644 --- a/tests/system/Commands/ClearLogsTest.php +++ b/tests/system/Commands/ClearLogsTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ClearLogsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/CommandGeneratorTest.php b/tests/system/Commands/CommandGeneratorTest.php index 0efb8b80352f..a8d9d93de14b 100644 --- a/tests/system/Commands/CommandGeneratorTest.php +++ b/tests/system/Commands/CommandGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CommandGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index 02bcd465c542..a687474cb87e 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\CLI\Commands; use CodeIgniter\Log\Logger; use CodeIgniter\Test\CIUnitTestCase; @@ -23,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CommandTest extends CIUnitTestCase { use StreamFilterTrait; @@ -128,7 +130,7 @@ public function testInexistentCommandsButWithManyAlternatives(): void $this->assertStringContainsString(':clear', $this->getBuffer()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideCommandParsesArgsCorrectly')] + #[DataProvider('provideCommandParsesArgsCorrectly')] public function testCommandParsesArgsCorrectly(string $input, array $expected): void { ParamsReveal::$args = null; diff --git a/tests/system/Commands/ConfigGeneratorTest.php b/tests/system/Commands/ConfigGeneratorTest.php index 145b7e7af1cc..45068084da30 100644 --- a/tests/system/Commands/ConfigGeneratorTest.php +++ b/tests/system/Commands/ConfigGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ConfigGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ConfigurableSortImportsTest.php b/tests/system/Commands/ConfigurableSortImportsTest.php index 23b6b6424732..bd0df985dd76 100644 --- a/tests/system/Commands/ConfigurableSortImportsTest.php +++ b/tests/system/Commands/ConfigurableSortImportsTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ConfigurableSortImportsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ControllerGeneratorTest.php b/tests/system/Commands/ControllerGeneratorTest.php index 5e86a0bbb337..d41c34535b55 100644 --- a/tests/system/Commands/ControllerGeneratorTest.php +++ b/tests/system/Commands/ControllerGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ControllerGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/CreateDatabaseTest.php b/tests/system/Commands/CreateDatabaseTest.php index 8bc4489533e9..e6bdfc2f3b51 100644 --- a/tests/system/Commands/CreateDatabaseTest.php +++ b/tests/system/Commands/CreateDatabaseTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Database\Database as DatabaseFactory; use CodeIgniter\Database\OCI8\Connection as OCI8Connection; @@ -24,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class CreateDatabaseTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Database/MigrateStatusTest.php b/tests/system/Commands/Database/MigrateStatusTest.php index 9fc3cd370b6b..9e4324cf725c 100644 --- a/tests/system/Commands/Database/MigrateStatusTest.php +++ b/tests/system/Commands/Database/MigrateStatusTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Database; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class MigrateStatusTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Database/ShowTableInfoMockIOTest.php b/tests/system/Commands/Database/ShowTableInfoMockIOTest.php index 44130bd6b6d4..ac9a20f84d75 100644 --- a/tests/system/Commands/Database/ShowTableInfoMockIOTest.php +++ b/tests/system/Commands/Database/ShowTableInfoMockIOTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Database; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ShowTableInfoMockIOTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Commands/Database/ShowTableInfoTest.php b/tests/system/Commands/Database/ShowTableInfoTest.php index 97dbc26b5bf5..da845f7a1710 100644 --- a/tests/system/Commands/Database/ShowTableInfoTest.php +++ b/tests/system/Commands/Database/ShowTableInfoTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Database; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ShowTableInfoTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Commands/DatabaseCommandsTest.php b/tests/system/Commands/DatabaseCommandsTest.php index 5df1e5ba761d..4e90d52e7dfd 100644 --- a/tests/system/Commands/DatabaseCommandsTest.php +++ b/tests/system/Commands/DatabaseCommandsTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DatabaseCommandsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/EntityGeneratorTest.php b/tests/system/Commands/EntityGeneratorTest.php index b5c35c809adb..e694cd74819e 100644 --- a/tests/system/Commands/EntityGeneratorTest.php +++ b/tests/system/Commands/EntityGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class EntityGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/EnvironmentCommandTest.php b/tests/system/Commands/EnvironmentCommandTest.php index 54a6fe2fae00..eff814707356 100644 --- a/tests/system/Commands/EnvironmentCommandTest.php +++ b/tests/system/Commands/EnvironmentCommandTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class EnvironmentCommandTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/FilterCheckTest.php b/tests/system/Commands/FilterCheckTest.php index 52bf0edae044..b63e4b774cdc 100644 --- a/tests/system/Commands/FilterCheckTest.php +++ b/tests/system/Commands/FilterCheckTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FilterCheckTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/FilterGeneratorTest.php b/tests/system/Commands/FilterGeneratorTest.php index 80a7bbb6a981..8a00ed717e0b 100644 --- a/tests/system/Commands/FilterGeneratorTest.php +++ b/tests/system/Commands/FilterGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FilterGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php index 42d27c7604c9..d6d36cfbfaa7 100644 --- a/tests/system/Commands/GenerateKeyTest.php +++ b/tests/system/Commands/GenerateKeyTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Filters\CITestStreamFilter; use CodeIgniter\Test\StreamFilterTrait; @@ -20,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class GenerateKeyTest extends CIUnitTestCase { use StreamFilterTrait; @@ -85,8 +88,8 @@ public function testGenerateKeyShowsEncodedKey(): void $this->assertStringContainsString('hex2bin:', $this->getBuffer()); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testGenerateKeyCreatesNewKey(): void { command('key:generate'); diff --git a/tests/system/Commands/GeneratorsTest.php b/tests/system/Commands/GeneratorsTest.php index 5677c5daba73..99d7ceb51281 100644 --- a/tests/system/Commands/GeneratorsTest.php +++ b/tests/system/Commands/GeneratorsTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class GeneratorsTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/HelpCommandTest.php b/tests/system/Commands/HelpCommandTest.php index 3370f14f0f92..a05b5ebca0fa 100644 --- a/tests/system/Commands/HelpCommandTest.php +++ b/tests/system/Commands/HelpCommandTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class HelpCommandTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/InfoCacheTest.php b/tests/system/Commands/InfoCacheTest.php index c894d0ce24e0..c157bd9e8a4a 100644 --- a/tests/system/Commands/InfoCacheTest.php +++ b/tests/system/Commands/InfoCacheTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\CacheFactory; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class InfoCacheTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/MigrationGeneratorTest.php b/tests/system/Commands/MigrationGeneratorTest.php index 302fdafc544e..d6cb31dbc28f 100644 --- a/tests/system/Commands/MigrationGeneratorTest.php +++ b/tests/system/Commands/MigrationGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class MigrationGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/MigrationIntegrationTest.php b/tests/system/Commands/MigrationIntegrationTest.php index 75c5cc00ea44..90f7c1b01166 100644 --- a/tests/system/Commands/MigrationIntegrationTest.php +++ b/tests/system/Commands/MigrationIntegrationTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class MigrationIntegrationTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ModelGeneratorTest.php b/tests/system/Commands/ModelGeneratorTest.php index c78f29a41010..3108be0c1971 100644 --- a/tests/system/Commands/ModelGeneratorTest.php +++ b/tests/system/Commands/ModelGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ModelGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/PublishCommandTest.php b/tests/system/Commands/PublishCommandTest.php index c44f7bb6cbad..4494f8418be0 100644 --- a/tests/system/Commands/PublishCommandTest.php +++ b/tests/system/Commands/PublishCommandTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Tests\Support\Publishers\TestPublisher; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PublishCommandTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index 4260d6885208..2d25b178bec4 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Router\RouteCollection; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class RoutesTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/ScaffoldGeneratorTest.php b/tests/system/Commands/ScaffoldGeneratorTest.php index 28682b5c53a4..7e9f7ce91184 100644 --- a/tests/system/Commands/ScaffoldGeneratorTest.php +++ b/tests/system/Commands/ScaffoldGeneratorTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Autoload; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ScaffoldGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/SeederGeneratorTest.php b/tests/system/Commands/SeederGeneratorTest.php index 278244217640..a0f678e67715 100644 --- a/tests/system/Commands/SeederGeneratorTest.php +++ b/tests/system/Commands/SeederGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SeederGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/TestGeneratorTest.php b/tests/system/Commands/TestGeneratorTest.php index 5a8936d7dee6..5641a9a62c53 100644 --- a/tests/system/Commands/TestGeneratorTest.php +++ b/tests/system/Commands/TestGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TestGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Translation/LocalizationFinderTest.php b/tests/system/Commands/Translation/LocalizationFinderTest.php index 60046829b801..88224ceb4f33 100644 --- a/tests/system/Commands/Translation/LocalizationFinderTest.php +++ b/tests/system/Commands/Translation/LocalizationFinderTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Translation; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\App; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class LocalizationFinderTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Utilities/ConfigCheckTest.php b/tests/system/Commands/Utilities/ConfigCheckTest.php index d5fcf9b20498..4bc2bf4dce3d 100644 --- a/tests/system/Commands/Utilities/ConfigCheckTest.php +++ b/tests/system/Commands/Utilities/ConfigCheckTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Utilities; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\App; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ConfigCheckTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index 198a1a710c7e..efb95c58d3ac 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands\Utilities; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class NamespacesTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php index 25fd288bd5e1..77381e83617f 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Commands\Utilities\Routes; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class AutoRouteCollectorTest extends CIUnitTestCase { public function testGet(): void diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php index cf1e9e0a5e61..78636caeaee0 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Method; use CodeIgniter\Test\CIUnitTestCase; use Config\Filters; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class AutoRouteCollectorTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php index ee9e339283ad..44c2a69e8662 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers\Dash_folder\Dash_controller; use CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers\Home; use CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers\SubDir\BlogController; @@ -25,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ControllerMethodReaderTest extends CIUnitTestCase { private function createControllerMethodReader( diff --git a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php index ee74ca9dcdce..acfe87d82bc9 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands\Utilities\Routes; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Tests\Support\Controllers\Hello; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ControllerFinderTest extends CIUnitTestCase { public function testFind(): void diff --git a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php index d48e470e8dd6..2a44d79756fe 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Utilities\Routes; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Tests\Support\Controllers\Popcorn; use Tests\Support\Controllers\Remap; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ControllerMethodReaderTest extends CIUnitTestCase { public function testRead(): void diff --git a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php index d213c2eb5b50..07d7f0dc76e8 100644 --- a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Utilities\Routes; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Method; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FilterCollectorTest extends CIUnitTestCase { public function testGet(): void diff --git a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php index 492686122e80..387da092b697 100644 --- a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Commands\Utilities\Routes; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Filters\CSRF; use CodeIgniter\Filters\DebugToolbar; @@ -33,7 +34,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FilterFinderTest extends CIUnitTestCase { use ConfigFromArrayTrait; diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index ddae1636396f..eef413ebe73a 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -13,16 +13,18 @@ namespace CodeIgniter\Commands\Utilities\Routes; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SampleURIGeneratorTest extends CIUnitTestCase { - #[\PHPUnit\Framework\Attributes\DataProvider('provideGet')] + #[DataProvider('provideGet')] public function testGet(string $routeKey, string $expected): void { $generator = new SampleURIGenerator(); diff --git a/tests/system/Commands/ValidationGeneratorTest.php b/tests/system/Commands/ValidationGeneratorTest.php index 7fd20feeaa6d..6fdaddd55b28 100644 --- a/tests/system/Commands/ValidationGeneratorTest.php +++ b/tests/system/Commands/ValidationGeneratorTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Commands; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ValidationGeneratorTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/CommonFunctionsSendTest.php b/tests/system/CommonFunctionsSendTest.php index 6e0b8b342451..f389efb2366a 100644 --- a/tests/system/CommonFunctionsSendTest.php +++ b/tests/system/CommonFunctionsSendTest.php @@ -13,12 +13,15 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class CommonFunctionsSendTest extends CIUnitTestCase { protected function setUp(): void @@ -36,8 +39,8 @@ protected function setUp(): void * Make sure cookies are set by RedirectResponse this way * See https://github.com/codeigniter4/CodeIgniter4/issues/1393 */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testRedirectResponseCookiesSent(): void { $loginTime = time(); diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index b57458414fa7..308d45d5dec2 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -13,6 +13,11 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\BaseService; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\CLIRequest; @@ -48,8 +53,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[BackupGlobals(true)] +#[Group('SeparateProcess')] final class CommonFunctionsTest extends CIUnitTestCase { private ?App $config = null; @@ -267,8 +272,8 @@ public function testEscapeRecursiveArrayRaw(): void $this->assertSame($data, esc($data, 'raw')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSessionInstance(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -280,8 +285,8 @@ public function testSessionInstance(): void $this->assertInstanceOf(Session::class, session()); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSessionVariable(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -295,8 +300,8 @@ public function testSessionVariable(): void $this->assertSame('Hi there', session('notbogus')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSessionVariableNotThere(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -421,8 +426,8 @@ public function testModelExistsAbsoluteClassname(): void $this->assertInstanceOf(JobModel::class, model(JobModel::class)); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testOldInput(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -458,8 +463,8 @@ public function testOldInput(): void $this->assertSame('fritz', old('zibble')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testOldInputSerializeData(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -496,8 +501,8 @@ public function testOldInputSerializeData(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492 */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testOldInputArray(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -615,8 +620,8 @@ public function testRedirectResponseCookies1(): void $this->assertTrue($answer1->hasCookie('login_time')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testTrace(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -640,8 +645,8 @@ public function testViewNotSaveData(): void $this->assertStringContainsString('

is_not

', view('\Tests\Support\View\Views\simples')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testForceHttpsNullRequestAndResponse(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -695,7 +700,7 @@ public function testForceHttpsWithBaseUrlSubFolder(): void * @param mixed $input * @param mixed $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideCleanPathActuallyCleaningThePaths')] + #[DataProvider('provideCleanPathActuallyCleaningThePaths')] public function testCleanPathActuallyCleaningThePaths($input, $expected): void { $this->assertSame($expected, clean_path($input)); @@ -756,8 +761,8 @@ public function testDWithCSP(): void Kint::$cli_detection = $cliDetection; } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testTraceWithCSP(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/CommonHelperTest.php b/tests/system/CommonHelperTest.php index e0d51327a525..29b60dc472a3 100644 --- a/tests/system/CommonHelperTest.php +++ b/tests/system/CommonHelperTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\CoversFunction; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; @@ -23,8 +25,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] -#[\PHPUnit\Framework\Attributes\CoversFunction('helper')] +#[Group('Others')] +#[CoversFunction('helper')] final class CommonHelperTest extends CIUnitTestCase { private array $dummyHelpers = [ diff --git a/tests/system/CommonSingleServiceTest.php b/tests/system/CommonSingleServiceTest.php index f85d8101a0c6..59c07c7f4ff1 100644 --- a/tests/system/CommonSingleServiceTest.php +++ b/tests/system/CommonSingleServiceTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; @@ -24,10 +26,10 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CommonSingleServiceTest extends CIUnitTestCase { - #[\PHPUnit\Framework\Attributes\DataProvider('provideServiceNames')] + #[DataProvider('provideServiceNames')] public function testSingleServiceWithNoParamsSupplied(string $service): void { Services::injectMock('security', new MockSecurity(new SecurityConfig())); @@ -41,7 +43,7 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void $this->assertNotSame($service1, $service2); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideServiceNames')] + #[DataProvider('provideServiceNames')] public function testSingleServiceWithAtLeastOneParamSupplied(string $service): void { if ($service === 'commands') { diff --git a/tests/system/Config/BaseConfigTest.php b/tests/system/Config/BaseConfigTest.php index f17dc71fb6c5..89ecfdabff8c 100644 --- a/tests/system/Config/BaseConfigTest.php +++ b/tests/system/Config/BaseConfigTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Config; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; @@ -27,7 +30,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class BaseConfigTest extends CIUnitTestCase { private string $fixturesFolder; @@ -98,8 +101,8 @@ public function testUseDefaultValueTypeStringValue(): void $this->assertSame('123456', $config->password); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testServerValues(): void { $_SERVER = [ @@ -192,8 +195,8 @@ public function testSetsDefaultValues(): void $this->assertSame('bar', $config->second); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void { $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); @@ -205,8 +208,8 @@ public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void $this->assertSame('OpenSSL', $config->driver); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSetDefaultValuesEncryptionUsingBase64(): void { $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); diff --git a/tests/system/Config/DotEnvTest.php b/tests/system/Config/DotEnvTest.php index 9e47578206ed..218940a46e01 100644 --- a/tests/system/Config/DotEnvTest.php +++ b/tests/system/Config/DotEnvTest.php @@ -13,6 +13,11 @@ namespace CodeIgniter\Config; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; @@ -21,8 +26,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[BackupGlobals(true)] +#[Group('SeparateProcess')] final class DotEnvTest extends CIUnitTestCase { private ?vfsStreamDirectory $root; @@ -60,7 +65,7 @@ public function testReturnsFalseIfCannotFindFile(): void $this->assertFalse($dotenv->load()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideLoadsVars')] + #[DataProvider('provideLoadsVars')] public function testLoadsVars(string $expected, string $varname): void { $dotenv = new DotEnv($this->fixturesFolder); @@ -84,8 +89,8 @@ public static function provideLoadsVars(): iterable ]; } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testLoadsHex2Bin(): void { $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); @@ -96,8 +101,8 @@ public function testLoadsHex2Bin(): void $this->assertSame('OpenSSL', getenv('encryption.driver')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testLoadsBase64(): void { $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); diff --git a/tests/system/Config/FactoriesTest.php b/tests/system/Config/FactoriesTest.php index dbb2aec291da..73c7c0363947 100644 --- a/tests/system/Config/FactoriesTest.php +++ b/tests/system/Config/FactoriesTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Config; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Depends; use CodeIgniter\Test\CIUnitTestCase; use Config\App; use Config\Database; @@ -29,7 +31,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FactoriesTest extends CIUnitTestCase { protected function setUp(): void @@ -437,7 +439,7 @@ public function testGetComponentInstances() return $data; } - #[\PHPUnit\Framework\Attributes\Depends('testGetComponentInstances')] + #[Depends('testGetComponentInstances')] public function testSetComponentInstances(array $data) { $before = Factories::getComponentInstances('config'); @@ -454,7 +456,7 @@ public function testSetComponentInstances(array $data) return $data; } - #[\PHPUnit\Framework\Attributes\Depends('testSetComponentInstances')] + #[Depends('testSetComponentInstances')] public function testIsUpdated(array $data): void { Factories::reset(); diff --git a/tests/system/Config/MimesTest.php b/tests/system/Config/MimesTest.php index daa377ff9e34..25b3f9a50011 100644 --- a/tests/system/Config/MimesTest.php +++ b/tests/system/Config/MimesTest.php @@ -13,13 +13,15 @@ namespace CodeIgniter\Config; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Mimes; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class MimesTest extends CIUnitTestCase { public static function provideGuessExtensionFromType(): iterable @@ -48,7 +50,7 @@ public static function provideGuessExtensionFromType(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideGuessExtensionFromType')] + #[DataProvider('provideGuessExtensionFromType')] public function testGuessExtensionFromType(?string $expected, string $mime): void { $this->assertSame($expected, Mimes::guessExtensionFromType($mime)); @@ -80,7 +82,7 @@ public static function provideGuessTypeFromExtension(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideGuessTypeFromExtension')] + #[DataProvider('provideGuessTypeFromExtension')] public function testGuessTypeFromExtension(?string $expected, string $ext): void { $this->assertSame($expected, Mimes::guessTypeFromExtension($ext)); diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index 177091dc5c07..c6735c4e2158 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Config; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Autoloader\Autoloader; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Database\MigrationRunner; @@ -52,7 +55,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class ServicesTest extends CIUnitTestCase { private array $original; @@ -240,24 +243,24 @@ public function testNewViewcell(): void $this->assertInstanceOf(Cell::class, $actual); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testNewSession(): void { $actual = Services::session(); $this->assertInstanceOf(Session::class, $actual); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testNewSessionWithNullConfig(): void { $actual = Services::session(null, false); $this->assertInstanceOf(Session::class, $actual); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testCallStatic(): void { // __callStatic should kick in for this but fail @@ -268,8 +271,8 @@ public function testCallStatic(): void $this->assertInstanceOf(Session::class, $actual); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testCallStaticDirectly(): void { // $actual = \CodeIgniter\Config\Services::SeSsIoN(null, false); // original @@ -277,8 +280,8 @@ public function testCallStaticDirectly(): void $this->assertInstanceOf(Session::class, $actual); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testMockInjection(): void { Services::injectMock('response', new MockResponse(new App())); @@ -297,8 +300,8 @@ public function testMockInjection(): void $this->assertSame($response, $response3); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testReset(): void { Services::injectMock('response', new MockResponse(new App())); @@ -314,8 +317,8 @@ public function testReset(): void $this->assertNotSame($response2, $response); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testResetSingle(): void { Services::injectMock('response', new MockResponse(new App())); diff --git a/tests/system/ControllerTest.php b/tests/system/ControllerTest.php index 30505f0f711a..9271d046d590 100644 --- a/tests/system/ControllerTest.php +++ b/tests/system/ControllerTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\Exceptions\RedirectException; use CodeIgniter\HTTP\IncomingRequest; @@ -34,8 +36,8 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class ControllerTest extends CIUnitTestCase { private App $config; diff --git a/tests/system/Cookie/CookieStoreTest.php b/tests/system/Cookie/CookieStoreTest.php index 22f01169e28b..5ad93e82ac4c 100644 --- a/tests/system/Cookie/CookieStoreTest.php +++ b/tests/system/Cookie/CookieStoreTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Cookie; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\Test\CIUnitTestCase; use DateTimeImmutable; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CookieStoreTest extends CIUnitTestCase { private array $defaults; diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index a7bf0b7790a8..d8af2eb184a7 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Cookie; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\Test\CIUnitTestCase; use Config\Cookie as CookieConfig; @@ -23,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CookieTest extends CIUnitTestCase { private array $defaults; @@ -79,7 +81,7 @@ public function testConfigInjectionForDefaults(): void Cookie::setDefaults($old); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideConfigPrefix')] + #[DataProvider('provideConfigPrefix')] public function testConfigPrefix(string $configPrefix, string $optionPrefix, string $expected): void { $config = new CookieConfig(); @@ -166,7 +168,7 @@ public function testExpirationTime(): void /** * @param bool|float|string $expires */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideInvalidExpires')] + #[DataProvider('provideInvalidExpires')] public function testInvalidExpires($expires): void { $this->expectException(CookieException::class); @@ -186,7 +188,7 @@ public static function provideInvalidExpires(): iterable } } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSetCookieHeaderCreation')] + #[DataProvider('provideSetCookieHeaderCreation')] public function testSetCookieHeaderCreation(string $header, array $changed): void { $cookie = Cookie::fromHeaderString($header); diff --git a/tests/system/DataConverter/DataConverterTest.php b/tests/system/DataConverter/DataConverterTest.php index f2c36a4dbd56..109b8b92c66c 100644 --- a/tests/system/DataConverter/DataConverterTest.php +++ b/tests/system/DataConverter/DataConverterTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\DataConverter; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use Closure; use CodeIgniter\HTTP\URI; use CodeIgniter\I18n\Time; @@ -24,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DataConverterTest extends CIUnitTestCase { public function testInstantiate(): void @@ -38,7 +40,7 @@ public function testInstantiate(): void $this->assertInstanceOf(DataConverter::class, $converter); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideConvertDataFromDB')] + #[DataProvider('provideConvertDataFromDB')] public function testConvertDataFromDB(array $types, array $dbData, array $expected): void { $converter = $this->createDataConverter($types); @@ -48,7 +50,7 @@ public function testConvertDataFromDB(array $types, array $dbData, array $expect $this->assertSame($expected, $data); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideConvertDataToDB')] + #[DataProvider('provideConvertDataToDB')] public function testConvertDataToDB(array $types, array $phpData, array $expected): void { $converter = $this->createDataConverter($types); diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 38bc943b2e47..0dda2d3a4ef5 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Database; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -21,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class BaseConnectionTest extends CIUnitTestCase { private array $options = [ @@ -180,7 +182,7 @@ public function testMagicGetMissing(): void * These tests are intended to confirm the current behavior. * We do not know if all of these are the correct behavior. */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideProtectIdentifiers')] + #[DataProvider('provideProtectIdentifiers')] public function testProtectIdentifiers( bool $prefixSingle, bool $protectIdentifiers, @@ -285,7 +287,7 @@ public static function provideProtectIdentifiers(): iterable /** * These tests are intended to confirm the current behavior. */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideEscapeIdentifiers')] + #[DataProvider('provideEscapeIdentifiers')] public function testEscapeIdentifiers(string $item, string $expected): void { $db = new MockConnection($this->options); @@ -307,7 +309,7 @@ public static function provideEscapeIdentifiers(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideEscapeIdentifier')] + #[DataProvider('provideEscapeIdentifier')] public function testEscapeIdentifier(string $item, string $expected): void { $db = new MockConnection($this->options); diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php index 16e640d1b257..d6ec78243abe 100644 --- a/tests/system/Database/BaseQueryTest.php +++ b/tests/system/Database/BaseQueryTest.php @@ -13,13 +13,15 @@ namespace CodeIgniter\Database; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class BaseQueryTest extends CIUnitTestCase { protected $db; @@ -187,7 +189,7 @@ public static function provideIsWriteType(): iterable * @param mixed $expected * @param mixed $sql */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideIsWriteType')] + #[DataProvider('provideIsWriteType')] public function testIsWriteType($expected, $sql): void { $query = new Query($this->db); @@ -599,7 +601,7 @@ public static function provideHighlightQueryKeywords(): iterable * @param mixed $expected * @param mixed $sql */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideHighlightQueryKeywords')] + #[DataProvider('provideHighlightQueryKeywords')] public function testHighlightQueryKeywords($expected, $sql): void { $query = new Query($this->db); diff --git a/tests/system/Database/Builder/AliasTest.php b/tests/system/Database/Builder/AliasTest.php index 5b5303d3c0d2..bd6ddb3a12a7 100644 --- a/tests/system/Database/Builder/AliasTest.php +++ b/tests/system/Database/Builder/AliasTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class AliasTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/BaseTest.php b/tests/system/Database/Builder/BaseTest.php index 90901597728b..2305ca765674 100644 --- a/tests/system/Database/Builder/BaseTest.php +++ b/tests/system/Database/Builder/BaseTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class BaseTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/CountTest.php b/tests/system/Database/Builder/CountTest.php index 2bdf3ea3e63e..acfc9569310e 100644 --- a/tests/system/Database/Builder/CountTest.php +++ b/tests/system/Database/Builder/CountTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CountTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/DeleteTest.php b/tests/system/Database/Builder/DeleteTest.php index 9a83941a4806..36387ec3d3e3 100644 --- a/tests/system/Database/Builder/DeleteTest.php +++ b/tests/system/Database/Builder/DeleteTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DeleteTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/DistinctTest.php b/tests/system/Database/Builder/DistinctTest.php index 5b91f9b90ded..fb089d77ae57 100644 --- a/tests/system/Database/Builder/DistinctTest.php +++ b/tests/system/Database/Builder/DistinctTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DistinctTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/EmptyTest.php b/tests/system/Database/Builder/EmptyTest.php index 2b2b1c0089ee..76aa16aadf29 100644 --- a/tests/system/Database/Builder/EmptyTest.php +++ b/tests/system/Database/Builder/EmptyTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class EmptyTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/FromTest.php b/tests/system/Database/Builder/FromTest.php index 92f87d6b6571..bfe1af812ec9 100644 --- a/tests/system/Database/Builder/FromTest.php +++ b/tests/system/Database/Builder/FromTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\SQLSRV\Builder as SQLSRVBuilder; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FromTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/GetTest.php b/tests/system/Database/Builder/GetTest.php index b483bd4cdf3b..e7ceb5030d0c 100644 --- a/tests/system/Database/Builder/GetTest.php +++ b/tests/system/Database/Builder/GetTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; use Config\Feature; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class GetTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/GroupTest.php b/tests/system/Database/Builder/GroupTest.php index e8ddb0d1e2b8..82cc3e96649b 100644 --- a/tests/system/Database/Builder/GroupTest.php +++ b/tests/system/Database/Builder/GroupTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class GroupTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/InsertTest.php b/tests/system/Database/Builder/InsertTest.php index d5f23af92111..ed0120ba5543 100644 --- a/tests/system/Database/Builder/InsertTest.php +++ b/tests/system/Database/Builder/InsertTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Query; use CodeIgniter\Database\RawSql; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class InsertTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/JoinTest.php b/tests/system/Database/Builder/JoinTest.php index 900e43fa45ec..1d94ebe49ffd 100644 --- a/tests/system/Database/Builder/JoinTest.php +++ b/tests/system/Database/Builder/JoinTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\Postgre\Builder as PostgreBuilder; use CodeIgniter\Database\RawSql; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class JoinTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/LikeTest.php b/tests/system/Database/Builder/LikeTest.php index 5051b8d1275d..b6fc8e16327d 100644 --- a/tests/system/Database/Builder/LikeTest.php +++ b/tests/system/Database/Builder/LikeTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class LikeTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/LimitTest.php b/tests/system/Database/Builder/LimitTest.php index 14a8523f69f1..e05fcab2ff12 100644 --- a/tests/system/Database/Builder/LimitTest.php +++ b/tests/system/Database/Builder/LimitTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class LimitTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/OrderTest.php b/tests/system/Database/Builder/OrderTest.php index 59a16caecf8b..20bcbc9ea6ce 100644 --- a/tests/system/Database/Builder/OrderTest.php +++ b/tests/system/Database/Builder/OrderTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class OrderTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/PrefixTest.php b/tests/system/Database/Builder/PrefixTest.php index 88f6269df230..586b1c38dc53 100644 --- a/tests/system/Database/Builder/PrefixTest.php +++ b/tests/system/Database/Builder/PrefixTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PrefixTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/ReplaceTest.php b/tests/system/Database/Builder/ReplaceTest.php index a5ecdbb6ce47..e75c90f63fdd 100644 --- a/tests/system/Database/Builder/ReplaceTest.php +++ b/tests/system/Database/Builder/ReplaceTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ReplaceTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/SelectTest.php b/tests/system/Database/Builder/SelectTest.php index 48521d299901..f072b79e2055 100644 --- a/tests/system/Database/Builder/SelectTest.php +++ b/tests/system/Database/Builder/SelectTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Database\RawSql; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SelectTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/TruncateTest.php b/tests/system/Database/Builder/TruncateTest.php index 43ad872188cd..71251e98e2b5 100644 --- a/tests/system/Database/Builder/TruncateTest.php +++ b/tests/system/Database/Builder/TruncateTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TruncateTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Builder/UnionTest.php b/tests/system/Database/Builder/UnionTest.php index 8baad8174399..ed1be13c8f1b 100644 --- a/tests/system/Database/Builder/UnionTest.php +++ b/tests/system/Database/Builder/UnionTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\SQLSRV\Connection as SQLSRVConnection; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class UnionTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/UpdateTest.php b/tests/system/Database/Builder/UpdateTest.php index 2df5a28842d9..32bce616e140 100644 --- a/tests/system/Database/Builder/UpdateTest.php +++ b/tests/system/Database/Builder/UpdateTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class UpdateTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/WhenTest.php b/tests/system/Database/Builder/WhenTest.php index 7d2b07e428a3..be38c73406bc 100644 --- a/tests/system/Database/Builder/WhenTest.php +++ b/tests/system/Database/Builder/WhenTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class WhenTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index 3afc27932ccc..d7133013ff07 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Database\Builder; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; @@ -25,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class WhereTest extends CIUnitTestCase { /** @@ -404,7 +406,7 @@ public static function provideWhereInvalidKeyThrowInvalidArgumentException(): it /** * @param mixed $key */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideWhereInvalidKeyThrowInvalidArgumentException')] + #[DataProvider('provideWhereInvalidKeyThrowInvalidArgumentException')] public function testWhereInvalidKeyThrowInvalidArgumentException($key): void { $this->expectException('InvalidArgumentException'); @@ -425,7 +427,7 @@ public static function provideWhereInEmptyValuesThrowInvalidArgumentException(): /** * @param mixed $values */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideWhereInEmptyValuesThrowInvalidArgumentException')] + #[DataProvider('provideWhereInEmptyValuesThrowInvalidArgumentException')] public function testWhereInEmptyValuesThrowInvalidArgumentException($values): void { $this->expectException('InvalidArgumentException'); diff --git a/tests/system/Database/ConfigTest.php b/tests/system/Database/ConfigTest.php index 74ac4a141fdb..e380a19be0a2 100644 --- a/tests/system/Database/ConfigTest.php +++ b/tests/system/Database/ConfigTest.php @@ -13,13 +13,15 @@ namespace CodeIgniter\Database; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\ReflectionHelper; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ConfigTest extends CIUnitTestCase { use ReflectionHelper; @@ -195,7 +197,7 @@ public function testConnectionGroupWithDSNPostgreNative(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/7550 */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideConvertDSN')] + #[DataProvider('provideConvertDSN')] public function testConvertDSN(string $input, string $expected): void { // @TODO This format is for PDO_PGSQL. diff --git a/tests/system/Database/DatabaseSeederTest.php b/tests/system/Database/DatabaseSeederTest.php index 895d5fc5f6e0..c481ebfd1c8b 100644 --- a/tests/system/Database/DatabaseSeederTest.php +++ b/tests/system/Database/DatabaseSeederTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Database; use Faker\Generator; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DatabaseSeederTest extends CIUnitTestCase { public function testInstantiateNoSeedPath(): void diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php index 07affb5e5082..eb47fa4bcb56 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\DatabaseTestCase; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; @@ -24,7 +25,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DatabaseTestCaseMigrationOnce1Test extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php index c20033eaf980..1703bdd8c01f 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\DatabaseTestCase; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; @@ -24,7 +25,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DatabaseTestCaseMigrationOnce2Test extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/DatabaseTestCaseTest.php b/tests/system/Database/DatabaseTestCaseTest.php index 533a31a5bece..5fbcf517b407 100644 --- a/tests/system/Database/DatabaseTestCaseTest.php +++ b/tests/system/Database/DatabaseTestCaseTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DatabaseTestCaseTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Forge/CreateTableTest.php b/tests/system/Database/Forge/CreateTableTest.php index 7ee4f40bd0f8..b7919f1fdd74 100644 --- a/tests/system/Database/Forge/CreateTableTest.php +++ b/tests/system/Database/Forge/CreateTableTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Forge; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CreateTableTest extends CIUnitTestCase { public function testCreateTableWithDefaultRawSql(): void diff --git a/tests/system/Database/Forge/DropForeignKeyTest.php b/tests/system/Database/Forge/DropForeignKeyTest.php index b788d25247d0..09fc35b96ec6 100644 --- a/tests/system/Database/Forge/DropForeignKeyTest.php +++ b/tests/system/Database/Forge/DropForeignKeyTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Forge; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DropForeignKeyTest extends CIUnitTestCase { protected $db; diff --git a/tests/system/Database/Live/AliasTest.php b/tests/system/Database/Live/AliasTest.php index 1abaef6a29fd..d0b02d7d6815 100644 --- a/tests/system/Database/Live/AliasTest.php +++ b/tests/system/Database/Live/AliasTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class AliasTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/BadQueryTest.php b/tests/system/Database/Live/BadQueryTest.php index b2da47b1fcfe..7e7be58ffef3 100644 --- a/tests/system/Database/Live/BadQueryTest.php +++ b/tests/system/Database/Live/BadQueryTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class BadQueryTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/ConnectTest.php b/tests/system/Database/Live/ConnectTest.php index b04cf2fe2e3d..ee74f8f7f86e 100644 --- a/tests/system/Database/Live/ConnectTest.php +++ b/tests/system/Database/Live/ConnectTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Database\SQLite3\Connection; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ConnectTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/CountTest.php b/tests/system/Database/Live/CountTest.php index d475e961f2bc..e9ca2bc5372c 100644 --- a/tests/system/Database/Live/CountTest.php +++ b/tests/system/Database/Live/CountTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class CountTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DatabaseTestTraitCaseTest.php b/tests/system/Database/Live/DatabaseTestTraitCaseTest.php index 4c1467bc48d2..bb7996fd9f6c 100644 --- a/tests/system/Database/Live/DatabaseTestTraitCaseTest.php +++ b/tests/system/Database/Live/DatabaseTestTraitCaseTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DatabaseTestTraitCaseTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DbDebugTest.php b/tests/system/Database/Live/DbDebugTest.php index 1c878578026a..86698123ff05 100644 --- a/tests/system/Database/Live/DbDebugTest.php +++ b/tests/system/Database/Live/DbDebugTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DbDebugTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DbUtilsTest.php b/tests/system/Database/Live/DbUtilsTest.php index 039ebd926911..ec6c1f5c4b8a 100644 --- a/tests/system/Database/Live/DbUtilsTest.php +++ b/tests/system/Database/Live/DbUtilsTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Database; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DbUtilsTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/DeleteTest.php b/tests/system/Database/Live/DeleteTest.php index 5ed001c5eb42..f3c7c4b2b737 100644 --- a/tests/system/Database/Live/DeleteTest.php +++ b/tests/system/Database/Live/DeleteTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DeleteTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/EmptyTest.php b/tests/system/Database/Live/EmptyTest.php index 88305c57d7ae..97224a247f59 100644 --- a/tests/system/Database/Live/EmptyTest.php +++ b/tests/system/Database/Live/EmptyTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class EmptyTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/EscapeTest.php b/tests/system/Database/Live/EscapeTest.php index 9f0a76184af1..afbc3e3b85da 100644 --- a/tests/system/Database/Live/EscapeTest.php +++ b/tests/system/Database/Live/EscapeTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\RawSql; use CodeIgniter\I18n\Time; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class EscapeTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/FabricatorLiveTest.php b/tests/system/Database/Live/FabricatorLiveTest.php index 19770bea6a83..103358366240 100644 --- a/tests/system/Database/Live/FabricatorLiveTest.php +++ b/tests/system/Database/Live/FabricatorLiveTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class FabricatorLiveTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index 0fa79a255f5f..0652b7c3cfe2 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; @@ -26,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ForgeTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/FromTest.php b/tests/system/Database/Live/FromTest.php index 312fd5e30416..d6f9ee673e79 100644 --- a/tests/system/Database/Live/FromTest.php +++ b/tests/system/Database/Live/FromTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class FromTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GetNumRowsTest.php b/tests/system/Database/Live/GetNumRowsTest.php index 1f2ba9ddcb67..90ad2d8537ed 100644 --- a/tests/system/Database/Live/GetNumRowsTest.php +++ b/tests/system/Database/Live/GetNumRowsTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetNumRowsTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GetTest.php b/tests/system/Database/Live/GetTest.php index ce4cfce4a9d2..29dd82028f60 100644 --- a/tests/system/Database/Live/GetTest.php +++ b/tests/system/Database/Live/GetTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GetVersionTest.php b/tests/system/Database/Live/GetVersionTest.php index d6a60f039a9c..de4bd119241e 100644 --- a/tests/system/Database/Live/GetVersionTest.php +++ b/tests/system/Database/Live/GetVersionTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetVersionTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/GroupTest.php b/tests/system/Database/Live/GroupTest.php index dda699ba5bf6..7319f1f353cb 100644 --- a/tests/system/Database/Live/GroupTest.php +++ b/tests/system/Database/Live/GroupTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GroupTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/IncrementTest.php b/tests/system/Database/Live/IncrementTest.php index 314897454ed9..645344cf85c2 100644 --- a/tests/system/Database/Live/IncrementTest.php +++ b/tests/system/Database/Live/IncrementTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class IncrementTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/InsertTest.php b/tests/system/Database/Live/InsertTest.php index 1e6720225a76..6b0bef010679 100644 --- a/tests/system/Database/Live/InsertTest.php +++ b/tests/system/Database/Live/InsertTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class InsertTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/JoinTest.php b/tests/system/Database/Live/JoinTest.php index 979a516e2030..f739685c74e6 100644 --- a/tests/system/Database/Live/JoinTest.php +++ b/tests/system/Database/Live/JoinTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class JoinTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/LikeTest.php b/tests/system/Database/Live/LikeTest.php index d74544387e09..8d06e180739f 100644 --- a/tests/system/Database/Live/LikeTest.php +++ b/tests/system/Database/Live/LikeTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class LikeTest extends CIUnitTestCase { use DatabaseTestTrait; @@ -131,11 +132,7 @@ public function testLikeRawSqlAndCountAllResultsAndGet(): void { $builder = $this->db->table('job'); - if ($this->db->DBDriver === 'OCI8') { - $key = new RawSql('"name"'); - } else { - $key = new RawSql('name'); - } + $key = $this->db->DBDriver === 'OCI8' ? new RawSql('"name"') : new RawSql('name'); $builder->like($key, 'Developer'); $count = $builder->countAllResults(false); @@ -152,11 +149,7 @@ public function testLikeRawSqlAndGetAndCountAllResults(): void { $builder = $this->db->table('job'); - if ($this->db->DBDriver === 'OCI8') { - $key = new RawSql('"name"'); - } else { - $key = new RawSql('name'); - } + $key = $this->db->DBDriver === 'OCI8' ? new RawSql('"name"') : new RawSql('name'); $builder->like($key, 'Developer'); $results = $builder->get(null, 0, false)->getResult(); diff --git a/tests/system/Database/Live/LimitTest.php b/tests/system/Database/Live/LimitTest.php index b0f1df6ee6ab..135dd7a6bf74 100644 --- a/tests/system/Database/Live/LimitTest.php +++ b/tests/system/Database/Live/LimitTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class LimitTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/MetadataTest.php b/tests/system/Database/Live/MetadataTest.php index 2e2182fa835a..738ee094e6ce 100644 --- a/tests/system/Database/Live/MetadataTest.php +++ b/tests/system/Database/Live/MetadataTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class MetadataTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php b/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php index 478fded783d4..a50fddd557da 100644 --- a/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Live\MySQLi; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/MySQLi/NumberNativeTest.php b/tests/system/Database/Live/MySQLi/NumberNativeTest.php index 051e64cfad71..048c615bce15 100644 --- a/tests/system/Database/Live/MySQLi/NumberNativeTest.php +++ b/tests/system/Database/Live/MySQLi/NumberNativeTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live\MySQLi; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class NumberNativeTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/MySQLi/RawSqlTest.php b/tests/system/Database/Live/MySQLi/RawSqlTest.php index 77aeddfd4ab4..dd4cfac57d20 100644 --- a/tests/system/Database/Live/MySQLi/RawSqlTest.php +++ b/tests/system/Database/Live/MySQLi/RawSqlTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live\MySQLi; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class RawSqlTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php index 8ce809c29af8..78a866a610d4 100644 --- a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php +++ b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Live\OCI8; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class CallStoredProcedureTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php index 074b77d4e8bc..89c6f9d157b4 100644 --- a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live\OCI8; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; use LogicException; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/OCI8/LastInsertIDTest.php b/tests/system/Database/Live/OCI8/LastInsertIDTest.php index 9b6e46ebc713..4a5ed73ee0a3 100644 --- a/tests/system/Database/Live/OCI8/LastInsertIDTest.php +++ b/tests/system/Database/Live/OCI8/LastInsertIDTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live\OCI8; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Query; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class LastInsertIDTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/OrderTest.php b/tests/system/Database/Live/OrderTest.php index 9057fb172032..31bdddcff28c 100644 --- a/tests/system/Database/Live/OrderTest.php +++ b/tests/system/Database/Live/OrderTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class OrderTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php b/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php index ea80dbb6d5f4..1ed01ddd292e 100644 --- a/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Live\Postgre; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/PreparedQueryTest.php b/tests/system/Database/Live/PreparedQueryTest.php index 0cd0c23d597e..e1315cc16d3c 100644 --- a/tests/system/Database/Live/PreparedQueryTest.php +++ b/tests/system/Database/Live/PreparedQueryTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use BadMethodCallException; use CodeIgniter\Database\BasePreparedQuery; use CodeIgniter\Database\Exceptions\DatabaseException; @@ -25,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class PreparedQueryTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/PretendTest.php b/tests/system/Database/Live/PretendTest.php index f6cb14fc9467..9b44880b3341 100644 --- a/tests/system/Database/Live/PretendTest.php +++ b/tests/system/Database/Live/PretendTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Query; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class PretendTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php b/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php index 2c074bd57d4d..561b1cae2e48 100644 --- a/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Live\SQLSRV; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/SQLite3/AlterTableTest.php b/tests/system/Database/Live/SQLite3/AlterTableTest.php index 0d01d4f4c51a..9440a3721cc9 100644 --- a/tests/system/Database/Live/SQLite3/AlterTableTest.php +++ b/tests/system/Database/Live/SQLite3/AlterTableTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Database\Live\SQLite3; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Database\SQLite3\Forge; use CodeIgniter\Database\SQLite3\Table; @@ -23,8 +25,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] -#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('sqlite3')] +#[Group('DatabaseLive')] +#[RequiresPhpExtension('sqlite3')] final class AlterTableTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php b/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php index aa7da330a2e8..d04e8fa8e77f 100644 --- a/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php +++ b/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live\SQLite3; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; use Config\Database; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ForgeModifyColumnTest extends CIUnitTestCase { private Forge $forge; diff --git a/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php b/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php index cd463186c4dc..fc5d7959b143 100644 --- a/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Database\Live\SQLite3; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetFieldDataTestCase extends AbstractGetFieldDataTestCase { protected function createForge(): void diff --git a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php index 8352fdcb8b31..3881b4331638 100644 --- a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php +++ b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live\SQLite3; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\SQLite3\Connection; use CodeIgniter\Database\SQLite3\Forge; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class GetIndexDataTest extends CIUnitTestCase { /** diff --git a/tests/system/Database/Live/SelectTest.php b/tests/system/Database/Live/SelectTest.php index 7afbcbf7fdd8..5d8e3402e716 100644 --- a/tests/system/Database/Live/SelectTest.php +++ b/tests/system/Database/Live/SelectTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class SelectTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/TransactionDBDebugFalseTest.php b/tests/system/Database/Live/TransactionDBDebugFalseTest.php index 326dedbe9983..e4dd8d344420 100644 --- a/tests/system/Database/Live/TransactionDBDebugFalseTest.php +++ b/tests/system/Database/Live/TransactionDBDebugFalseTest.php @@ -13,10 +13,11 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class TransactionDBDebugFalseTest extends TransactionDBDebugTrueTest { protected function setUp(): void diff --git a/tests/system/Database/Live/TransactionDBDebugTrueTest.php b/tests/system/Database/Live/TransactionDBDebugTrueTest.php index 33131c5540f0..5d9178a35509 100644 --- a/tests/system/Database/Live/TransactionDBDebugTrueTest.php +++ b/tests/system/Database/Live/TransactionDBDebugTrueTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -24,7 +25,7 @@ * * @no-final */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] class TransactionDBDebugTrueTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/TransactionTest.php b/tests/system/Database/Live/TransactionTest.php index 578664d26afe..a69de8246d84 100644 --- a/tests/system/Database/Live/TransactionTest.php +++ b/tests/system/Database/Live/TransactionTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class TransactionTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/UnionTest.php b/tests/system/Database/Live/UnionTest.php index 98bcc1bbd427..3f8643d0fe71 100644 --- a/tests/system/Database/Live/UnionTest.php +++ b/tests/system/Database/Live/UnionTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class UnionTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/UpdateTest.php b/tests/system/Database/Live/UpdateTest.php index 5b020d511bf1..ed03b37ad554 100644 --- a/tests/system/Database/Live/UpdateTest.php +++ b/tests/system/Database/Live/UpdateTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; @@ -24,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class UpdateTest extends CIUnitTestCase { use DatabaseTestTrait; @@ -112,7 +114,7 @@ public function testUpdateWithWhereAndLimit(): void } } - #[\PHPUnit\Framework\Attributes\DataProvider('provideUpdateBatch')] + #[DataProvider('provideUpdateBatch')] public function testUpdateBatch(string $constraints, array $data, array $expected): void { $table = 'type_test'; diff --git a/tests/system/Database/Live/UpsertTest.php b/tests/system/Database/Live/UpsertTest.php index b3f2d7f9ba97..e1248c3d98f4 100644 --- a/tests/system/Database/Live/UpsertTest.php +++ b/tests/system/Database/Live/UpsertTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; @@ -25,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class UpsertTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/WhereTest.php b/tests/system/Database/Live/WhereTest.php index 8acc190bfb1c..3c0d8d654db9 100644 --- a/tests/system/Database/Live/WhereTest.php +++ b/tests/system/Database/Live/WhereTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Tests\Support\Database\Seeds\CITestSeeder; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class WhereTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Live/WriteTypeQueryTest.php b/tests/system/Database/Live/WriteTypeQueryTest.php index 44bd4e99f10e..356db13567e6 100644 --- a/tests/system/Database/Live/WriteTypeQueryTest.php +++ b/tests/system/Database/Live/WriteTypeQueryTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Live; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class WriteTypeQueryTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Migrations/MigrationRunnerTest.php b/tests/system/Database/Migrations/MigrationRunnerTest.php index 0c979a3b2afc..a9c28d29d914 100644 --- a/tests/system/Database/Migrations/MigrationRunnerTest.php +++ b/tests/system/Database/Migrations/MigrationRunnerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Migrations; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Database\MigrationRunner; use CodeIgniter\Events\Events; @@ -30,7 +31,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class MigrationRunnerTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/Migrations/MigrationTest.php b/tests/system/Database/Migrations/MigrationTest.php index 83873992c411..6873541a4225 100644 --- a/tests/system/Database/Migrations/MigrationTest.php +++ b/tests/system/Database/Migrations/MigrationTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Database\Migrations; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Migration; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class MigrationTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Database/RawSqlTest.php b/tests/system/Database/RawSqlTest.php index 6c58c2ad96f5..795533158768 100644 --- a/tests/system/Database/RawSqlTest.php +++ b/tests/system/Database/RawSqlTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Database; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class RawSqlTest extends CIUnitTestCase { public function testCanConvertToString(): void diff --git a/tests/system/Debug/ExceptionHandlerTest.php b/tests/system/Debug/ExceptionHandlerTest.php index 551298ebdd3d..6c2843a6d369 100644 --- a/tests/system/Debug/ExceptionHandlerTest.php +++ b/tests/system/Debug/ExceptionHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Debug; +use PHPUnit\Framework\Attributes\Group; use App\Controllers\Home; use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Test\CIUnitTestCase; @@ -25,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ExceptionHandlerTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index 087639a2611c..3548301facc6 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Debug; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhp; use App\Controllers\Home; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Entity\Exceptions\CastException; @@ -25,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ExceptionsTest extends CIUnitTestCase { use ReflectionHelper; @@ -53,7 +55,7 @@ protected function setUp(): void $this->exception = new Exceptions(new ExceptionsConfig()); } - #[\PHPUnit\Framework\Attributes\RequiresPhp('>= 8.1')] + #[RequiresPhp('>= 8.1')] public function testDeprecationsOnPhp81DoNotThrow(): void { $config = new ExceptionsConfig(); diff --git a/tests/system/Debug/TimerTest.php b/tests/system/Debug/TimerTest.php index 68848d51bf24..f3067c21dcc5 100644 --- a/tests/system/Debug/TimerTest.php +++ b/tests/system/Debug/TimerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Debug; +use PHPUnit\Framework\Attributes\Group; use ArgumentCountError; use CodeIgniter\Test\CIUnitTestCase; use RuntimeException; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TimerTest extends CIUnitTestCase { /** diff --git a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php index c48632a929a9..abeacfbce43e 100644 --- a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php +++ b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Debug\Toolbar\Collectors; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Query; use CodeIgniter\Test\CIUnitTestCase; use PHPUnit\Framework\MockObject\MockObject; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DatabaseTest extends CIUnitTestCase { public function testDisplay(): void diff --git a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php index 38a6ca8e2bb6..6c7c6f9a8fbb 100644 --- a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php +++ b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Debug\Toolbar\Collectors; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use DateTime; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class HistoryTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/DebugTraceableTraitTest.php b/tests/system/DebugTraceableTraitTest.php index b610b687569b..60499cedb57e 100644 --- a/tests/system/DebugTraceableTraitTest.php +++ b/tests/system/DebugTraceableTraitTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\CoversClass; use CodeIgniter\Exceptions\DebugTraceableTrait; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\Test\CIUnitTestCase; @@ -20,8 +22,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] -#[\PHPUnit\Framework\Attributes\CoversClass(DebugTraceableTrait::class)] +#[Group('Others')] +#[CoversClass(DebugTraceableTrait::class)] final class DebugTraceableTraitTest extends CIUnitTestCase { public function testFactoryInstanceReturnsWhereItIsRaised(): void diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index c0f431690194..e5350e44e4ac 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Email; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Events\Events; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockEmail; @@ -21,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class EmailTest extends CIUnitTestCase { public function testEmailValidation(): void @@ -44,7 +46,7 @@ public static function provideEmailSendWithClearance(): iterable /** * @param mixed $autoClear */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideEmailSendWithClearance')] + #[DataProvider('provideEmailSendWithClearance')] public function testEmailSendWithClearance($autoClear): void { $email = $this->createMockEmail(); diff --git a/tests/system/Encryption/EncryptionTest.php b/tests/system/Encryption/EncryptionTest.php index 10e6d7f1a041..7481dadd4224 100644 --- a/tests/system/Encryption/EncryptionTest.php +++ b/tests/system/Encryption/EncryptionTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Encryption; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Encryption\Exceptions\EncryptionException; use CodeIgniter\Test\CIUnitTestCase; use Config\Encryption as EncryptionConfig; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class EncryptionTest extends CIUnitTestCase { private Encryption $encryption; diff --git a/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php b/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php index ef194273d9ec..7b99339d4dab 100644 --- a/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php +++ b/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Encryption\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Encryption\Encryption; use CodeIgniter\Encryption\Exceptions\EncryptionException; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class OpenSSLHandlerTest extends CIUnitTestCase { private Encryption $encryption; diff --git a/tests/system/Encryption/Handlers/SodiumHandlerTest.php b/tests/system/Encryption/Handlers/SodiumHandlerTest.php index 1657451d36c1..d4255e2deba0 100644 --- a/tests/system/Encryption/Handlers/SodiumHandlerTest.php +++ b/tests/system/Encryption/Handlers/SodiumHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Encryption\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Encryption\Encryption; use CodeIgniter\Encryption\Exceptions\EncryptionException; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SodiumHandlerTest extends CIUnitTestCase { private Encryption $encryption; diff --git a/tests/system/Entity/EntityTest.php b/tests/system/Entity/EntityTest.php index 158aea67a958..17ef6a0ef95f 100644 --- a/tests/system/Entity/EntityTest.php +++ b/tests/system/Entity/EntityTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Entity; +use PHPUnit\Framework\Attributes\Group; use Closure; use CodeIgniter\Entity\Exceptions\CastException; use CodeIgniter\HTTP\URI; @@ -30,7 +31,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class EntityTest extends CIUnitTestCase { use ReflectionHelper; diff --git a/tests/system/Events/EventsTest.php b/tests/system/Events/EventsTest.php index 385c9f8d9582..a3210ae61cf6 100644 --- a/tests/system/Events/EventsTest.php +++ b/tests/system/Events/EventsTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Events; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockEvents; use Config\Modules; @@ -20,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class EventsTest extends CIUnitTestCase { /** @@ -46,8 +49,8 @@ protected function tearDown(): void Events::simulate(false); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testInitialize(): void { /** diff --git a/tests/system/Files/FileCollectionTest.php b/tests/system/Files/FileCollectionTest.php index 334ba739c00f..4aa071c9756f 100644 --- a/tests/system/Files/FileCollectionTest.php +++ b/tests/system/Files/FileCollectionTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Files; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Files\Exceptions\FileException; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileCollectionTest extends CIUnitTestCase { /** diff --git a/tests/system/Files/FileTest.php b/tests/system/Files/FileTest.php index 658a7f7c8f3b..392c4463f361 100644 --- a/tests/system/Files/FileTest.php +++ b/tests/system/Files/FileTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Files; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Test\CIUnitTestCase; use ZipArchive; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileTest extends CIUnitTestCase { public function testNewGoodChecked(): void diff --git a/tests/system/Files/FileWithVfsTest.php b/tests/system/Files/FileWithVfsTest.php index 8482dfcd9bbb..9ef3e585102b 100644 --- a/tests/system/Files/FileWithVfsTest.php +++ b/tests/system/Files/FileWithVfsTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Files; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileWithVfsTest extends CIUnitTestCase { // For VFS stuff diff --git a/tests/system/Filters/CSRFTest.php b/tests/system/Filters/CSRFTest.php index 824cc6f1fdb9..8a2eb2995463 100644 --- a/tests/system/Filters/CSRFTest.php +++ b/tests/system/Filters/CSRFTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Filters; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; @@ -22,8 +24,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class CSRFTest extends CIUnitTestCase { private \Config\Filters $config; diff --git a/tests/system/Filters/CorsTest.php b/tests/system/Filters/CorsTest.php index c27a754cf90b..86a69e091728 100644 --- a/tests/system/Filters/CorsTest.php +++ b/tests/system/Filters/CorsTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Filters; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; @@ -31,7 +32,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CorsTest extends CIUnitTestCase { private Cors $cors; diff --git a/tests/system/Filters/DebugToolbarTest.php b/tests/system/Filters/DebugToolbarTest.php index 3a50e689c184..674fd3f3c123 100644 --- a/tests/system/Filters/DebugToolbarTest.php +++ b/tests/system/Filters/DebugToolbarTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Filters; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; @@ -23,8 +25,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class DebugToolbarTest extends CIUnitTestCase { /** diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index 0c772cf65ce2..e08e94a62f77 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Filters; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\Filters\Exceptions\FilterException; @@ -44,8 +47,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class FiltersTest extends CIUnitTestCase { use ConfigFromArrayTrait; @@ -230,7 +233,7 @@ public static function provideProcessMethodProcessGlobalsWithExcept(): iterable /** * @param array|string $except */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideProcessMethodProcessGlobalsWithExcept')] + #[DataProvider('provideProcessMethodProcessGlobalsWithExcept')] public function testProcessMethodProcessGlobalsWithExcept($except): void { $_SERVER['REQUEST_METHOD'] = 'GET'; @@ -583,7 +586,7 @@ public function testOtherResult(): void /** * @param array|string $except */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideBeforeExcept')] + #[DataProvider('provideBeforeExcept')] public function testBeforeExcept(string $uri, $except, array $expected): void { $_SERVER['REQUEST_METHOD'] = 'GET'; diff --git a/tests/system/Filters/HoneypotTest.php b/tests/system/Filters/HoneypotTest.php index 2735b9b67dd1..f5c5db756c10 100644 --- a/tests/system/Filters/HoneypotTest.php +++ b/tests/system/Filters/HoneypotTest.php @@ -13,6 +13,10 @@ namespace CodeIgniter\Filters; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Config\Services; use CodeIgniter\Honeypot\Exceptions\HoneypotException; use CodeIgniter\HTTP\CLIRequest; @@ -24,8 +28,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[BackupGlobals(true)] +#[Group('SeparateProcess')] final class HoneypotTest extends CIUnitTestCase { private \Config\Filters $config; @@ -90,8 +94,8 @@ public function testBeforeClean(): void $this->assertSame($expected, $request); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testAfter(): void { $this->config->globals = [ @@ -110,8 +114,8 @@ public function testAfter(): void $this->assertStringContainsString($this->honey->name, $this->response->getBody()); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testAfterNotApplicable(): void { $this->config->globals = [ diff --git a/tests/system/Filters/InvalidCharsTest.php b/tests/system/Filters/InvalidCharsTest.php index b7fcf154178b..ad63d6225131 100644 --- a/tests/system/Filters/InvalidCharsTest.php +++ b/tests/system/Filters/InvalidCharsTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Filters; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\SiteURI; @@ -24,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class InvalidCharsTest extends CIUnitTestCase { private InvalidChars $invalidChars; @@ -65,7 +68,7 @@ private function createRequest(): IncomingRequest return $request; } - #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] + #[DoesNotPerformAssertions] public function testBeforeDoNothingWhenCLIRequest(): void { $cliRequest = new CLIRequest(new MockAppConfig()); @@ -73,7 +76,7 @@ public function testBeforeDoNothingWhenCLIRequest(): void $this->invalidChars->before($cliRequest); } - #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] + #[DoesNotPerformAssertions] public function testBeforeValidString(): void { $_POST['val'] = [ @@ -109,8 +112,8 @@ public function testBeforeInvalidControlCharCausesException(): void $this->invalidChars->before($this->request); } - #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] - #[\PHPUnit\Framework\Attributes\DataProvider('provideCheckControlStringWithLineBreakAndTabReturnsTheString')] + #[DoesNotPerformAssertions] + #[DataProvider('provideCheckControlStringWithLineBreakAndTabReturnsTheString')] public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $input): void { $_GET['val'] = $input; @@ -129,7 +132,7 @@ public static function provideCheckControlStringWithLineBreakAndTabReturnsTheStr ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideCheckControlStringWithControlCharsCausesException')] + #[DataProvider('provideCheckControlStringWithControlCharsCausesException')] public function testCheckControlStringWithControlCharsCausesException(string $input): void { $this->expectException(SecurityException::class); diff --git a/tests/system/Filters/SecureHeadersTest.php b/tests/system/Filters/SecureHeadersTest.php index 6958663426d2..e8c0a40a7a8f 100644 --- a/tests/system/Filters/SecureHeadersTest.php +++ b/tests/system/Filters/SecureHeadersTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Filters; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SecureHeadersTest extends CIUnitTestCase { public function testAfter(): void diff --git a/tests/system/Format/FormatTest.php b/tests/system/Format/FormatTest.php index e580d19ae85d..fc8977267810 100644 --- a/tests/system/Format/FormatTest.php +++ b/tests/system/Format/FormatTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Format; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Format\Exceptions\FormatException; use CodeIgniter\HTTP\URI; use CodeIgniter\Test\CIUnitTestCase; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FormatTest extends CIUnitTestCase { private Format $format; diff --git a/tests/system/Format/JSONFormatterTest.php b/tests/system/Format/JSONFormatterTest.php index 025b6b2a7593..4e203bd5c7c8 100644 --- a/tests/system/Format/JSONFormatterTest.php +++ b/tests/system/Format/JSONFormatterTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Format; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use RuntimeException; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class JSONFormatterTest extends CIUnitTestCase { private JSONFormatter $jsonFormatter; diff --git a/tests/system/Format/XMLFormatterTest.php b/tests/system/Format/XMLFormatterTest.php index be118820237b..2e1cb84d221f 100644 --- a/tests/system/Format/XMLFormatterTest.php +++ b/tests/system/Format/XMLFormatterTest.php @@ -13,13 +13,15 @@ namespace CodeIgniter\Format; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use DOMDocument; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class XMLFormatterTest extends CIUnitTestCase { private XMLFormatter $xmlFormatter; @@ -102,7 +104,7 @@ public function testValidatingXmlTags(): void $this->assertSame($expected, $this->xmlFormatter->format($data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidatingInvalidTags')] + #[DataProvider('provideValidatingInvalidTags')] public function testValidatingInvalidTags(string $expected, array $input): void { $expectedXML = <<assertSame('apple', $request->header('fruit')->getValue()); } - #[\PHPUnit\Framework\Attributes\BackupGlobals(true)] + #[BackupGlobals(true)] public function testOptionsHeadersNotUsingPopulate(): void { $_SERVER['HTTP_HOST'] = 'site1.com'; @@ -245,7 +247,7 @@ public function testHeaderContentLengthNotSharedBetweenRequests(): void $this->assertNull($request->header('Content-Length')); } - #[\PHPUnit\Framework\Attributes\BackupGlobals(true)] + #[BackupGlobals(true)] public function testHeaderContentLengthNotSharedBetweenClients(): void { $_SERVER['HTTP_CONTENT_LENGTH'] = '10'; diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index 86baa46626a2..50f8a707d22a 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\TestResponse; use Config\App; @@ -26,7 +29,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class ContentSecurityPolicyTest extends CIUnitTestCase { private ?Response $response = null; @@ -69,8 +72,8 @@ protected function work(string $parm = 'Hello') return $buffer; } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testExistence(): void { $this->prepare(); @@ -79,8 +82,8 @@ public function testExistence(): void $this->assertHeaderEmitted('Content-Security-Policy:'); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testReportOnly(): void { $this->prepare(); @@ -90,8 +93,8 @@ public function testReportOnly(): void $this->assertHeaderEmitted('Content-Security-Policy:'); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testDefaults(): void { $this->prepare(); @@ -107,8 +110,8 @@ public function testDefaults(): void $this->assertStringContainsString("style-src 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testChildSrc(): void { $this->prepare(); @@ -122,8 +125,8 @@ public function testChildSrc(): void $this->assertStringContainsString("child-src 'self' good.com;", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testConnectSrc(): void { $this->prepare(); @@ -136,8 +139,8 @@ public function testConnectSrc(): void $this->assertStringContainsString("connect-src 'self' iffy.com maybe.com;", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testFontSrc(): void { $this->prepare(); @@ -152,8 +155,8 @@ public function testFontSrc(): void $this->assertStringContainsString('font-src fontsrus.com;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testFormAction(): void { $this->prepare(); @@ -168,8 +171,8 @@ public function testFormAction(): void $this->assertStringNotContainsString("form-action 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testFrameAncestor(): void { $this->prepare(); @@ -183,8 +186,8 @@ public function testFrameAncestor(): void $this->assertStringContainsString("frame-ancestors 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testFrameSrc(): void { $this->prepare(); @@ -198,8 +201,8 @@ public function testFrameSrc(): void $this->assertStringContainsString("frame-src 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testImageSrc(): void { $this->prepare(); @@ -213,8 +216,8 @@ public function testImageSrc(): void $this->assertStringContainsString("img-src 'self' cdn.cloudy.com;", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testMediaSrc(): void { $this->prepare(); @@ -228,8 +231,8 @@ public function testMediaSrc(): void $this->assertStringContainsString("media-src 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testManifestSrc(): void { $this->prepare(); @@ -243,8 +246,8 @@ public function testManifestSrc(): void $this->assertStringContainsString('manifest-src cdn.cloudy.com;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testPluginType(): void { $this->prepare(); @@ -258,8 +261,8 @@ public function testPluginType(): void $this->assertStringContainsString("plugin-types 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testPluginArray(): void { $this->prepare(); @@ -271,8 +274,8 @@ public function testPluginArray(): void $this->assertStringContainsString('plugin-types application/x-shockwave-flash application/wacky-hacky;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testObjectSrc(): void { $this->prepare(); @@ -286,8 +289,8 @@ public function testObjectSrc(): void $this->assertStringContainsString("object-src 'self' cdn.cloudy.com;", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testScriptSrc(): void { $this->prepare(); @@ -301,8 +304,8 @@ public function testScriptSrc(): void $this->assertStringContainsString("script-src 'self' cdn.cloudy.com;", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testStyleSrc(): void { $this->prepare(); @@ -316,8 +319,8 @@ public function testStyleSrc(): void $this->assertStringContainsString("style-src 'self' cdn.cloudy.com;", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testBaseURIDefault(): void { $this->prepare(); @@ -327,8 +330,8 @@ public function testBaseURIDefault(): void $this->assertStringContainsString("base-uri 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testBaseURI(): void { $this->prepare(); @@ -339,8 +342,8 @@ public function testBaseURI(): void $this->assertStringContainsString('base-uri example.com;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testBaseURIRich(): void { $this->prepare(); @@ -351,8 +354,8 @@ public function testBaseURIRich(): void $this->assertStringContainsString("base-uri 'self' example.com;", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testDefaultSrc(): void { $this->prepare(); @@ -365,8 +368,8 @@ public function testDefaultSrc(): void $this->assertStringContainsString('default-src iffy.com;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testReportURI(): void { $this->prepare(); @@ -378,8 +381,8 @@ public function testReportURI(): void $this->assertStringContainsString('report-uri http://example.com/csptracker;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSandboxFlags(): void { $this->prepare(); @@ -392,8 +395,8 @@ public function testSandboxFlags(): void $this->assertStringContainsString('sandbox allow-popups allow-top-navigation;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testUpgradeInsecureRequests(): void { $this->prepare(); @@ -404,8 +407,8 @@ public function testUpgradeInsecureRequests(): void $this->assertStringContainsString('upgrade-insecure-requests;', $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testBodyEmpty(): void { $this->prepare(); @@ -415,8 +418,8 @@ public function testBodyEmpty(): void $this->assertSame($body, $this->response->getBody()); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testBodyScriptNonce(): void { $this->prepare(); @@ -490,8 +493,8 @@ public function testBodyStyleNonceDisableAutoNonce(): void $result->assertHeader('Content-Security-Policy'); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testBodyStyleNonce(): void { $this->prepare(); @@ -527,8 +530,8 @@ public function testBodyStyleNonceCustomStyleTag(): void $this->assertStringContainsString('nonce=', $response->getBody()); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testHeaderWrongCaseNotFound(): void { $this->prepare(); @@ -538,8 +541,8 @@ public function testHeaderWrongCaseNotFound(): void $this->assertNull($result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testHeaderIgnoreCase(): void { $this->prepare(); @@ -549,8 +552,8 @@ public function testHeaderIgnoreCase(): void $this->assertStringContainsString("base-uri 'self';", $result); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testCSPDisabled(): void { $this->prepare(false); @@ -578,8 +581,8 @@ public function testGetStyleNonce(): void $this->assertMatchesRegularExpression('/\A[0-9a-z]{24}\z/', $nonce); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testHeaderScriptNonceEmittedOnceGetScriptNonceCalled(): void { $this->prepare(); diff --git a/tests/system/HTTP/CorsTest.php b/tests/system/HTTP/CorsTest.php index dac9aaa000af..88b63a96cb11 100644 --- a/tests/system/HTTP/CorsTest.php +++ b/tests/system/HTTP/CorsTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CorsTest extends CIUnitTestCase { /** diff --git a/tests/system/HTTP/DownloadResponseTest.php b/tests/system/HTTP/DownloadResponseTest.php index 1ee24ed58692..5116c47eb6da 100644 --- a/tests/system/HTTP/DownloadResponseTest.php +++ b/tests/system/HTTP/DownloadResponseTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Exceptions\DownloadException; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class DownloadResponseTest extends CIUnitTestCase { protected function setUp(): void @@ -316,8 +319,8 @@ public function testPretendOutput(): void $this->assertSame(file_get_contents(__FILE__), $actual); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testRealOutput(): void { $response = new DownloadResponse('unit-test.php', false); diff --git a/tests/system/HTTP/Files/FileCollectionTest.php b/tests/system/HTTP/Files/FileCollectionTest.php index b2e026ac2374..6861a81dc343 100644 --- a/tests/system/HTTP/Files/FileCollectionTest.php +++ b/tests/system/HTTP/Files/FileCollectionTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\HTTP\Files; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Mimes; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileCollectionTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index 1eb476e67222..b33c5867cf50 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\HTTP\Files; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileMovingTest extends CIUnitTestCase { private ?vfsStreamDirectory $root; diff --git a/tests/system/HTTP/HeaderTest.php b/tests/system/HTTP/HeaderTest.php index f07ce98ca49f..52b29fe44cb1 100644 --- a/tests/system/HTTP/HeaderTest.php +++ b/tests/system/HTTP/HeaderTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Error; use stdClass; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class HeaderTest extends CIUnitTestCase { public function testHeaderStoresBasics(): void diff --git a/tests/system/HTTP/IncomingRequestDetectingTest.php b/tests/system/HTTP/IncomingRequestDetectingTest.php index 85e948a8240f..ad6e3295f941 100644 --- a/tests/system/HTTP/IncomingRequestDetectingTest.php +++ b/tests/system/HTTP/IncomingRequestDetectingTest.php @@ -13,14 +13,16 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\App; /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class IncomingRequestDetectingTest extends CIUnitTestCase { private IncomingRequest $request; diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index da4e55d4ca5f..7ac764b18d88 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -13,6 +13,11 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\HTTP\Exceptions\HTTPException; @@ -26,8 +31,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[BackupGlobals(true)] +#[Group('SeparateProcess')] final class IncomingRequestTest extends CIUnitTestCase { private Request $request; @@ -143,8 +148,8 @@ public function testCanGetOldInputArrayWithSESSION(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492 */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testCanGetOldInputArrayWithSessionService(): void { $locations = [ @@ -662,7 +667,7 @@ public static function provideCanGrabGetRawInputVar(): iterable * @param mixed $filter * @param mixed $flag */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideCanGrabGetRawInputVar')] + #[DataProvider('provideCanGrabGetRawInputVar')] public function testCanGrabGetRawInputVar($rawstring, $var, $expected, $filter, $flag): void { $config = new App(); @@ -673,7 +678,7 @@ public function testCanGrabGetRawInputVar($rawstring, $var, $expected, $filter, $this->assertSame($expected, $request->getRawInputVar($var, $filter, $flag)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideIsHTTPMethods')] + #[DataProvider('provideIsHTTPMethods')] public function testIsHTTPMethodLowerCase(string $value): void { $request = $this->request->withMethod($value); @@ -694,7 +699,7 @@ public static function provideIsHTTPMethods(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideIsHTTPMethods')] + #[DataProvider('provideIsHTTPMethods')] public function testIsHTTPMethodUpperCase(string $value): void { $request = $this->request->withMethod($value); @@ -917,7 +922,7 @@ public static function provideExtensionPHP(): iterable * @param mixed $path * @param mixed $detectPath */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideExtensionPHP')] + #[DataProvider('provideExtensionPHP')] public function testExtensionPHP($path, $detectPath): void { $config = new App(); diff --git a/tests/system/HTTP/MessageTest.php b/tests/system/HTTP/MessageTest.php index 2359f5cf8c68..304478338294 100644 --- a/tests/system/HTTP/MessageTest.php +++ b/tests/system/HTTP/MessageTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use InvalidArgumentException; @@ -20,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class MessageTest extends CIUnitTestCase { private ?Message $message; @@ -209,7 +211,7 @@ public static function provideArrayHeaderValue(): iterable /** * @param array $arrayHeaderValue */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayHeaderValue')] + #[DataProvider('provideArrayHeaderValue')] public function testSetHeaderWithExistingArrayValuesAppendStringValue($arrayHeaderValue): void { $this->message->setHeader('Accept', $arrayHeaderValue); @@ -221,7 +223,7 @@ public function testSetHeaderWithExistingArrayValuesAppendStringValue($arrayHead /** * @param array $arrayHeaderValue */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayHeaderValue')] + #[DataProvider('provideArrayHeaderValue')] public function testSetHeaderWithExistingArrayValuesAppendArrayValue($arrayHeaderValue): void { $this->message->setHeader('Accept', $arrayHeaderValue); diff --git a/tests/system/HTTP/NegotiateTest.php b/tests/system/HTTP/NegotiateTest.php index ed7ee482c369..90cdf81ac378 100644 --- a/tests/system/HTTP/NegotiateTest.php +++ b/tests/system/HTTP/NegotiateTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class NegotiateTest extends CIUnitTestCase { private ?IncomingRequest $request; diff --git a/tests/system/HTTP/OutgoingRequestTest.php b/tests/system/HTTP/OutgoingRequestTest.php index bc1e8b58f13e..c1645f9c1a71 100644 --- a/tests/system/HTTP/OutgoingRequestTest.php +++ b/tests/system/HTTP/OutgoingRequestTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class OutgoingRequestTest extends CIUnitTestCase { public function testCreateWithHeader(): void diff --git a/tests/system/HTTP/RedirectExceptionTest.php b/tests/system/HTTP/RedirectExceptionTest.php index afa7ca278a5d..cb0ae7024de8 100644 --- a/tests/system/HTTP/RedirectExceptionTest.php +++ b/tests/system/HTTP/RedirectExceptionTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Exceptions\RedirectException; use CodeIgniter\I18n\Time; use CodeIgniter\Log\Logger; @@ -25,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class RedirectExceptionTest extends TestCase { protected function setUp(): void diff --git a/tests/system/HTTP/RedirectResponseTest.php b/tests/system/HTTP/RedirectResponseTest.php index c31295415abb..2c96c2651f70 100644 --- a/tests/system/HTTP/RedirectResponseTest.php +++ b/tests/system/HTTP/RedirectResponseTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Router\RouteCollection; @@ -27,7 +30,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class RedirectResponseTest extends CIUnitTestCase { /** @@ -128,8 +131,8 @@ public function testRedirectRelativeConvertsToFullURI(): void $this->assertSame('http://example.com/index.php/foo', $response->getHeaderLine('Location')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testWithInput(): void { $_SESSION = []; @@ -146,8 +149,8 @@ public function testWithInput(): void $this->assertSame('baz', $_SESSION['_ci_old_input']['post']['bar']); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testWithValidationErrors(): void { $_SESSION = []; @@ -164,8 +167,8 @@ public function testWithValidationErrors(): void $this->assertArrayHasKey('_ci_validation_errors', $_SESSION); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testWith(): void { $_SESSION = []; @@ -178,8 +181,8 @@ public function testWith(): void $this->assertArrayHasKey('foo', $_SESSION); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testRedirectBack(): void { $_SERVER['HTTP_REFERER'] = 'http://somewhere.com'; @@ -193,8 +196,8 @@ public function testRedirectBack(): void $this->assertSame('http://somewhere.com', $returned->header('location')->getValue()); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testRedirectBackMissing(): void { $_SESSION = []; @@ -209,8 +212,8 @@ public function testRedirectBackMissing(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/2119 */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testRedirectRouteBaseUrl(): void { $config = new App(); @@ -246,8 +249,8 @@ public function testWithCookies(): void $this->assertTrue($response->hasCookie('foo', 'bar')); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testWithCookiesWithEmptyCookies(): void { $_SESSION = []; diff --git a/tests/system/HTTP/RequestTest.php b/tests/system/HTTP/RequestTest.php index f0298aaa30e2..0dc74a5d12a0 100644 --- a/tests/system/HTTP/RequestTest.php +++ b/tests/system/HTTP/RequestTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Test\CIUnitTestCase; use Config\App; @@ -20,8 +22,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class RequestTest extends CIUnitTestCase { private Request $request; diff --git a/tests/system/HTTP/ResponseCookieTest.php b/tests/system/HTTP/ResponseCookieTest.php index a220e3678395..5831540169d9 100644 --- a/tests/system/HTTP/ResponseCookieTest.php +++ b/tests/system/HTTP/ResponseCookieTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Cookie; use CodeIgniter\Cookie\CookieStore; @@ -24,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ResponseCookieTest extends CIUnitTestCase { private array $defaults; diff --git a/tests/system/HTTP/ResponseSendTest.php b/tests/system/HTTP/ResponseSendTest.php index beee6886371c..1d6e94de8985 100644 --- a/tests/system/HTTP/ResponseSendTest.php +++ b/tests/system/HTTP/ResponseSendTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Security\Exceptions\SecurityException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; @@ -26,7 +29,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class ResponseSendTest extends CIUnitTestCase { /** @@ -42,8 +45,8 @@ final class ResponseSendTest extends CIUnitTestCase * The tests includes a basic sanity check, to make sure that * the body we thought would be sent actually was. */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testHeadersMissingDate(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -78,8 +81,8 @@ public function testHeadersMissingDate(): void * This test does not test that CSP is handled properly - * it makes sure that sending gives CSP a chance to do its thing. */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testHeadersWithCSP(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -117,8 +120,8 @@ public function testHeadersWithCSP(): void * * @see https://github.com/codeigniter4/CodeIgniter4/issues/1393 */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testRedirectResponseCookies(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index bba85116f12c..d80db9c45083 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; @@ -25,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ResponseTest extends CIUnitTestCase { private array $server; @@ -269,7 +271,7 @@ public function testRedirectSetsDefaultCodeAndLocationHeader(): void $this->assertSame(302, $response->getStatusCode()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRedirect')] + #[DataProvider('provideRedirect')] public function testRedirect( string $server, string $protocol, @@ -313,7 +315,7 @@ public static function provideRedirect(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRedirectWithIIS')] + #[DataProvider('provideRedirectWithIIS')] public function testRedirectWithIIS( string $protocol, string $method, diff --git a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php index 3f84409d3dcf..bde5fe629e51 100644 --- a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php +++ b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Superglobals; use CodeIgniter\Test\CIUnitTestCase; use Config\App; @@ -20,8 +23,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class SiteURIFactoryDetectRoutePathTest extends CIUnitTestCase { protected function setUp(): void @@ -281,7 +284,7 @@ public function testPathInfoSubfolder(): void * @param string $path * @param string $detectPath */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideExtensionPHP')] + #[DataProvider('provideExtensionPHP')] public function testExtensionPHP($path, $detectPath): void { $config = new App(); diff --git a/tests/system/HTTP/SiteURIFactoryTest.php b/tests/system/HTTP/SiteURIFactoryTest.php index 2203e3453b09..9b2acf06d51e 100644 --- a/tests/system/HTTP/SiteURIFactoryTest.php +++ b/tests/system/HTTP/SiteURIFactoryTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Superglobals; use CodeIgniter\Test\CIUnitTestCase; use Config\App; @@ -20,8 +23,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class SiteURIFactoryTest extends CIUnitTestCase { protected function setUp(): void @@ -85,7 +88,7 @@ public function testCreateFromGlobalsAllowedHost(): void $this->assertSame('woot', $uri->getRoutePath()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideCreateFromStringWithIndexPage')] + #[DataProvider('provideCreateFromStringWithIndexPage')] public function testCreateFromStringWithIndexPage( string $uriString, string $expectUriString, @@ -126,7 +129,7 @@ public static function provideCreateFromStringWithIndexPage(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideCreateFromStringWithoutIndexPage')] + #[DataProvider('provideCreateFromStringWithoutIndexPage')] public function testCreateFromStringWithoutIndexPage( string $uriString, string $expectUriString, diff --git a/tests/system/HTTP/SiteURITest.php b/tests/system/HTTP/SiteURITest.php index b8cac4d7058f..b529b215abf7 100644 --- a/tests/system/HTTP/SiteURITest.php +++ b/tests/system/HTTP/SiteURITest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use BadMethodCallException; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\HTTP\Exceptions\HTTPException; @@ -22,11 +25,11 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class SiteURITest extends CIUnitTestCase { - #[\PHPUnit\Framework\Attributes\DataProvider('provideConstructor')] + #[DataProvider('provideConstructor')] public function testConstructor( string $baseURL, string $indexPage, @@ -323,7 +326,7 @@ public function testConstructorInvalidBaseURL(): void new SiteURI($config); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSetPath')] + #[DataProvider('provideSetPath')] public function testSetPath( string $baseURL, string $indexPage, diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 9b5f7ba1d32f..1ada5869ecb5 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\Exceptions\HTTPException; @@ -22,8 +25,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class URITest extends CIUnitTestCase { public function testConstructorSetsAllParts(): void @@ -125,7 +128,7 @@ public function testCanCastAsString(): void $this->assertSame($expected, (string) $uri); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSimpleUri')] + #[DataProvider('provideSimpleUri')] public function testSimpleUri(string $url, string $expectedURL, string $expectedPath): void { $uri = new URI($url); @@ -397,7 +400,7 @@ public function testSetPathSetsValue(): void $this->assertSame($expected, (string) $uri); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSetPath')] + #[DataProvider('provideSetPath')] public function testSetPath(string $path, string $expectedURL, string $expectedPath): void { $url = 'http://example.com/'; @@ -511,7 +514,7 @@ public static function providePathGetsFiltered(): iterable * @param string $path * @param string $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('providePathGetsFiltered')] + #[DataProvider('providePathGetsFiltered')] public function testPathGetsFiltered($path, $expected): void { $uri = new URI(); @@ -626,7 +629,7 @@ public static function provideAuthorityReturnsExceptedValues(): iterable * @param string $url * @param string $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAuthorityReturnsExceptedValues')] + #[DataProvider('provideAuthorityReturnsExceptedValues')] public function testAuthorityReturnsExceptedValues($url, $expected): void { $uri = new URI($url); @@ -652,7 +655,7 @@ public static function provideAuthorityRemovesDefaultPorts(): iterable * @param string $scheme * @param int $port */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAuthorityRemovesDefaultPorts')] + #[DataProvider('provideAuthorityRemovesDefaultPorts')] public function testAuthorityRemovesDefaultPorts($scheme, $port): void { $url = "{$scheme}://example.com:{$port}/path"; @@ -774,7 +777,7 @@ public static function provideRemoveDotSegments(): iterable * @param string $path * @param string $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideRemoveDotSegments')] + #[DataProvider('provideRemoveDotSegments')] public function testRemoveDotSegments($path, $expected): void { $this->assertSame($expected, URI::removeDotSegments($path)); @@ -814,7 +817,7 @@ public static function defaultResolutions(): iterable * @param string $rel * @param string $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('defaultResolutions')] + #[DataProvider('defaultResolutions')] public function testResolveRelativeURI($rel, $expected): void { $base = 'http://a/b/c/d'; @@ -829,7 +832,7 @@ public function testResolveRelativeURI($rel, $expected): void * @param string $rel * @param string $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('defaultResolutions')] + #[DataProvider('defaultResolutions')] public function testResolveRelativeURIHTTPS($rel, $expected): void { $base = 'https://a/b/c/d'; diff --git a/tests/system/HTTP/UserAgentTest.php b/tests/system/HTTP/UserAgentTest.php index 2d03f8cae933..a72ff9129f5e 100644 --- a/tests/system/HTTP/UserAgentTest.php +++ b/tests/system/HTTP/UserAgentTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\HTTP; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class UserAgentTest extends CIUnitTestCase { private string $_user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27'; diff --git a/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php b/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php index 9332bcccf5b4..ead5b25643f2 100644 --- a/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php +++ b/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Helpers\Array; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use InvalidArgumentException; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ArrayHelperDotKeyExistsTest extends CIUnitTestCase { private array $array = [ diff --git a/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php b/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php index 5d8c9fa3d42c..dfd2ac994f98 100644 --- a/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php +++ b/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Helpers\Array; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ArrayHelperRecursiveDiffTest extends CIUnitTestCase { private array $compareWith; diff --git a/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php b/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php index 314d406671ea..5ed25d142be8 100644 --- a/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php +++ b/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Helpers\Array; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ArrayHelperSortValuesByNaturalTest extends CIUnitTestCase { private array $arrayWithStringValues = [ diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index 5cb240c57fad..dc6289b6aa2e 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -13,13 +13,15 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use ValueError; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ArrayHelperTest extends CIUnitTestCase { protected function setUp(): void @@ -212,7 +214,7 @@ public function testArrayDotIgnoresLastWildcard(): void * @param int|string $key * @param array|string|null $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayDeepSearch')] + #[DataProvider('provideArrayDeepSearch')] public function testArrayDeepSearch($key, $expected): void { $data = [ @@ -246,7 +248,7 @@ public function testArrayDeepSearchReturnNullEmptyArray(): void $this->assertNull(array_deep_search('key644', $data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] + #[DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysWithArray(array $data, array $sortColumns, array $expected): void { $success = array_sort_by_multiple_keys($data, $sortColumns); @@ -255,7 +257,7 @@ public function testArraySortByMultipleKeysWithArray(array $data, array $sortCol $this->assertSame($expected, array_column($data, 'name')); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] + #[DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysWithObjects(array $data, array $sortColumns, array $expected): void { // Morph to objects @@ -269,7 +271,7 @@ public function testArraySortByMultipleKeysWithObjects(array $data, array $sortC $this->assertSame($expected, array_column((array) $data, 'name')); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] + #[DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysFailsEmptyParameter(array $data, array $sortColumns, array $expected): void { // Both filled @@ -292,7 +294,7 @@ public function testArraySortByMultipleKeysFailsEmptyParameter(array $data, arra /** * @param mixed $data */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideSortByMultipleKeys')] + #[DataProvider('provideSortByMultipleKeys')] public function testArraySortByMultipleKeysFailsInconsistentArraySizes($data): void { $this->expectException(ValueError::class); @@ -385,7 +387,7 @@ public static function provideSortByMultipleKeys(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayFlattening')] + #[DataProvider('provideArrayFlattening')] public function testArrayFlattening(array $input, array $expected): void { $this->assertSame($expected, array_flatten_with_dots($input)); @@ -483,7 +485,7 @@ public static function provideArrayFlattening(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayGroupByIncludeEmpty')] + #[DataProvider('provideArrayGroupByIncludeEmpty')] public function testArrayGroupByIncludeEmpty(array $indexes, array $data, array $expected): void { $actual = array_group_by($data, $indexes, true); @@ -491,7 +493,7 @@ public function testArrayGroupByIncludeEmpty(array $indexes, array $data, array $this->assertSame($expected, $actual, 'array including empty not the same'); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideArrayGroupByExcludeEmpty')] + #[DataProvider('provideArrayGroupByExcludeEmpty')] public function testArrayGroupByExcludeEmpty(array $indexes, array $data, array $expected): void { $actual = array_group_by($data, $indexes, false); diff --git a/tests/system/Helpers/CookieHelperTest.php b/tests/system/Helpers/CookieHelperTest.php index 40e02a808b1a..a872fb1ffe05 100755 --- a/tests/system/Helpers/CookieHelperTest.php +++ b/tests/system/Helpers/CookieHelperTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\HTTP\IncomingRequest; @@ -29,7 +30,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CookieHelperTest extends CIUnitTestCase { private IncomingRequest $request; diff --git a/tests/system/Helpers/DateHelperTest.php b/tests/system/Helpers/DateHelperTest.php index 3ac268fbf264..cfbbbc5da25b 100644 --- a/tests/system/Helpers/DateHelperTest.php +++ b/tests/system/Helpers/DateHelperTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\I18n\Time; use CodeIgniter\Test\CIUnitTestCase; use DateTimeZone; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DateHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 4e7cbe7e1045..f0caa2264b01 100644 --- a/tests/system/Helpers/FilesystemHelperTest.php +++ b/tests/system/Helpers/FilesystemHelperTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\visitor\vfsStreamStructureVisitor; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FilesystemHelperTest extends CIUnitTestCase { /** diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php index cc9e16edb155..9c3a22d57527 100644 --- a/tests/system/Helpers/FormHelperTest.php +++ b/tests/system/Helpers/FormHelperTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\HTTP\SiteURI; use CodeIgniter\Test\CIUnitTestCase; use Config\App; @@ -23,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class FormHelperTest extends CIUnitTestCase { protected function setUp(): void @@ -952,8 +955,8 @@ public function testSetCheckboxWithUnchecked(): void ); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSetRadioFromSessionOldInput(): void { $_SESSION = [ @@ -970,8 +973,8 @@ public function testSetRadioFromSessionOldInput(): void unset($_SESSION['_ci_old_input']); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSetRadioFromPost(): void { $_POST['bar'] = 'baz'; @@ -981,8 +984,8 @@ public function testSetRadioFromPost(): void $this->assertSame('', set_radio('bar', 'boop', true)); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testSetRadioFromPostWithValueZero(): void { $_POST['bar'] = '0'; diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php index c66e4b3d0ff8..ecf576734790 100755 --- a/tests/system/Helpers/HTMLHelperTest.php +++ b/tests/system/Helpers/HTMLHelperTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class HTMLHelperTest extends CIUnitTestCase { private array $tracks; diff --git a/tests/system/Helpers/InflectorHelperTest.php b/tests/system/Helpers/InflectorHelperTest.php index a20d39f26f59..bb5cb8da21c8 100755 --- a/tests/system/Helpers/InflectorHelperTest.php +++ b/tests/system/Helpers/InflectorHelperTest.php @@ -13,12 +13,14 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class InflectorHelperTest extends CIUnitTestCase { protected function setUp(): void @@ -260,7 +262,7 @@ public static function provideOrdinal(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideOrdinal')] + #[DataProvider('provideOrdinal')] public function testOrdinal(string $suffix, int $number): void { $this->assertSame($suffix, ordinal($number)); diff --git a/tests/system/Helpers/NumberHelperTest.php b/tests/system/Helpers/NumberHelperTest.php index 0a2f112dc9e2..68c133ea1d8f 100755 --- a/tests/system/Helpers/NumberHelperTest.php +++ b/tests/system/Helpers/NumberHelperTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class NumberHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Helpers/SecurityHelperTest.php b/tests/system/Helpers/SecurityHelperTest.php index 7d0821e7a572..59c85b9077ed 100644 --- a/tests/system/Helpers/SecurityHelperTest.php +++ b/tests/system/Helpers/SecurityHelperTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockSecurity; use Config\Security as SecurityConfig; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SecurityHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Helpers/TextHelperTest.php b/tests/system/Helpers/TextHelperTest.php index e32a8b2c0a8a..382c68b3aafd 100755 --- a/tests/system/Helpers/TextHelperTest.php +++ b/tests/system/Helpers/TextHelperTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use InvalidArgumentException; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TextHelperTest extends CIUnitTestCase { private string $_long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; diff --git a/tests/system/Helpers/URLHelper/CurrentUrlTest.php b/tests/system/Helpers/URLHelper/CurrentUrlTest.php index 77c6d85ae3c5..abe001aa60af 100644 --- a/tests/system/Helpers/URLHelper/CurrentUrlTest.php +++ b/tests/system/Helpers/URLHelper/CurrentUrlTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Helpers\URLHelper; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -30,8 +33,8 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class CurrentUrlTest extends CIUnitTestCase { private App $config; @@ -280,7 +283,7 @@ public static function provideUrlIs(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlIs')] + #[DataProvider('provideUrlIs')] public function testUrlIs(string $currentPath, string $testPath, bool $expected): void { $_SERVER['HTTP_HOST'] = 'example.com'; @@ -291,7 +294,7 @@ public function testUrlIs(string $currentPath, string $testPath, bool $expected) $this->assertSame($expected, url_is($testPath)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlIs')] + #[DataProvider('provideUrlIs')] public function testUrlIsNoIndex(string $currentPath, string $testPath, bool $expected): void { $_SERVER['HTTP_HOST'] = 'example.com'; @@ -304,7 +307,7 @@ public function testUrlIsNoIndex(string $currentPath, string $testPath, bool $ex $this->assertSame($expected, url_is($testPath)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlIs')] + #[DataProvider('provideUrlIs')] public function testUrlIsWithSubfolder(string $currentPath, string $testPath, bool $expected): void { $_SERVER['HTTP_HOST'] = 'example.com'; diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index 4f3c47803ea4..def34b04cd93 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -13,6 +13,11 @@ namespace CodeIgniter\Helpers\URLHelper; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -27,8 +32,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class MiscUrlTest extends CIUnitTestCase { private App $config; @@ -53,9 +58,9 @@ protected function tearDown(): void $_SERVER = []; } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] - #[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[Group('SeparateProcess')] public function testPreviousURLUsesSessionFirst(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -88,9 +93,9 @@ private function createRequest(string $uri): void Factories::injectMock('config', 'App', $this->config); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] - #[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[Group('SeparateProcess')] public function testPreviousURLUsesRefererIfNeeded(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -180,7 +185,7 @@ public static function provideAnchor(): iterable * @param mixed $title * @param mixed $attributes */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchor')] + #[DataProvider('provideAnchor')] public function testAnchor($expected = '', $uri = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -244,7 +249,7 @@ public static function provideAnchorNoindex(): iterable * @param mixed $title * @param mixed $attributes */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorNoindex')] + #[DataProvider('provideAnchorNoindex')] public function testAnchorNoindex($expected = '', $uri = '', $title = '', $attributes = ''): void { $this->config->indexPage = ''; @@ -300,7 +305,7 @@ public static function provideAnchorTargetted(): iterable * @param mixed $title * @param mixed $attributes */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorTargetted')] + #[DataProvider('provideAnchorTargetted')] public function testAnchorTargetted($expected = '', $uri = '', $title = '', $attributes = ''): void { $this->config->indexPage = ''; @@ -345,7 +350,7 @@ public static function provideAnchorExamples(): iterable * @param mixed $title * @param mixed $attributes */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorExamples')] + #[DataProvider('provideAnchorExamples')] public function testAnchorExamples($expected = '', $uri = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -402,7 +407,7 @@ public static function provideAnchorPopup(): iterable * @param mixed $title * @param mixed $attributes */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAnchorPopup')] + #[DataProvider('provideAnchorPopup')] public function testAnchorPopup($expected = '', $uri = '', $title = '', $attributes = false): void { $uriString = 'http://example.com/'; @@ -440,7 +445,7 @@ public static function provideMailto(): iterable * @param mixed $title * @param mixed $attributes */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideMailto')] + #[DataProvider('provideMailto')] public function testMailto($expected = '', $email = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -478,7 +483,7 @@ public static function provideSafeMailto(): iterable * @param mixed $title * @param mixed $attributes */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideSafeMailto')] + #[DataProvider('provideSafeMailto')] public function testSafeMailto($expected = '', $email = '', $title = '', $attributes = ''): void { $uriString = 'http://example.com/'; @@ -541,7 +546,7 @@ public static function provideAutoLinkUrl(): iterable * @param mixed $in * @param mixed $out */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAutoLinkUrl')] + #[DataProvider('provideAutoLinkUrl')] public function testAutoLinkUrl($in, $out): void { $this->assertSame($out, auto_link($in, 'url')); @@ -589,7 +594,7 @@ public static function provideAutoLinkEmail(): iterable * @param mixed $in * @param mixed $out */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAutoLinkEmail')] + #[DataProvider('provideAutoLinkEmail')] public function testAutoLinkEmail($in, $out): void { $this->assertSame($out, auto_link($in, 'email')); @@ -637,7 +642,7 @@ public static function provideAutolinkBoth(): iterable * @param mixed $in * @param mixed $out */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAutolinkBoth')] + #[DataProvider('provideAutolinkBoth')] public function testAutolinkBoth($in, $out): void { $this->assertSame($out, auto_link($in)); @@ -685,7 +690,7 @@ public static function provideAutoLinkPopup(): iterable * @param mixed $in * @param mixed $out */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAutoLinkPopup')] + #[DataProvider('provideAutoLinkPopup')] public function testAutoLinkPopup($in, $out): void { $this->assertSame($out, auto_link($in, 'url', true)); @@ -770,7 +775,7 @@ public static function providePrepUrl(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('providePrepUrl')] + #[DataProvider('providePrepUrl')] public function testPrepUrl(string $input, string $expected, bool $secure): void { $this->assertSame($expected, prep_url($input, $secure)); @@ -834,7 +839,7 @@ public function testMbUrlTitleExtraDashes(): void } } - #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlTo')] + #[DataProvider('provideUrlTo')] public function testUrlTo(string $expected, string $input, ...$args): void { $_SERVER['HTTP_HOST'] = 'example.com'; @@ -848,7 +853,7 @@ public function testUrlTo(string $expected, string $input, ...$args): void $this->assertSame($expected, url_to($input, ...$args)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideUrlToThrowsOnEmptyOrMissingRoute')] + #[DataProvider('provideUrlToThrowsOnEmptyOrMissingRoute')] public function testUrlToThrowsOnEmptyOrMissingRoute(string $route): void { $this->expectException(RouterException::class); diff --git a/tests/system/Helpers/URLHelper/SiteUrlCliTest.php b/tests/system/Helpers/URLHelper/SiteUrlCliTest.php index 0bd9a0d5f720..c688ba6fbcb4 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlCliTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlCliTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Helpers\URLHelper; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\CLIRequest; @@ -26,8 +29,8 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class SiteUrlCliTest extends CIUnitTestCase { private App $config; @@ -70,7 +73,7 @@ private function createRequest(?App $config = null): void * @param string $expectedSiteUrl * @param string $expectedBaseUrl */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideUrls')] + #[DataProvider('provideUrls')] public function testUrls( $baseURL, $indexPage, diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index 8bf26f67d7e0..d07a9e50200f 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Helpers\URLHelper; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -29,8 +32,8 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class SiteUrlTest extends CIUnitTestCase { private App $config; @@ -80,7 +83,7 @@ private function createRequest(?App $config = null, $body = null, ?string $path * @param string $expectedSiteUrl * @param string $expectedBaseUrl */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideUrls')] + #[DataProvider('provideUrls')] public function testUrls( $baseURL, $indexPage, diff --git a/tests/system/Helpers/XMLHelperTest.php b/tests/system/Helpers/XMLHelperTest.php index af1852a32b12..681314127ea9 100644 --- a/tests/system/Helpers/XMLHelperTest.php +++ b/tests/system/Helpers/XMLHelperTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Helpers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class XMLHelperTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/HomeTest.php b/tests/system/HomeTest.php index 4347beb2ca8f..161535aa1d22 100644 --- a/tests/system/HomeTest.php +++ b/tests/system/HomeTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\FeatureTestTrait; use CodeIgniter\Test\TestResponse; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class HomeTest extends CIUnitTestCase { use FeatureTestTrait; diff --git a/tests/system/Honeypot/HoneypotTest.php b/tests/system/Honeypot/HoneypotTest.php index 30128b8d03f7..d97794cb160e 100644 --- a/tests/system/Honeypot/HoneypotTest.php +++ b/tests/system/Honeypot/HoneypotTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Honeypot; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\Filters\Filters; @@ -27,8 +29,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class HoneypotTest extends CIUnitTestCase { private HoneypotConfig $config; diff --git a/tests/system/HotReloader/DirectoryHasherTest.php b/tests/system/HotReloader/DirectoryHasherTest.php index 31d65a819376..f8dcecedf0e5 100644 --- a/tests/system/HotReloader/DirectoryHasherTest.php +++ b/tests/system/HotReloader/DirectoryHasherTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\HotReloader; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DirectoryHasherTest extends CIUnitTestCase { private DirectoryHasher $hasher; diff --git a/tests/system/I18n/TimeDifferenceTest.php b/tests/system/I18n/TimeDifferenceTest.php index bb45a2388b9a..0a1e244c19e9 100644 --- a/tests/system/I18n/TimeDifferenceTest.php +++ b/tests/system/I18n/TimeDifferenceTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\I18n; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Locale; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TimeDifferenceTest extends CIUnitTestCase { private string $currentLocale; diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index 20857cd633cf..2f85b7d9122b 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\I18n; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\I18n\Exceptions\I18nException; use CodeIgniter\Test\CIUnitTestCase; @@ -25,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TimeLegacyTest extends CIUnitTestCase { private string $currentLocale; @@ -1151,7 +1153,7 @@ public function testSetTestNowWithFaLocale(): void $this->assertSame('2017-03-10T12:00:00+09:00', $now); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideToStringDoesNotDependOnLocale')] + #[DataProvider('provideToStringDoesNotDependOnLocale')] public function testToStringDoesNotDependOnLocale(string $locale): void { Locale::setDefault($locale); diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index d4bdaba8f349..606e3cd0d6e8 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\I18n; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\I18n\Exceptions\I18nException; use CodeIgniter\Test\CIUnitTestCase; @@ -25,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TimeTest extends CIUnitTestCase { private string $currentLocale; @@ -1167,7 +1169,7 @@ public function testSetTestNowWithFaLocale(): void $this->assertSame('2017-03-10T12:00:00+09:00', $now); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideToStringDoesNotDependOnLocale')] + #[DataProvider('provideToStringDoesNotDependOnLocale')] public function testToStringDoesNotDependOnLocale(string $locale): void { Locale::setDefault($locale); diff --git a/tests/system/Images/BaseHandlerTest.php b/tests/system/Images/BaseHandlerTest.php index b6fe8c0b4ac7..cf02b4fb492c 100644 --- a/tests/system/Images/BaseHandlerTest.php +++ b/tests/system/Images/BaseHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Images; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Images\Exceptions\ImageException; @@ -31,7 +32,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class BaseHandlerTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Images/GDHandlerTest.php b/tests/system/Images/GDHandlerTest.php index 15df5d13bc1e..bab99482fe8f 100644 --- a/tests/system/Images/GDHandlerTest.php +++ b/tests/system/Images/GDHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Images; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Images\Exceptions\ImageException; use CodeIgniter\Images\Handlers\BaseHandler; @@ -31,7 +32,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class GDHandlerTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Images/ImageMagickHandlerTest.php b/tests/system/Images/ImageMagickHandlerTest.php index e9a04d2eafc5..4e67fce70a4a 100644 --- a/tests/system/Images/ImageMagickHandlerTest.php +++ b/tests/system/Images/ImageMagickHandlerTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Images; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\Images\Exceptions\ImageException; use CodeIgniter\Images\Handlers\BaseHandler; @@ -32,8 +35,8 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] -#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('imagick')] +#[Group('Others')] +#[RequiresPhpExtension('imagick')] final class ImageMagickHandlerTest extends CIUnitTestCase { private string $root; @@ -78,7 +81,7 @@ protected function setUp(): void $this->handler = Services::image('imagick', $config, false); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideNonexistentLibraryPathTerminatesProcessing')] + #[DataProvider('provideNonexistentLibraryPathTerminatesProcessing')] public function testNonexistentLibraryPathTerminatesProcessing(string $path, string $invalidPath): void { $this->expectException(ImageException::class); diff --git a/tests/system/Images/ImageTest.php b/tests/system/Images/ImageTest.php index d9b4418e3bd0..e1d782ea1a88 100644 --- a/tests/system/Images/ImageTest.php +++ b/tests/system/Images/ImageTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Images; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Images\Exceptions\ImageException; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ImageTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index 1dbb239f662b..69363c8fecae 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Language; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockLanguage; use Config\Services; @@ -22,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class LanguageTest extends CIUnitTestCase { private Language $lang; @@ -267,7 +269,7 @@ public static function provideBundleUniqueKeys(): iterable * * @param mixed $bundle */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideBundleUniqueKeys')] + #[DataProvider('provideBundleUniqueKeys')] public function testBundleUniqueKeys($bundle): void { $messages = require SYSTEMPATH . 'Language/en/' . $bundle . '.php'; diff --git a/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php b/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php index c3f37654a55b..dfb34b5c840f 100644 --- a/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php +++ b/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Log\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; use CodeIgniter\Test\Mock\MockResponse; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ChromeLoggerHandlerTest extends CIUnitTestCase { public function testCanHandleLogLevel(): void diff --git a/tests/system/Log/Handlers/ErrorlogHandlerTest.php b/tests/system/Log/Handlers/ErrorlogHandlerTest.php index 052aeabb2611..728ef653d2c1 100644 --- a/tests/system/Log/Handlers/ErrorlogHandlerTest.php +++ b/tests/system/Log/Handlers/ErrorlogHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Log\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Log\Exceptions\LogException; use CodeIgniter\Test\CIUnitTestCase; use PHPUnit\Framework\MockObject\MockObject; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ErrorlogHandlerTest extends CIUnitTestCase { public function testHandlerThrowsOnInvalidMessageType(): void diff --git a/tests/system/Log/Handlers/FileHandlerTest.php b/tests/system/Log/Handlers/FileHandlerTest.php index 25c323d9332e..eb7af4d53dbb 100644 --- a/tests/system/Log/Handlers/FileHandlerTest.php +++ b/tests/system/Log/Handlers/FileHandlerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Log\Handlers; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockFileLogger; use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileHandlerTest extends CIUnitTestCase { private vfsStreamDirectory $root; diff --git a/tests/system/Log/LoggerTest.php b/tests/system/Log/LoggerTest.php index 0611fe532649..e909fccbad69 100644 --- a/tests/system/Log/LoggerTest.php +++ b/tests/system/Log/LoggerTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Log; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\I18n\Time; use CodeIgniter\Log\Exceptions\LogException; @@ -25,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class LoggerTest extends CIUnitTestCase { protected function tearDown(): void diff --git a/tests/system/Models/AffectedRowsTest.php b/tests/system/Models/AffectedRowsTest.php index 07da816981a0..bbf749d23233 100644 --- a/tests/system/Models/AffectedRowsTest.php +++ b/tests/system/Models/AffectedRowsTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\UserModel; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class AffectedRowsTest extends LiveModelTestCase { /** diff --git a/tests/system/Models/CountAllModelTest.php b/tests/system/Models/CountAllModelTest.php index 8a3a3af617ca..f91a97c1b309 100644 --- a/tests/system/Models/CountAllModelTest.php +++ b/tests/system/Models/CountAllModelTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\UserModel; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class CountAllModelTest extends LiveModelTestCase { /** diff --git a/tests/system/Models/DataConverterModelTest.php b/tests/system/Models/DataConverterModelTest.php index ce404ab21e02..67df1ea3b356 100644 --- a/tests/system/Models/DataConverterModelTest.php +++ b/tests/system/Models/DataConverterModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\I18n\Time; use Tests\Support\Entity\CustomUser; use Tests\Support\Entity\User; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DataConverterModelTest extends LiveModelTestCase { protected $migrate = true; diff --git a/tests/system/Models/DeleteModelTest.php b/tests/system/Models/DeleteModelTest.php index a8e36ee1bb08..1cc0b3245f2b 100644 --- a/tests/system/Models/DeleteModelTest.php +++ b/tests/system/Models/DeleteModelTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Exceptions\ModelException; use Tests\Support\Models\JobModel; @@ -22,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DeleteModelTest extends LiveModelTestCase { public function testDeleteBasics(): void @@ -155,7 +157,7 @@ public function testOnlyDeleted(): void * * @param int|string|null $emptyValue */ - #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] + #[DataProvider('emptyPkValues')] public function testDontThrowExceptionWhenSoftDeleteConditionIsSetWithEmptyValue($emptyValue): void { $this->createModel(UserModel::class); @@ -168,7 +170,7 @@ public function testDontThrowExceptionWhenSoftDeleteConditionIsSetWithEmptyValue /** * @param int|string|null $emptyValue */ - #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] + #[DataProvider('emptyPkValues')] public function testThrowExceptionWhenSoftDeleteParamIsEmptyValue($emptyValue): void { $this->expectException(DatabaseException::class); @@ -182,7 +184,7 @@ public function testThrowExceptionWhenSoftDeleteParamIsEmptyValue($emptyValue): /** * @param int|string|null $emptyValue */ - #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] + #[DataProvider('emptyPkValues')] public function testDontDeleteRowsWhenSoftDeleteParamIsEmpty($emptyValue): void { $this->seeInDatabase('user', ['name' => 'Derek Jones', 'deleted_at IS NULL' => null]); @@ -241,7 +243,7 @@ public function testPurgeDeletedWithSoftDeleteFalse(): void /** * @param int|string|null $id */ - #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] + #[DataProvider('emptyPkValues')] public function testDeleteThrowDatabaseExceptionWithoutWhereClause($id): void { // BaseBuilder throws Exception. @@ -259,7 +261,7 @@ public function testDeleteThrowDatabaseExceptionWithoutWhereClause($id): void /** * @param int|string|null $id */ - #[\PHPUnit\Framework\Attributes\DataProvider('emptyPkValues')] + #[DataProvider('emptyPkValues')] public function testDeleteWithSoftDeleteThrowDatabaseExceptionWithoutWhereClause($id): void { // Model throws Exception. diff --git a/tests/system/Models/EventsModelTest.php b/tests/system/Models/EventsModelTest.php index 2ec66e73228f..d3a00ee0111c 100644 --- a/tests/system/Models/EventsModelTest.php +++ b/tests/system/Models/EventsModelTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; use Tests\Support\Models\EventModel; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class EventsModelTest extends LiveModelTestCase { /** diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index 6ec8452ac95f..362619855a59 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Exceptions\ModelException; use Tests\Support\Entity\UserWithCasts; @@ -24,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class FindModelTest extends LiveModelTestCase { public function testFindReturnsRow(): void @@ -181,7 +183,7 @@ public function testFirst(): void * @param mixed $groupBy * @param mixed $total */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideFirstAggregate')] + #[DataProvider('provideFirstAggregate')] public function testFirstAggregate($groupBy, $total): void { $this->createModel(UserModel::class); @@ -216,7 +218,7 @@ public static function provideFirstAggregate(): iterable * @param mixed $aggregate * @param mixed $groupBy */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAggregateAndGroupBy')] + #[DataProvider('provideAggregateAndGroupBy')] public function testFirstRespectsSoftDeletes($aggregate, $groupBy): void { $this->db->table('user') @@ -261,7 +263,7 @@ public function testFirstRespectsSoftDeletes($aggregate, $groupBy): void * @param mixed $aggregate * @param mixed $groupBy */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideAggregateAndGroupBy')] + #[DataProvider('provideAggregateAndGroupBy')] public function testFirstRecoverTempUseSoftDeletes($aggregate, $groupBy): void { $this->createModel(UserModel::class); diff --git a/tests/system/Models/GeneralModelTest.php b/tests/system/Models/GeneralModelTest.php index 7f04b7add02a..f85f5d795813 100644 --- a/tests/system/Models/GeneralModelTest.php +++ b/tests/system/Models/GeneralModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use BadMethodCallException; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Model; @@ -26,7 +27,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class GeneralModelTest extends CIUnitTestCase { /** diff --git a/tests/system/Models/GetCompiledModelTest.php b/tests/system/Models/GetCompiledModelTest.php index c495ba75b55b..288c7b189fd4 100644 --- a/tests/system/Models/GetCompiledModelTest.php +++ b/tests/system/Models/GetCompiledModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\ModelException; use CodeIgniter\Model; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class GetCompiledModelTest extends CIUnitTestCase { private ?object $model = null; diff --git a/tests/system/Models/InsertModelTest.php b/tests/system/Models/InsertModelTest.php index 6b00ba1260a1..6afd2260df7f 100644 --- a/tests/system/Models/InsertModelTest.php +++ b/tests/system/Models/InsertModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Entity\Entity; use CodeIgniter\I18n\Time; @@ -28,7 +29,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class InsertModelTest extends LiveModelTestCase { public function testSetWorksWithInsert(): void diff --git a/tests/system/Models/MiscellaneousModelTest.php b/tests/system/Models/MiscellaneousModelTest.php index 4388e691463a..c05896406054 100644 --- a/tests/system/Models/MiscellaneousModelTest.php +++ b/tests/system/Models/MiscellaneousModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\I18n\Time; use Tests\Support\Models\EntityModel; @@ -24,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class MiscellaneousModelTest extends LiveModelTestCase { public function testChunk(): void diff --git a/tests/system/Models/PaginateModelTest.php b/tests/system/Models/PaginateModelTest.php index b6fa8e27e845..b7e4661f83ec 100644 --- a/tests/system/Models/PaginateModelTest.php +++ b/tests/system/Models/PaginateModelTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\UserModel; use Tests\Support\Models\ValidModel; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class PaginateModelTest extends LiveModelTestCase { public function testPaginate(): void diff --git a/tests/system/Models/ReplaceModelTest.php b/tests/system/Models/ReplaceModelTest.php index 35ae1b207da7..1fa71323334e 100644 --- a/tests/system/Models/ReplaceModelTest.php +++ b/tests/system/Models/ReplaceModelTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\UserModel; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ReplaceModelTest extends LiveModelTestCase { public function testReplaceRespectsUseTimestamps(): void diff --git a/tests/system/Models/SaveModelTest.php b/tests/system/Models/SaveModelTest.php index a3186a470f74..8af9677196c8 100644 --- a/tests/system/Models/SaveModelTest.php +++ b/tests/system/Models/SaveModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Entity\Entity; use CodeIgniter\I18n\Time; @@ -28,7 +29,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class SaveModelTest extends LiveModelTestCase { public function testSaveNewRecordObject(): void diff --git a/tests/system/Models/TimestampModelTest.php b/tests/system/Models/TimestampModelTest.php index d99ab50bfc9c..36ea733cd643 100644 --- a/tests/system/Models/TimestampModelTest.php +++ b/tests/system/Models/TimestampModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\I18n\Time; use Tests\Support\Entity\User; use Tests\Support\Models\UserTimestampModel; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class TimestampModelTest extends LiveModelTestCase { protected $migrate = true; diff --git a/tests/system/Models/UpdateModelTest.php b/tests/system/Models/UpdateModelTest.php index 3296a2a211ef..c2f90705f998 100644 --- a/tests/system/Models/UpdateModelTest.php +++ b/tests/system/Models/UpdateModelTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Entity\Entity; @@ -33,7 +35,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class UpdateModelTest extends LiveModelTestCase { public function testSetWorksWithUpdate(): void @@ -553,7 +555,7 @@ public function testUpdateWithSetAndEscape(): void /** * @param false|null $id */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideUpdateThrowDatabaseExceptionWithoutWhereClause')] + #[DataProvider('provideUpdateThrowDatabaseExceptionWithoutWhereClause')] public function testUpdateThrowDatabaseExceptionWithoutWhereClause($id, string $exception, string $exceptionMessage): void { $this->expectException($exception); diff --git a/tests/system/Models/ValidationModelRuleGroupTest.php b/tests/system/Models/ValidationModelRuleGroupTest.php index 2a7a7b75258d..48bf900caa2a 100644 --- a/tests/system/Models/ValidationModelRuleGroupTest.php +++ b/tests/system/Models/ValidationModelRuleGroupTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Model; use Config\Services; @@ -26,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ValidationModelRuleGroupTest extends LiveModelTestCase { protected function setUp(): void diff --git a/tests/system/Models/ValidationModelTest.php b/tests/system/Models/ValidationModelTest.php index 753c437250cd..0abce78b7f51 100644 --- a/tests/system/Models/ValidationModelTest.php +++ b/tests/system/Models/ValidationModelTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Model; use Config\Validation; @@ -25,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class ValidationModelTest extends LiveModelTestCase { protected function setUp(): void diff --git a/tests/system/Models/WhenWhenNotModelTest.php b/tests/system/Models/WhenWhenNotModelTest.php index 61bf3f375216..31015aa88bb1 100644 --- a/tests/system/Models/WhenWhenNotModelTest.php +++ b/tests/system/Models/WhenWhenNotModelTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Models; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\SecondaryModel; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class WhenWhenNotModelTest extends LiveModelTestCase { public function testWhenWithTrueCondition(): void diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index 795401ecb71d..c0dd61b05186 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Pager; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\URI; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PagerRendererTest extends CIUnitTestCase { private string $expect; diff --git a/tests/system/Pager/PagerTest.php b/tests/system/Pager/PagerTest.php index 6da74a9bce2d..d3bec487a475 100644 --- a/tests/system/Pager/PagerTest.php +++ b/tests/system/Pager/PagerTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Pager; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\SiteURI; @@ -27,8 +29,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class PagerTest extends CIUnitTestCase { private ?Pager $pager = null; diff --git a/tests/system/Publisher/ContentReplacerTest.php b/tests/system/Publisher/ContentReplacerTest.php index 2c7f5db96685..6e667215da48 100644 --- a/tests/system/Publisher/ContentReplacerTest.php +++ b/tests/system/Publisher/ContentReplacerTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Publisher; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ContentReplacerTest extends CIUnitTestCase { public function testReplace(): void diff --git a/tests/system/Publisher/PublisherContentReplaceTest.php b/tests/system/Publisher/PublisherContentReplaceTest.php index 4549ed662d5b..7c873602b1a5 100644 --- a/tests/system/Publisher/PublisherContentReplaceTest.php +++ b/tests/system/Publisher/PublisherContentReplaceTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Publisher; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PublisherContentReplaceTest extends CIUnitTestCase { private string $file; diff --git a/tests/system/Publisher/PublisherInputTest.php b/tests/system/Publisher/PublisherInputTest.php index d3fcc9fe436b..481ecb5403a2 100644 --- a/tests/system/Publisher/PublisherInputTest.php +++ b/tests/system/Publisher/PublisherInputTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Publisher; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PublisherInputTest extends CIUnitTestCase { /** diff --git a/tests/system/Publisher/PublisherOutputTest.php b/tests/system/Publisher/PublisherOutputTest.php index 6c4670c282ec..b79144006592 100644 --- a/tests/system/Publisher/PublisherOutputTest.php +++ b/tests/system/Publisher/PublisherOutputTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Publisher; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PublisherOutputTest extends CIUnitTestCase { /** diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index 952c3c4608ca..0f67e5e0056c 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Publisher; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Publisher\Exceptions\PublisherException; use CodeIgniter\Test\CIUnitTestCase; @@ -24,7 +26,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PublisherRestrictionsTest extends CIUnitTestCase { /** @@ -47,7 +49,7 @@ public function testImmutableRestrictions(): void $this->assertArrayNotHasKey(SUPPORTPATH, $restrictions); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideDefaultPublicRestrictions')] + #[DataProvider('provideDefaultPublicRestrictions')] public function testDefaultPublicRestrictions(string $path): void { $publisher = new Publisher(ROOTPATH, FCPATH); @@ -77,7 +79,7 @@ public static function provideDefaultPublicRestrictions(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideDestinations')] + #[DataProvider('provideDestinations')] public function testDestinations(string $destination, bool $allowed): void { config('Publisher')->restrictions = [ diff --git a/tests/system/Publisher/PublisherSupportTest.php b/tests/system/Publisher/PublisherSupportTest.php index 2dd26c2c7a9f..079e14a30692 100644 --- a/tests/system/Publisher/PublisherSupportTest.php +++ b/tests/system/Publisher/PublisherSupportTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Publisher; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Publisher\Exceptions\PublisherException; use CodeIgniter\Test\CIUnitTestCase; use Tests\Support\Publishers\TestPublisher; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class PublisherSupportTest extends CIUnitTestCase { /** diff --git a/tests/system/RESTful/ResourceControllerTest.php b/tests/system/RESTful/ResourceControllerTest.php index 22fd3a0e10f8..717884a83250 100644 --- a/tests/system/RESTful/ResourceControllerTest.php +++ b/tests/system/RESTful/ResourceControllerTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\RESTful; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CodeIgniter; use CodeIgniter\Config\Services; use CodeIgniter\Format\JSONFormatter; @@ -39,9 +42,9 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] -#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[RunTestsInSeparateProcesses] +#[PreserveGlobalState(false)] +#[Group('SeparateProcess')] final class ResourceControllerTest extends CIUnitTestCase { private CodeIgniter $codeigniter; diff --git a/tests/system/RESTful/ResourcePresenterTest.php b/tests/system/RESTful/ResourcePresenterTest.php index f2d37b1c9ce9..389f54ef38f6 100644 --- a/tests/system/RESTful/ResourcePresenterTest.php +++ b/tests/system/RESTful/ResourcePresenterTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\RESTful; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CodeIgniter; use CodeIgniter\Config\Services; use CodeIgniter\Model; @@ -33,9 +36,9 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] -#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[RunTestsInSeparateProcesses] +#[PreserveGlobalState(false)] +#[Group('SeparateProcess')] final class ResourcePresenterTest extends CIUnitTestCase { private CodeIgniter $codeigniter; diff --git a/tests/system/Router/AutoRouterImprovedTest.php b/tests/system/Router/AutoRouterImprovedTest.php index f476cb2aa27b..9b438d821809 100644 --- a/tests/system/Router/AutoRouterImprovedTest.php +++ b/tests/system/Router/AutoRouterImprovedTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Router; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\Exceptions\PageNotFoundException; @@ -29,7 +31,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class AutoRouterImprovedTest extends CIUnitTestCase { private RouteCollection $collection; @@ -457,7 +459,7 @@ public function testDoesNotTranslateDashInParam(): void $this->assertSame(['a-b'], $params); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideTranslateUriToCamelCase')] + #[DataProvider('provideTranslateUriToCamelCase')] public function testTranslateUriToCamelCase( string $uri, ?string $expDirectory, @@ -529,7 +531,7 @@ public static function provideTranslateUriToCamelCase(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRejectTranslateUriToCamelCase')] + #[DataProvider('provideRejectTranslateUriToCamelCase')] public function testRejectTranslateUriToCamelCase(string $uri, string $expMsg): void { $this->expectException(PageNotFoundException::class); diff --git a/tests/system/Router/DefinedRouteCollectorTest.php b/tests/system/Router/DefinedRouteCollectorTest.php index 8707a6bceafd..351b02437696 100644 --- a/tests/system/Router/DefinedRouteCollectorTest.php +++ b/tests/system/Router/DefinedRouteCollectorTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Router; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\Method; use CodeIgniter\Test\CIUnitTestCase; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DefinedRouteCollectorTest extends CIUnitTestCase { private function createRouteCollection(array $config = [], $moduleConfig = null): RouteCollection diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index 701d79f7bdc1..34be8aea84d0 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Router; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\Method; use CodeIgniter\Router\Exceptions\RouterException; @@ -23,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class RouteCollectionReverseRouteTest extends CIUnitTestCase { protected function setUp(): void @@ -142,7 +144,7 @@ public static function provideReverseRoutingDefaultNamespaceAppController(): ite ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideReverseRoutingDefaultNamespaceAppController')] + #[DataProvider('provideReverseRoutingDefaultNamespaceAppController')] public function testReverseRoutingDefaultNamespaceAppController(string $controller): void { $routes = $this->getCollector(); diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index 0911b486d7a1..420ac9f607ea 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Router; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use App\Controllers\Product; use CodeIgniter\Config\Services; use CodeIgniter\controller; @@ -26,7 +28,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class RouteCollectionTest extends CIUnitTestCase { protected function setUp(): void @@ -484,7 +486,7 @@ static function ($routes): void { $this->assertSame($expected, $routes->getRoutes()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideNestedGroupingWorksWithRootPrefix')] + #[DataProvider('provideNestedGroupingWorksWithRootPrefix')] public function testNestedGroupingWorksWithRootPrefix( string $group, string $subgroup, @@ -1320,7 +1322,7 @@ static function (): void {}, $this->assertSame($options, ['as' => 'admin', 'foo' => 'baz']); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRoutesOptionsWithSameFromTwoRoutes')] + #[DataProvider('provideRoutesOptionsWithSameFromTwoRoutes')] public function testRoutesOptionsWithSameFromTwoRoutes(array $options1, array $options2): void { $routes = $this->getCollector(); @@ -1769,7 +1771,7 @@ public static function provideRouteDefaultNamespace(): iterable /** * @param mixed $namespace */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideRouteDefaultNamespace')] + #[DataProvider('provideRouteDefaultNamespace')] public function testAutoRoutesControllerNameReturnsFQCN($namespace): void { $routes = $this->getCollector(); @@ -1789,7 +1791,7 @@ public function testAutoRoutesControllerNameReturnsFQCN($namespace): void /** * @param mixed $namespace */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideRouteDefaultNamespace')] + #[DataProvider('provideRouteDefaultNamespace')] public function testRoutesControllerNameReturnsFQCN($namespace): void { Services::request()->setMethod(Method::GET); diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index 09f710978d42..a2fc16dbd1d5 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Router; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\Exceptions\PageNotFoundException; @@ -30,7 +32,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class RouterTest extends CIUnitTestCase { private RouteCollection $collection; @@ -912,7 +914,7 @@ public function testSetDirectoryInvalid(): void $this->assertSame('', $router->directory()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRedirectRoute')] + #[DataProvider('provideRedirectRoute')] public function testRedirectRoute( string $route, string $redirectFrom, diff --git a/tests/system/Security/CheckPhpIniTest.php b/tests/system/Security/CheckPhpIniTest.php index 08c49c3094fb..38d5ced76a3f 100644 --- a/tests/system/Security/CheckPhpIniTest.php +++ b/tests/system/Security/CheckPhpIniTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Security; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockInputOutput; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CheckPhpIniTest extends CIUnitTestCase { public function testCheckIni(): void diff --git a/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php b/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php index dd4cd16847aa..796b8f5ec22c 100644 --- a/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php +++ b/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Security; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Cookie; use CodeIgniter\HTTP\IncomingRequest; @@ -26,7 +27,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SecurityCSRFCookieRandomizeTokenTest extends CIUnitTestCase { /** diff --git a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php index 3d6386d70036..bce3d3735063 100644 --- a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php +++ b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Security; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -37,9 +40,9 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] -#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[RunTestsInSeparateProcesses] +#[PreserveGlobalState(false)] +#[Group('SeparateProcess')] final class SecurityCSRFSessionRandomizeTokenTest extends CIUnitTestCase { /** diff --git a/tests/system/Security/SecurityCSRFSessionTest.php b/tests/system/Security/SecurityCSRFSessionTest.php index 90bb0e49c014..ee553b6db73a 100644 --- a/tests/system/Security/SecurityCSRFSessionTest.php +++ b/tests/system/Security/SecurityCSRFSessionTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Security; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -35,9 +38,9 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] -#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[RunTestsInSeparateProcesses] +#[PreserveGlobalState(false)] +#[Group('SeparateProcess')] final class SecurityCSRFSessionTest extends CIUnitTestCase { /** diff --git a/tests/system/Security/SecurityTest.php b/tests/system/Security/SecurityTest.php index d449e6b2dec4..bce6c47824d0 100644 --- a/tests/system/Security/SecurityTest.php +++ b/tests/system/Security/SecurityTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Security; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Request; @@ -28,8 +30,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\BackupGlobals(true)] -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[BackupGlobals(true)] +#[Group('Others')] final class SecurityTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php index f239402acc08..165bab9088f8 100644 --- a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php +++ b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Session\Handlers\Database; +use PHPUnit\Framework\Attributes\Group; use Config\Database as DatabaseConfig; use Config\Session as SessionConfig; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class MySQLiHandlerTest extends AbstractHandlerTestCase { protected function setUp(): void diff --git a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php index 58dd19ab50e8..69f052b5a59c 100644 --- a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php +++ b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Session\Handlers\Database; +use PHPUnit\Framework\Attributes\Group; use Config\Database as DatabaseConfig; use Config\Session as SessionConfig; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class PostgreHandlerTest extends AbstractHandlerTestCase { protected function setUp(): void diff --git a/tests/system/Session/Handlers/Database/RedisHandlerTest.php b/tests/system/Session/Handlers/Database/RedisHandlerTest.php index aa03d39e6c7f..eba8152ee587 100644 --- a/tests/system/Session/Handlers/Database/RedisHandlerTest.php +++ b/tests/system/Session/Handlers/Database/RedisHandlerTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Session\Handlers\Database; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Session\Handlers\RedisHandler; use CodeIgniter\Test\CIUnitTestCase; use Config\Session as SessionConfig; @@ -20,8 +23,8 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] -#[\PHPUnit\Framework\Attributes\RequiresPhpExtension('redis')] +#[Group('DatabaseLive')] +#[RequiresPhpExtension('redis')] final class RedisHandlerTest extends CIUnitTestCase { private string $sessionDriver = RedisHandler::class; @@ -134,7 +137,7 @@ public function testSecondaryReadAfterClose(): void $handler->close(); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideSetSavePath')] + #[DataProvider('provideSetSavePath')] public function testSetSavePath(string $savePath, array $expected): void { $option = ['savePath' => $savePath]; diff --git a/tests/system/Session/SessionTest.php b/tests/system/Session/SessionTest.php index 26b4a02558e4..40afe2dc789d 100644 --- a/tests/system/Session/SessionTest.php +++ b/tests/system/Session/SessionTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Session; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\Session\Handlers\FileHandler; @@ -26,9 +29,9 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] -#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[RunTestsInSeparateProcesses] +#[PreserveGlobalState(false)] +#[Group('SeparateProcess')] final class SessionTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/SparkTest.php b/tests/system/SparkTest.php index 66f8a3dc3809..ab70dc4e3aff 100644 --- a/tests/system/SparkTest.php +++ b/tests/system/SparkTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SparkTest extends CIUnitTestCase { public function testCanUseOption(): void diff --git a/tests/system/SuperglobalsTest.php b/tests/system/SuperglobalsTest.php index fa61bc8f30f8..272f502a8ada 100644 --- a/tests/system/SuperglobalsTest.php +++ b/tests/system/SuperglobalsTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class SuperglobalsTest extends CIUnitTestCase { public function testSetGet(): void diff --git a/tests/system/Test/BootstrapFCPATHTest.php b/tests/system/Test/BootstrapFCPATHTest.php index 7f664b5bb183..a48c20a89515 100644 --- a/tests/system/Test/BootstrapFCPATHTest.php +++ b/tests/system/Test/BootstrapFCPATHTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; /** * Class BootstrapFCPATHTest * @@ -25,7 +26,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class BootstrapFCPATHTest extends CIUnitTestCase { private string $currentDir = __DIR__; diff --git a/tests/system/Test/ControllerTestTraitTest.php b/tests/system/Test/ControllerTestTraitTest.php index b5f2bdd516be..600359cc8112 100644 --- a/tests/system/Test/ControllerTestTraitTest.php +++ b/tests/system/Test/ControllerTestTraitTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\Group; use App\Controllers\Home; use App\Controllers\NeverHeardOfIt; use CodeIgniter\Controller; @@ -29,9 +32,9 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] -#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[RunTestsInSeparateProcesses] +#[PreserveGlobalState(false)] +#[Group('SeparateProcess')] final class ControllerTestTraitTest extends CIUnitTestCase { use ControllerTestTrait; diff --git a/tests/system/Test/DOMParserTest.php b/tests/system/Test/DOMParserTest.php index 1d086db48c37..0477fc0561fb 100644 --- a/tests/system/Test/DOMParserTest.php +++ b/tests/system/Test/DOMParserTest.php @@ -13,10 +13,12 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DOMParserTest extends CIUnitTestCase { protected function setUp(): void @@ -92,7 +94,7 @@ public static function provideText(): iterable /** * @param string $text */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideText')] + #[DataProvider('provideText')] public function testSeeText($text): void { $dom = new DOMParser(); @@ -139,7 +141,7 @@ public function testSeeFail(): void /** * @param string $text */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideText')] + #[DataProvider('provideText')] public function testSeeElement($text): void { $dom = new DOMParser(); diff --git a/tests/system/Test/FabricatorTest.php b/tests/system/Test/FabricatorTest.php index 236b6ab126a8..39243804a47c 100644 --- a/tests/system/Test/FabricatorTest.php +++ b/tests/system/Test/FabricatorTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Model; use Tests\Support\Models\EntityModel; @@ -24,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FabricatorTest extends CIUnitTestCase { /** diff --git a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php index 9b1f451c6565..1ad1be055569 100644 --- a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php +++ b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Events\Events; use Config\Feature; use Config\Services; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FeatureTestAutoRoutingImprovedTest extends CIUnitTestCase { use FeatureTestTrait; diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index b259448f2e90..e7c658eda821 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Events\Events; use CodeIgniter\Exceptions\PageNotFoundException; @@ -26,7 +28,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class FeatureTestTraitTest extends CIUnitTestCase { use FeatureTestTrait; @@ -362,7 +364,7 @@ public static function provideOpenCliRoutesFromHttpGot404(): iterable * @param mixed $to * @param mixed $httpGet */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideOpenCliRoutesFromHttpGot404')] + #[DataProvider('provideOpenCliRoutesFromHttpGot404')] public function testOpenCliRoutesFromHttpGot404($from, $to, $httpGet): void { $this->expectException(PageNotFoundException::class); diff --git a/tests/system/Test/FilterTestTraitTest.php b/tests/system/Test/FilterTestTraitTest.php index e8ed466e6dff..7b8f123b9109 100644 --- a/tests/system/Test/FilterTestTraitTest.php +++ b/tests/system/Test/FilterTestTraitTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\RequestInterface; use Config\Services; use Tests\Support\Filters\Customfilter; @@ -28,7 +29,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FilterTestTraitTest extends CIUnitTestCase { use FilterTestTrait; diff --git a/tests/system/Test/IniTestTraitTest.php b/tests/system/Test/IniTestTraitTest.php index 70c78f2f1c79..1e958493937f 100644 --- a/tests/system/Test/IniTestTraitTest.php +++ b/tests/system/Test/IniTestTraitTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; use ReflectionException; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class IniTestTraitTest extends CIUnitTestCase { use IniTestTrait; diff --git a/tests/system/Test/ReflectionHelperTest.php b/tests/system/Test/ReflectionHelperTest.php index caa7aa41fe1e..59afc3411f61 100644 --- a/tests/system/Test/ReflectionHelperTest.php +++ b/tests/system/Test/ReflectionHelperTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Test\TestForReflectionHelper; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ReflectionHelperTest extends CIUnitTestCase { public function testGetPrivatePropertyWithObject(): void diff --git a/tests/system/Test/TestCaseEmissionsTest.php b/tests/system/Test/TestCaseEmissionsTest.php index 22c2844f29ca..40559aeef3fb 100644 --- a/tests/system/Test/TestCaseEmissionsTest.php +++ b/tests/system/Test/TestCaseEmissionsTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\HTTP\Response; use Config\App; @@ -24,7 +27,7 @@ * * @internal */ -#[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] +#[Group('SeparateProcess')] final class TestCaseEmissionsTest extends CIUnitTestCase { /** @@ -40,8 +43,8 @@ final class TestCaseEmissionsTest extends CIUnitTestCase * The tests includes a basic sanity check, to make sure that * the body we thought would be sent actually was. */ - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testHeadersEmitted(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -70,8 +73,8 @@ public function testHeadersEmitted(): void $this->assertHeaderEmitted('set-cookie: FOO=bar', true); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] public function testHeadersNotEmitted(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/Test/TestCaseTest.php b/tests/system/Test/TestCaseTest.php index f939b055ac20..c64867f9da03 100644 --- a/tests/system/Test/TestCaseTest.php +++ b/tests/system/Test/TestCaseTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Events\Events; use Tests\Support\Test\TestForReflectionHelper; @@ -20,7 +21,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TestCaseTest extends CIUnitTestCase { use StreamFilterTrait; diff --git a/tests/system/Test/TestLoggerTest.php b/tests/system/Test/TestLoggerTest.php index 5ea2003942d3..d4b95bbfe02b 100644 --- a/tests/system/Test/TestLoggerTest.php +++ b/tests/system/Test/TestLoggerTest.php @@ -13,15 +13,17 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use Config\Logger; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TestLoggerTest extends CIUnitTestCase { - #[\PHPUnit\Framework\Attributes\DataProvider('provideDidLogMethod')] + #[DataProvider('provideDidLogMethod')] public function testDidLogMethod(bool $expected, string $level, string $message, bool $exact): void { (new TestLogger(new Logger()))->log('error', 'Some variable did not contain a value.'); diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 6794d222d68d..2145d174cd5a 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Test; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\Response; use Config\App; @@ -22,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TestResponseTest extends CIUnitTestCase { private ?TestResponse $testResponse = null; @@ -33,7 +35,7 @@ protected function setUp(): void parent::setUp(); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideHttpStatusCodes')] + #[DataProvider('provideHttpStatusCodes')] public function testIsOK(int $code, bool $isOk): void { $this->getTestResponse('Hello World'); @@ -221,7 +223,7 @@ public function testAssertStatus(): void $this->testResponse->assertStatus(201); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideHttpStatusCodes')] + #[DataProvider('provideHttpStatusCodes')] public function testAssertIsOK(int $code, bool $isOk): void { $this->getTestResponse('

Hello World

', ['statusCode' => $code]); diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 0b8bfdb726b5..0d0b5d219dea 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Throttle; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Cache\CacheInterface; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockCache; @@ -20,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ThrottleTest extends CIUnitTestCase { private CacheInterface $cache; @@ -189,7 +191,7 @@ public function testFlooding(): void $this->assertEqualsWithDelta(10.0, round($this->cache->get('throttler_127.0.0.1')), PHP_FLOAT_EPSILON); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideTokenTimeCalculationUCs')] + #[DataProvider('provideTokenTimeCalculationUCs')] public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $checkInputs): void { $key = 'testkey'; diff --git a/tests/system/Typography/TypographyTest.php b/tests/system/Typography/TypographyTest.php index 9774c6f19b61..399f1d96dd9a 100644 --- a/tests/system/Typography/TypographyTest.php +++ b/tests/system/Typography/TypographyTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Typography; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TypographyTest extends CIUnitTestCase { private Typography $typography; diff --git a/tests/system/Validation/CreditCardRulesTest.php b/tests/system/Validation/CreditCardRulesTest.php index 496a5e3c835e..9b587374eaf9 100644 --- a/tests/system/Validation/CreditCardRulesTest.php +++ b/tests/system/Validation/CreditCardRulesTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Validation; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; use Tests\Support\Validation\TestRules; @@ -20,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CreditCardRulesTest extends CIUnitTestCase { private Validation $validation; @@ -49,7 +51,7 @@ protected function setUp(): void $this->validation->reset(); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidCCNumber')] + #[DataProvider('provideValidCCNumber')] public function testValidCCNumber(string $type, ?string $number, bool $expected): void { $data = ['cc' => $number]; diff --git a/tests/system/Validation/DatabaseRelatedRulesTest.php b/tests/system/Validation/DatabaseRelatedRulesTest.php index af811eddb4bc..d9656b02d777 100644 --- a/tests/system/Validation/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/DatabaseRelatedRulesTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Validation; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Validation\StrictRules\DatabaseRelatedRulesTest as StrictDatabaseRelatedRulesTest; use Tests\Support\Validation\TestRules; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] final class DatabaseRelatedRulesTest extends StrictDatabaseRelatedRulesTest { protected array $config = [ diff --git a/tests/system/Validation/DotArrayFilterTest.php b/tests/system/Validation/DotArrayFilterTest.php index c1b2ac7fc523..6db223279f6e 100644 --- a/tests/system/Validation/DotArrayFilterTest.php +++ b/tests/system/Validation/DotArrayFilterTest.php @@ -13,12 +13,13 @@ namespace CodeIgniter\Validation; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DotArrayFilterTest extends CIUnitTestCase { public function testRunReturnEmptyArray(): void diff --git a/tests/system/Validation/FileRulesTest.php b/tests/system/Validation/FileRulesTest.php index 8083d95939e1..7bd681a3b074 100644 --- a/tests/system/Validation/FileRulesTest.php +++ b/tests/system/Validation/FileRulesTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Validation; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; use InvalidArgumentException; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileRulesTest extends CIUnitTestCase { private Validation $validation; diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index 62c8ce257b31..827d74f2e09a 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Validation; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; use Generator; @@ -23,7 +25,7 @@ * * @no-final */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] class FormatRulesTest extends CIUnitTestCase { public const ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHLIJKLMNOPQRSTUVWXYZ'; @@ -85,7 +87,7 @@ public function testRegexMatchFalse(): void $this->assertFalse($this->validation->run($data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidUrl')] + #[DataProvider('provideValidUrl')] public function testValidURL(?string $url, bool $isLoose, bool $isStrict): void { $data = [ @@ -99,7 +101,7 @@ public function testValidURL(?string $url, bool $isLoose, bool $isStrict): void $this->assertSame($isLoose, $this->validation->run($data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidUrl')] + #[DataProvider('provideValidUrl')] public function testValidURLStrict(?string $url, bool $isLoose, bool $isStrict): void { $data = [ @@ -225,7 +227,7 @@ public static function provideValidUrl(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidEmail')] + #[DataProvider('provideValidEmail')] public function testValidEmail(?string $email, bool $expected): void { $data = [ @@ -239,7 +241,7 @@ public function testValidEmail(?string $email, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidEmails')] + #[DataProvider('provideValidEmails')] public function testValidEmails(?string $email, bool $expected): void { $data = [ @@ -301,7 +303,7 @@ public static function provideValidEmails(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidIP')] + #[DataProvider('provideValidIP')] public function testValidIP(?string $ip, ?string $which, bool $expected): void { $data = [ @@ -369,7 +371,7 @@ public static function provideValidIP(): iterable /** * @param int|string $str */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideString')] + #[DataProvider('provideString')] public function testString($str, bool $expected): void { $data = [ @@ -401,7 +403,7 @@ public static function provideString(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideAlpha')] + #[DataProvider('provideAlpha')] public function testAlpha(?string $str, bool $expected): void { $data = [ @@ -441,7 +443,7 @@ public static function provideAlpha(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideAlphaSpace')] + #[DataProvider('provideAlphaSpace')] public function testAlphaSpace(?string $value, bool $expected): void { $data = [ @@ -485,7 +487,7 @@ public static function provideAlphaSpace(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('alphaNumericProvider')] + #[DataProvider('alphaNumericProvider')] public function testAlphaNumeric(?string $str, bool $expected): void { $data = [ @@ -521,7 +523,7 @@ public static function alphaNumericProvider(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideAlphaNumericPunct')] + #[DataProvider('provideAlphaNumericPunct')] public function testAlphaNumericPunct(?string $str, bool $expected): void { $data = [ @@ -613,7 +615,7 @@ public static function provideAlphaNumericPunct(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('alphaNumericProvider')] + #[DataProvider('alphaNumericProvider')] public function testAlphaNumericSpace(?string $str, bool $expected): void { $data = [ @@ -649,7 +651,7 @@ public function alphaNumericSpaceProvider(): Generator ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideAlphaDash')] + #[DataProvider('provideAlphaDash')] public function testAlphaDash(?string $str, bool $expected): void { $data = [ @@ -685,7 +687,7 @@ public static function provideAlphaDash(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideHex')] + #[DataProvider('provideHex')] public function testHex(?string $str, bool $expected): void { $data = [ @@ -721,7 +723,7 @@ public static function provideHex(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideNumeric')] + #[DataProvider('provideNumeric')] public function testNumeric(?string $str, bool $expected): void { $data = [ @@ -778,7 +780,7 @@ public static function provideNumeric(): iterable * * @param mixed $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideInvalidIntegerType')] + #[DataProvider('provideInvalidIntegerType')] public function testIntegerWithInvalidTypeData($value, bool $expected): void { $this->validation->setRules([ @@ -796,7 +798,7 @@ public function testIntegerWithInvalidTypeData($value, bool $expected): void * * @param mixed $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideInvalidIntegerType')] + #[DataProvider('provideInvalidIntegerType')] public function testNumericWithInvalidTypeData($value, bool $expected): void { $this->validation->setRules([ @@ -839,7 +841,7 @@ public static function provideInvalidIntegerType(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideInteger')] + #[DataProvider('provideInteger')] public function testInteger(?string $str, bool $expected): void { $data = [ @@ -891,7 +893,7 @@ public static function provideInteger(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideDecimal')] + #[DataProvider('provideDecimal')] public function testDecimal(?string $str, bool $expected): void { $data = [ @@ -947,7 +949,7 @@ public static function provideDecimal(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideNatural')] + #[DataProvider('provideNatural')] public function testNatural(?string $str, bool $expected): void { $data = [ @@ -987,7 +989,7 @@ public static function provideNatural(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideNaturalNoZero')] + #[DataProvider('provideNaturalNoZero')] public function testNaturalNoZero(?string $str, bool $expected): void { $data = [ @@ -1027,7 +1029,7 @@ public static function provideNaturalNoZero(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideBase64')] + #[DataProvider('provideBase64')] public function testBase64(?string $str, bool $expected): void { $data = [ @@ -1059,7 +1061,7 @@ public static function provideBase64(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideJson')] + #[DataProvider('provideJson')] public function testJson(?string $str, bool $expected): void { $data = [ @@ -1115,7 +1117,7 @@ public static function provideJson(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideTimeZone')] + #[DataProvider('provideTimeZone')] public function testTimeZone(?string $str, bool $expected): void { $data = [ @@ -1151,7 +1153,7 @@ public static function provideTimeZone(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidDate')] + #[DataProvider('provideValidDate')] public function testValidDate(?string $str, ?string $format, bool $expected): void { $data = [ diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 6ea38beea074..3737bf7216d1 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Validation; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; use stdClass; @@ -23,7 +25,7 @@ * * @no-final */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] class RulesTest extends CIUnitTestCase { protected Validation $validation; @@ -53,7 +55,7 @@ protected function setUp(): void $this->validation->reset(); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRequired')] + #[DataProvider('provideRequired')] public function testRequired(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'required']); @@ -73,7 +75,7 @@ public static function provideRequired(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideIfExist')] + #[DataProvider('provideIfExist')] public function testIfExist(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); @@ -124,7 +126,7 @@ public static function provideIfExist(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('providePermitEmpty')] + #[DataProvider('providePermitEmpty')] public function testPermitEmpty(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); @@ -291,7 +293,7 @@ public static function providePermitEmpty(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideMatches')] + #[DataProvider('provideMatches')] public function testMatches(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'matches[bar]']); @@ -313,7 +315,7 @@ public static function provideMatches(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideMatchesNestedCases')] + #[DataProvider('provideMatchesNestedCases')] public function testMatchesNested(array $data, bool $expected): void { $this->validation->setRules(['nested.foo' => 'matches[nested.bar]']); @@ -328,7 +330,7 @@ public static function provideMatchesNestedCases(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideDiffers')] + #[DataProvider('provideDiffers')] public function testDiffers(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'differs[bar]']); @@ -350,14 +352,14 @@ public static function provideDiffers(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideMatchesNestedCases')] + #[DataProvider('provideMatchesNestedCases')] public function testDiffersNested(array $data, bool $expected): void { $this->validation->setRules(['nested.foo' => 'differs[nested.bar]']); $this->assertSame(! $expected, $this->validation->run($data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideEquals')] + #[DataProvider('provideEquals')] public function testEquals(array $data, string $param, bool $expected): void { $this->validation->setRules(['foo' => "equals[{$param}]"]); @@ -375,7 +377,7 @@ public static function provideEquals(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideMinLengthCases')] + #[DataProvider('provideMinLengthCases')] public function testMinLength(?string $data, string $length, bool $expected): void { $this->validation->setRules(['foo' => "min_length[{$length}]"]); @@ -392,7 +394,7 @@ public static function provideMinLengthCases(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideMinLengthCases')] + #[DataProvider('provideMinLengthCases')] public function testMaxLength(?string $data, string $length, bool $expected): void { $this->validation->setRules(['foo' => "max_length[{$length}]"]); @@ -408,7 +410,7 @@ public function testMaxLengthReturnsFalseWithNonNumericVal(): void /** * @param int|string|null $data */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideExactLength')] + #[DataProvider('provideExactLength')] public function testExactLength($data, bool $expected): void { $this->validation->setRules(['foo' => 'exact_length[3]']); @@ -435,7 +437,7 @@ public function testExactLengthDetectsBadLength(): void $this->assertFalse($this->validation->run($data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThan')] + #[DataProvider('provideGreaterThan')] public function testGreaterThan(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -458,7 +460,7 @@ public static function provideGreaterThan(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThanEqual')] + #[DataProvider('provideGreaterThanEqual')] public function testGreaterThanEqual(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -482,7 +484,7 @@ public static function provideGreaterThanEqual(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideLessThan')] + #[DataProvider('provideLessThan')] public function testLessThan(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -506,7 +508,7 @@ public static function provideLessThan(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideLessThanEqual')] + #[DataProvider('provideLessThanEqual')] public function testLessThanEqual(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -530,7 +532,7 @@ public static function provideLessThanEqual(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideInList')] + #[DataProvider('provideInList')] public function testInList(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -538,7 +540,7 @@ public function testInList(?string $first, ?string $second, bool $expected): voi $this->assertSame($expected, $this->validation->run($data)); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideInList')] + #[DataProvider('provideInList')] public function testNotInList(?string $first, ?string $second, bool $expected): void { $data = ['foo' => $first]; @@ -561,7 +563,7 @@ public static function provideInList(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWith')] + #[DataProvider('provideRequiredWith')] public function testRequiredWith(?string $field, ?string $check, bool $expected): void { $data = [ @@ -615,7 +617,7 @@ public static function provideRequiredWith(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/7557 */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithAndOtherRules')] + #[DataProvider('provideRequiredWithAndOtherRules')] public function testRequiredWithAndOtherRules(bool $expected, array $data): void { $this->validation->setRules([ @@ -649,7 +651,7 @@ public static function provideRequiredWithAndOtherRules(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithAndOtherRuleWithValueZero')] + #[DataProvider('provideRequiredWithAndOtherRuleWithValueZero')] public function testRequiredWithAndOtherRuleWithValueZero(bool $expected, array $data): void { $this->validation->setRules([ @@ -671,7 +673,7 @@ public static function provideRequiredWithAndOtherRuleWithValueZero(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithout')] + #[DataProvider('provideRequiredWithout')] public function testRequiredWithout(?string $field, ?string $check, bool $expected): void { $data = [ @@ -721,7 +723,7 @@ public static function provideRequiredWithout(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithoutMultiple')] + #[DataProvider('provideRequiredWithoutMultiple')] public function testRequiredWithoutMultiple(string $foo, string $bar, string $baz, bool $result): void { $this->validation->setRules(['foo' => 'required_without[bar,baz]']); @@ -770,7 +772,7 @@ public static function provideRequiredWithoutMultiple(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRequiredWithoutMultipleWithoutFields')] + #[DataProvider('provideRequiredWithoutMultipleWithoutFields')] public function testRequiredWithoutMultipleWithoutFields(array $data, bool $result): void { $this->validation->setRules(['foo' => 'required_without[bar,baz]']); @@ -810,7 +812,7 @@ public static function provideRequiredWithoutMultipleWithoutFields(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideFieldExists')] + #[DataProvider('provideFieldExists')] public function testFieldExists(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index 8903ab073c5b..867eefdf8aba 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Validation\StrictRules; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; @@ -21,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CreditCardRulesTest extends CIUnitTestCase { private Validation $validation; @@ -50,7 +52,7 @@ protected function setUp(): void $this->validation->reset(); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidCCNumber')] + #[DataProvider('provideValidCCNumber')] public function testValidCCNumber(string $type, ?string $number, bool $expected): void { $data = ['cc' => $number]; diff --git a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php index 208d0cb3f79e..556c40bf656c 100644 --- a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Validation\StrictRules; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use CodeIgniter\Validation\Validation; @@ -27,7 +28,7 @@ * * @no-final */ -#[\PHPUnit\Framework\Attributes\Group('DatabaseLive')] +#[Group('DatabaseLive')] class DatabaseRelatedRulesTest extends CIUnitTestCase { use DatabaseTestTrait; diff --git a/tests/system/Validation/StrictRules/FileRulesTest.php b/tests/system/Validation/StrictRules/FileRulesTest.php index 9a8a9f68c010..f09e1416817f 100644 --- a/tests/system/Validation/StrictRules/FileRulesTest.php +++ b/tests/system/Validation/StrictRules/FileRulesTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Validation\StrictRules; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; @@ -22,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FileRulesTest extends CIUnitTestCase { private Validation $validation; diff --git a/tests/system/Validation/StrictRules/FormatRulesTest.php b/tests/system/Validation/StrictRules/FormatRulesTest.php index 8b08a4d300bd..1da8403017ea 100644 --- a/tests/system/Validation/StrictRules/FormatRulesTest.php +++ b/tests/system/Validation/StrictRules/FormatRulesTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Validation\StrictRules; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Validation\FormatRulesTest as TraditionalFormatRulesTest; use Tests\Support\Validation\TestRules; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class FormatRulesTest extends TraditionalFormatRulesTest { protected array $config = [ diff --git a/tests/system/Validation/StrictRules/RulesTest.php b/tests/system/Validation/StrictRules/RulesTest.php index 5db01491bde3..0145459265ca 100644 --- a/tests/system/Validation/StrictRules/RulesTest.php +++ b/tests/system/Validation/StrictRules/RulesTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Validation\StrictRules; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Validation\RulesTest as TraditionalRulesTest; use CodeIgniter\Validation\Validation; use Tests\Support\Validation\TestRules; @@ -20,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class RulesTest extends TraditionalRulesTest { protected Validation $validation; @@ -42,7 +44,7 @@ final class RulesTest extends TraditionalRulesTest ], ]; - #[\PHPUnit\Framework\Attributes\DataProvider('providePermitEmptyStrict')] + #[DataProvider('providePermitEmptyStrict')] public function testPermitEmptyStrict(array $rules, array $data, bool $expected): void { $this->validation->setRules($rules); @@ -99,7 +101,7 @@ public static function providePermitEmptyStrict(): iterable /** * @param int $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThanEqualStrict')] + #[DataProvider('provideGreaterThanEqualStrict')] public function testGreaterThanEqualStrict($value, string $param, bool $expected): void { $this->validation->setRules(['foo' => "greater_than_equal_to[{$param}]"]); @@ -124,7 +126,7 @@ public static function provideGreaterThanEqualStrict(): iterable /** * @param int $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideGreaterThanStrict')] + #[DataProvider('provideGreaterThanStrict')] public function testGreaterThanStrict($value, string $param, bool $expected): void { $this->validation->setRules(['foo' => "greater_than[{$param}]"]); @@ -150,7 +152,7 @@ public static function provideGreaterThanStrict(): iterable /** * @param int $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideLessThanStrict')] + #[DataProvider('provideLessThanStrict')] public function testLessThanStrict($value, string $param, bool $expected): void { $this->validation->setRules(['foo' => "less_than[{$param}]"]); @@ -177,7 +179,7 @@ public static function provideLessThanStrict(): iterable /** * @param int $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideLessEqualThanStrict')] + #[DataProvider('provideLessEqualThanStrict')] public function testLessEqualThanStrict($value, ?string $param, bool $expected): void { $this->validation->setRules(['foo' => "less_than_equal_to[{$param}]"]); @@ -199,7 +201,7 @@ public static function provideLessEqualThanStrict(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideMatches')] + #[DataProvider('provideMatches')] public function testMatches(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'matches[bar]']); @@ -221,7 +223,7 @@ public static function provideMatches(): iterable ]; } - #[\PHPUnit\Framework\Attributes\DataProvider('provideDiffers')] + #[DataProvider('provideDiffers')] public function testDiffers(array $data, bool $expected): void { $this->validation->setRules(['foo' => 'differs[bar]']); diff --git a/tests/system/Validation/StrictRules/ValidationTest.php b/tests/system/Validation/StrictRules/ValidationTest.php index 82a6944a7931..fd778e748b3d 100644 --- a/tests/system/Validation/StrictRules/ValidationTest.php +++ b/tests/system/Validation/StrictRules/ValidationTest.php @@ -13,13 +13,14 @@ namespace CodeIgniter\Validation\StrictRules; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Validation\ValidationTest as TraditionalValidationTest; use Tests\Support\Validation\TestRules; /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ValidationTest extends TraditionalValidationTest { protected static array $config = [ diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index 861e6b681d6b..9e789edde1bc 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\Validation; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\SiteURI; @@ -31,7 +33,7 @@ * * @no-final */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] class ValidationTest extends CIUnitTestCase { protected Validation $validation; @@ -191,7 +193,7 @@ public function testSetRuleOverwritesRuleReverse(): void /** * @param mixed $rules */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideSetRuleRulesFormat')] + #[DataProvider('provideSetRuleRulesFormat')] public function testSetRuleRulesFormat(bool $expected, $rules): void { if (! $expected) { @@ -445,7 +447,7 @@ public function testCallableRuleWithLabel(): void * * @param mixed $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideCanValidatetArrayData')] + #[DataProvider('provideCanValidatetArrayData')] public function testCanValidatetArrayData($value, bool $expected): void { $data = []; @@ -497,7 +499,7 @@ public static function provideCanValidatetArrayData(): iterable * * @param mixed $value */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideIsIntWithInvalidTypeData')] + #[DataProvider('provideIsIntWithInvalidTypeData')] public function testIsIntWithInvalidTypeData($value, bool $expected): void { $this->validation->setRules(['foo' => 'is_int']); @@ -734,7 +736,7 @@ public function testRunWithCustomErrorsAndAsteriskField(): void * @param list|string $rules * @param string $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideRulesSetup')] + #[DataProvider('provideRulesSetup')] public function testRulesSetup($rules, $expected, array $errors = []): void { $data = ['foo' => '']; @@ -1127,7 +1129,7 @@ public function testRulesForObjectField(): void ], $this->validation->getErrors()); } - #[\PHPUnit\Framework\Attributes\DataProvider('provideRulesForArrayField')] + #[DataProvider('provideRulesForArrayField')] public function testRulesForArrayField(array $body, array $rules, array $results): void { $config = new App(); @@ -1368,7 +1370,7 @@ public function testTranslatedLabelTagReplacement(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/4521 */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideIfExistRuleWithAsterisk')] + #[DataProvider('provideIfExistRuleWithAsterisk')] public function testIfExistRuleWithAsterisk(bool $expected, array $rules, array $data): void { $actual = $this->validation->setRules($rules)->run($data); @@ -1437,7 +1439,7 @@ public static function provideIfExistRuleWithAsterisk(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/4510 */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideValidationOfArrayData')] + #[DataProvider('provideValidationOfArrayData')] public function testValidationOfArrayData(bool $expected, array $rules, array $data): void { $actual = $this->validation->setRules($rules)->run($data); @@ -1492,7 +1494,7 @@ public static function provideValidationOfArrayData(): iterable /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/4929 */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideSplittingOfComplexStringRules')] + #[DataProvider('provideSplittingOfComplexStringRules')] public function testSplittingOfComplexStringRules(string $input, array $expected): void { $splitter = $this->getPrivateMethodInvoker($this->validation, 'splitRules'); diff --git a/tests/system/View/CellTest.php b/tests/system/View/CellTest.php index 145a2303327b..79d561c6a0ae 100644 --- a/tests/system/View/CellTest.php +++ b/tests/system/View/CellTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Response; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockCache; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class CellTest extends CIUnitTestCase { private MockCache $cache; diff --git a/tests/system/View/ControlledCellTest.php b/tests/system/View/ControlledCellTest.php index 542fc733c812..f94aa47b7672 100644 --- a/tests/system/View/ControlledCellTest.php +++ b/tests/system/View/ControlledCellTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\View\Exceptions\ViewException; use LogicException; @@ -30,7 +31,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ControlledCellTest extends CIUnitTestCase { public function testCellRendersDefaultValues(): void diff --git a/tests/system/View/DecoratorsTest.php b/tests/system/View/DecoratorsTest.php index bf8eecfb43ab..2e3faae0dae7 100644 --- a/tests/system/View/DecoratorsTest.php +++ b/tests/system/View/DecoratorsTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; @@ -24,7 +25,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class DecoratorsTest extends CIUnitTestCase { private FileLocator $loader; diff --git a/tests/system/View/ParserFilterTest.php b/tests/system/View/ParserFilterTest.php index 1411eacc83a6..f0270edb1c33 100644 --- a/tests/system/View/ParserFilterTest.php +++ b/tests/system/View/ParserFilterTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; @@ -21,7 +22,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ParserFilterTest extends CIUnitTestCase { private FileLocator $loader; diff --git a/tests/system/View/ParserPluginTest.php b/tests/system/View/ParserPluginTest.php index c24b2bdb3f97..146d05cf2940 100644 --- a/tests/system/View/ParserPluginTest.php +++ b/tests/system/View/ParserPluginTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; @@ -20,7 +23,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ParserPluginTest extends CIUnitTestCase { private Parser $parser; @@ -43,9 +46,9 @@ public function testCurrentURL(): void $this->assertSame(current_url(), $this->parser->renderString($template)); } - #[\PHPUnit\Framework\Attributes\RunInSeparateProcess] - #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] - #[\PHPUnit\Framework\Attributes\Group('SeparateProcess')] + #[RunInSeparateProcess] + #[PreserveGlobalState(false)] + #[Group('SeparateProcess')] public function testPreviousURL(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php index 177377c85dd3..48a9343e5d68 100644 --- a/tests/system/View/ParserTest.php +++ b/tests/system/View/ParserTest.php @@ -13,6 +13,8 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Entity\Entity; use CodeIgniter\Test\CIUnitTestCase; @@ -24,7 +26,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ParserTest extends CIUnitTestCase { private FileLocator $loader; @@ -479,7 +481,7 @@ public static function provideEscHandling(): iterable * @param mixed $value * @param mixed|null $expected */ - #[\PHPUnit\Framework\Attributes\DataProvider('provideEscHandling')] + #[DataProvider('provideEscHandling')] public function testEscHandling($value, $expected = null): void { if ($expected === null) { diff --git a/tests/system/View/TableTest.php b/tests/system/View/TableTest.php index d8582f4d0e0e..d7572760838c 100644 --- a/tests/system/View/TableTest.php +++ b/tests/system/View/TableTest.php @@ -13,6 +13,9 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\MySQLi\Result; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockTable; @@ -21,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class TableTest extends CIUnitTestCase { private Table $table; @@ -57,7 +60,7 @@ public function testSetCaption(): void $this->assertSame('awesome cap', $this->table->caption); } - #[\PHPUnit\Framework\Attributes\Depends('testPrepArgs')] + #[Depends('testPrepArgs')] public function testSetHeading(): void { // uses _prep_args internally, so we'll just do a quick @@ -147,7 +150,7 @@ public function testSetFootingWithStyle(): void ); } - #[\PHPUnit\Framework\Attributes\Depends('testPrepArgs')] + #[Depends('testPrepArgs')] public function testAddRow(): void { // uses _prep_args internally, so we'll just do a quick @@ -778,7 +781,7 @@ public function testInvalidCallback(): void $this->assertStringContainsString('FredBlueSmall', $generated); } - #[\PHPUnit\Framework\Attributes\DataProvider('orderedColumnUsecases')] + #[DataProvider('orderedColumnUsecases')] public function testAddRowAndGenerateOrderedColumns(array $heading, array $row, string $expectContainsString): void { $this->table->setHeading($heading); @@ -790,7 +793,7 @@ public function testAddRowAndGenerateOrderedColumns(array $heading, array $row, $this->assertStringContainsString($expectContainsString, $generated); } - #[\PHPUnit\Framework\Attributes\DataProvider('orderedColumnUsecases')] + #[DataProvider('orderedColumnUsecases')] public function testGenerateOrderedColumns(array $heading, array $row, string $expectContainsString): void { $this->table->setHeading($heading); diff --git a/tests/system/View/ViewTest.php b/tests/system/View/ViewTest.php index 9a51d9b2eab7..a4c5e34af5f4 100644 --- a/tests/system/View/ViewTest.php +++ b/tests/system/View/ViewTest.php @@ -13,6 +13,7 @@ namespace CodeIgniter\View; +use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; @@ -23,7 +24,7 @@ /** * @internal */ -#[\PHPUnit\Framework\Attributes\Group('Others')] +#[Group('Others')] final class ViewTest extends CIUnitTestCase { private FileLocator $loader; From 07daa923b1fce2f45504e5a9c85abaef9caf211a Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 May 2024 09:18:49 +0900 Subject: [PATCH 100/220] chore: update test-coding-standards.yml for .php-cs-fixer.tests.php --- .github/workflows/test-coding-standards.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-coding-standards.yml b/.github/workflows/test-coding-standards.yml index f2ecb8effbad..a8c34b440522 100644 --- a/.github/workflows/test-coding-standards.yml +++ b/.github/workflows/test-coding-standards.yml @@ -60,8 +60,11 @@ jobs: - name: Run lint on `app/`, `admin/`, `public/` run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.no-header.php --using-cache=no --diff - - name: Run lint on `system/`, `tests`, `utils/`, and root PHP files + - name: Run lint on `system/`, `utils/`, and root PHP files run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff + - name: Run lint on `tests` + run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.tests.php --using-cache=no --diff + - name: Run lint on `user_guide_src/source/` run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.user-guide.php --using-cache=no --diff From 6647a8e5fed48741fff4c87a71321017edcf2a9f Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 May 2024 09:19:17 +0900 Subject: [PATCH 101/220] chore: update highest PHP version --- .github/workflows/test-coding-standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-coding-standards.yml b/.github/workflows/test-coding-standards.yml index a8c34b440522..7e5f18820288 100644 --- a/.github/workflows/test-coding-standards.yml +++ b/.github/workflows/test-coding-standards.yml @@ -29,7 +29,7 @@ jobs: matrix: php-version: - '8.1' - - '8.2' + - '8.3' steps: - name: Checkout From 9a7cae807d9e670b4ac506ead2dd3d09c5748c53 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 May 2024 09:19:46 +0900 Subject: [PATCH 102/220] test: composer cs-fix --- tests/system/API/ResponseTraitTest.php | 2 +- tests/system/AutoReview/ComposerJsonTest.php | 4 ++-- tests/system/AutoReview/FrameworkCodeTest.php | 2 +- tests/system/Autoloader/AutoloaderTest.php | 6 +++--- tests/system/Autoloader/FileLocatorCachedTest.php | 2 +- tests/system/Autoloader/FileLocatorTest.php | 2 +- tests/system/CLI/CLITest.php | 4 ++-- tests/system/CLI/ConsoleTest.php | 2 +- tests/system/Cache/CacheFactoryTest.php | 2 +- tests/system/Cache/CacheMockTest.php | 2 +- tests/system/Cache/FactoriesCacheFileHandlerTest.php | 2 +- .../Cache/FactoriesCacheFileVarExportHandlerTest.php | 2 +- tests/system/Cache/Handlers/BaseHandlerTest.php | 4 ++-- tests/system/Cache/Handlers/DummyHandlerTest.php | 2 +- tests/system/Cache/Handlers/FileHandlerTest.php | 6 +++--- tests/system/Cache/Handlers/MemcachedHandlerTest.php | 2 +- tests/system/Cache/Handlers/PredisHandlerTest.php | 2 +- tests/system/Cache/Handlers/RedisHandlerTest.php | 2 +- tests/system/Cache/ResponseCacheTest.php | 4 ++-- tests/system/CodeIgniterTest.php | 8 ++++---- tests/system/Commands/BaseCommandTest.php | 2 +- tests/system/Commands/CellGeneratorTest.php | 2 +- tests/system/Commands/ClearCacheTest.php | 2 +- tests/system/Commands/ClearDebugbarTest.php | 2 +- tests/system/Commands/ClearLogsTest.php | 2 +- tests/system/Commands/CommandGeneratorTest.php | 2 +- tests/system/Commands/CommandTest.php | 4 ++-- tests/system/Commands/ConfigGeneratorTest.php | 2 +- tests/system/Commands/ConfigurableSortImportsTest.php | 2 +- tests/system/Commands/ControllerGeneratorTest.php | 2 +- tests/system/Commands/CreateDatabaseTest.php | 2 +- tests/system/Commands/Database/MigrateStatusTest.php | 2 +- .../Commands/Database/ShowTableInfoMockIOTest.php | 2 +- tests/system/Commands/Database/ShowTableInfoTest.php | 2 +- tests/system/Commands/DatabaseCommandsTest.php | 2 +- tests/system/Commands/EntityGeneratorTest.php | 2 +- tests/system/Commands/EnvironmentCommandTest.php | 2 +- tests/system/Commands/FilterCheckTest.php | 2 +- tests/system/Commands/FilterGeneratorTest.php | 2 +- tests/system/Commands/GenerateKeyTest.php | 6 +++--- tests/system/Commands/GeneratorsTest.php | 2 +- tests/system/Commands/HelpCommandTest.php | 2 +- tests/system/Commands/InfoCacheTest.php | 2 +- tests/system/Commands/MigrationGeneratorTest.php | 2 +- tests/system/Commands/MigrationIntegrationTest.php | 2 +- tests/system/Commands/ModelGeneratorTest.php | 2 +- tests/system/Commands/PublishCommandTest.php | 2 +- tests/system/Commands/RoutesTest.php | 2 +- tests/system/Commands/ScaffoldGeneratorTest.php | 2 +- tests/system/Commands/SeederGeneratorTest.php | 2 +- tests/system/Commands/TestGeneratorTest.php | 2 +- .../Commands/Translation/LocalizationFinderTest.php | 2 +- tests/system/Commands/Utilities/ConfigCheckTest.php | 2 +- tests/system/Commands/Utilities/NamespacesTest.php | 2 +- .../Utilities/Routes/AutoRouteCollectorTest.php | 2 +- .../AutoRouterImproved/AutoRouteCollectorTest.php | 2 +- .../AutoRouterImproved/ControllerMethodReaderTest.php | 2 +- .../Commands/Utilities/Routes/ControllerFinderTest.php | 2 +- .../Utilities/Routes/ControllerMethodReaderTest.php | 2 +- .../Commands/Utilities/Routes/FilterCollectorTest.php | 2 +- .../Commands/Utilities/Routes/FilterFinderTest.php | 2 +- .../Utilities/Routes/SampleURIGeneratorTest.php | 4 ++-- tests/system/Commands/ValidationGeneratorTest.php | 2 +- tests/system/CommonFunctionsSendTest.php | 4 ++-- tests/system/CommonFunctionsTest.php | 10 +++++----- tests/system/CommonHelperTest.php | 4 ++-- tests/system/CommonSingleServiceTest.php | 4 ++-- tests/system/Config/BaseConfigTest.php | 6 +++--- tests/system/Config/DotEnvTest.php | 10 +++++----- tests/system/Config/FactoriesTest.php | 4 ++-- tests/system/Config/MimesTest.php | 4 ++-- tests/system/Config/ServicesTest.php | 6 +++--- tests/system/ControllerTest.php | 4 ++-- tests/system/Cookie/CookieStoreTest.php | 2 +- tests/system/Cookie/CookieTest.php | 4 ++-- tests/system/DataConverter/DataConverterTest.php | 4 ++-- tests/system/Database/BaseConnectionTest.php | 4 ++-- tests/system/Database/BaseQueryTest.php | 4 ++-- tests/system/Database/Builder/AliasTest.php | 2 +- tests/system/Database/Builder/BaseTest.php | 2 +- tests/system/Database/Builder/CountTest.php | 2 +- tests/system/Database/Builder/DeleteTest.php | 2 +- tests/system/Database/Builder/DistinctTest.php | 2 +- tests/system/Database/Builder/EmptyTest.php | 2 +- tests/system/Database/Builder/FromTest.php | 2 +- tests/system/Database/Builder/GetTest.php | 2 +- tests/system/Database/Builder/GroupTest.php | 2 +- tests/system/Database/Builder/InsertTest.php | 2 +- tests/system/Database/Builder/JoinTest.php | 2 +- tests/system/Database/Builder/LikeTest.php | 2 +- tests/system/Database/Builder/LimitTest.php | 2 +- tests/system/Database/Builder/OrderTest.php | 2 +- tests/system/Database/Builder/PrefixTest.php | 2 +- tests/system/Database/Builder/ReplaceTest.php | 2 +- tests/system/Database/Builder/SelectTest.php | 2 +- tests/system/Database/Builder/TruncateTest.php | 2 +- tests/system/Database/Builder/UnionTest.php | 2 +- tests/system/Database/Builder/UpdateTest.php | 2 +- tests/system/Database/Builder/WhenTest.php | 2 +- tests/system/Database/Builder/WhereTest.php | 4 ++-- tests/system/Database/ConfigTest.php | 4 ++-- tests/system/Database/DatabaseSeederTest.php | 2 +- .../DatabaseTestCaseMigrationOnce1Test.php | 2 +- .../DatabaseTestCaseMigrationOnce2Test.php | 2 +- tests/system/Database/DatabaseTestCaseTest.php | 2 +- tests/system/Database/Forge/CreateTableTest.php | 2 +- tests/system/Database/Forge/DropForeignKeyTest.php | 2 +- tests/system/Database/Live/AliasTest.php | 2 +- tests/system/Database/Live/BadQueryTest.php | 2 +- tests/system/Database/Live/ConnectTest.php | 2 +- tests/system/Database/Live/CountTest.php | 2 +- .../system/Database/Live/DatabaseTestTraitCaseTest.php | 2 +- tests/system/Database/Live/DbDebugTest.php | 2 +- tests/system/Database/Live/DbUtilsTest.php | 2 +- tests/system/Database/Live/DeleteTest.php | 2 +- tests/system/Database/Live/EmptyTest.php | 2 +- tests/system/Database/Live/EscapeTest.php | 2 +- tests/system/Database/Live/FabricatorLiveTest.php | 2 +- tests/system/Database/Live/ForgeTest.php | 2 +- tests/system/Database/Live/FromTest.php | 2 +- tests/system/Database/Live/GetNumRowsTest.php | 2 +- tests/system/Database/Live/GetTest.php | 2 +- tests/system/Database/Live/GetVersionTest.php | 2 +- tests/system/Database/Live/GroupTest.php | 2 +- tests/system/Database/Live/IncrementTest.php | 2 +- tests/system/Database/Live/InsertTest.php | 2 +- tests/system/Database/Live/JoinTest.php | 2 +- tests/system/Database/Live/LikeTest.php | 2 +- tests/system/Database/Live/LimitTest.php | 2 +- tests/system/Database/Live/MetadataTest.php | 2 +- .../Database/Live/MySQLi/GetFieldDataTestCase.php | 2 +- tests/system/Database/Live/MySQLi/NumberNativeTest.php | 2 +- tests/system/Database/Live/MySQLi/RawSqlTest.php | 2 +- .../Database/Live/OCI8/CallStoredProcedureTest.php | 2 +- .../system/Database/Live/OCI8/GetFieldDataTestCase.php | 2 +- tests/system/Database/Live/OCI8/LastInsertIDTest.php | 2 +- tests/system/Database/Live/OrderTest.php | 2 +- .../Database/Live/Postgre/GetFieldDataTestCase.php | 2 +- tests/system/Database/Live/PreparedQueryTest.php | 2 +- tests/system/Database/Live/PretendTest.php | 2 +- .../Database/Live/SQLSRV/GetFieldDataTestCase.php | 2 +- tests/system/Database/Live/SQLite3/AlterTableTest.php | 4 ++-- .../Database/Live/SQLite3/ForgeModifyColumnTest.php | 2 +- .../Database/Live/SQLite3/GetFieldDataTestCase.php | 2 +- .../system/Database/Live/SQLite3/GetIndexDataTest.php | 2 +- tests/system/Database/Live/SelectTest.php | 2 +- .../Database/Live/TransactionDBDebugFalseTest.php | 1 + .../Database/Live/TransactionDBDebugTrueTest.php | 2 +- tests/system/Database/Live/TransactionTest.php | 2 +- tests/system/Database/Live/UnionTest.php | 2 +- tests/system/Database/Live/UpdateTest.php | 4 ++-- tests/system/Database/Live/UpsertTest.php | 2 +- tests/system/Database/Live/WhereTest.php | 2 +- tests/system/Database/Live/WriteTypeQueryTest.php | 2 +- .../system/Database/Migrations/MigrationRunnerTest.php | 2 +- tests/system/Database/Migrations/MigrationTest.php | 2 +- tests/system/Database/RawSqlTest.php | 2 +- tests/system/Debug/ExceptionHandlerTest.php | 2 +- tests/system/Debug/ExceptionsTest.php | 4 ++-- tests/system/Debug/TimerTest.php | 2 +- tests/system/Debug/Toolbar/Collectors/DatabaseTest.php | 2 +- tests/system/Debug/Toolbar/Collectors/HistoryTest.php | 2 +- tests/system/DebugTraceableTraitTest.php | 4 ++-- tests/system/Email/EmailTest.php | 4 ++-- tests/system/Encryption/EncryptionTest.php | 2 +- .../system/Encryption/Handlers/OpenSSLHandlerTest.php | 2 +- tests/system/Encryption/Handlers/SodiumHandlerTest.php | 2 +- tests/system/Entity/EntityTest.php | 2 +- tests/system/Events/EventsTest.php | 6 +++--- tests/system/Files/FileCollectionTest.php | 2 +- tests/system/Files/FileTest.php | 2 +- tests/system/Files/FileWithVfsTest.php | 2 +- tests/system/Filters/CSRFTest.php | 4 ++-- tests/system/Filters/CorsTest.php | 2 +- tests/system/Filters/DebugToolbarTest.php | 4 ++-- tests/system/Filters/FiltersTest.php | 6 +++--- tests/system/Filters/HoneypotTest.php | 8 ++++---- tests/system/Filters/InvalidCharsTest.php | 6 +++--- tests/system/Filters/SecureHeadersTest.php | 2 +- tests/system/Format/FormatTest.php | 2 +- tests/system/Format/JSONFormatterTest.php | 2 +- tests/system/Format/XMLFormatterTest.php | 4 ++-- tests/system/HTTP/CLIRequestTest.php | 4 ++-- tests/system/HTTP/CURLRequestShareOptionsTest.php | 2 +- tests/system/HTTP/CURLRequestTest.php | 4 ++-- tests/system/HTTP/ContentSecurityPolicyTest.php | 6 +++--- tests/system/HTTP/CorsTest.php | 2 +- tests/system/HTTP/DownloadResponseTest.php | 6 +++--- tests/system/HTTP/Files/FileCollectionTest.php | 2 +- tests/system/HTTP/Files/FileMovingTest.php | 2 +- tests/system/HTTP/HeaderTest.php | 2 +- tests/system/HTTP/IncomingRequestDetectingTest.php | 4 ++-- tests/system/HTTP/IncomingRequestTest.php | 10 +++++----- tests/system/HTTP/MessageTest.php | 4 ++-- tests/system/HTTP/NegotiateTest.php | 2 +- tests/system/HTTP/OutgoingRequestTest.php | 2 +- tests/system/HTTP/RedirectExceptionTest.php | 2 +- tests/system/HTTP/RedirectResponseTest.php | 6 +++--- tests/system/HTTP/RequestTest.php | 4 ++-- tests/system/HTTP/ResponseCookieTest.php | 2 +- tests/system/HTTP/ResponseSendTest.php | 6 +++--- tests/system/HTTP/ResponseTest.php | 4 ++-- .../system/HTTP/SiteURIFactoryDetectRoutePathTest.php | 6 +++--- tests/system/HTTP/SiteURIFactoryTest.php | 6 +++--- tests/system/HTTP/SiteURITest.php | 6 +++--- tests/system/HTTP/URITest.php | 6 +++--- tests/system/HTTP/UserAgentTest.php | 2 +- .../Helpers/Array/ArrayHelperDotKeyExistsTest.php | 2 +- .../Helpers/Array/ArrayHelperRecursiveDiffTest.php | 2 +- .../Array/ArrayHelperSortValuesByNaturalTest.php | 2 +- tests/system/Helpers/ArrayHelperTest.php | 4 ++-- tests/system/Helpers/CookieHelperTest.php | 2 +- tests/system/Helpers/DateHelperTest.php | 2 +- tests/system/Helpers/FilesystemHelperTest.php | 2 +- tests/system/Helpers/FormHelperTest.php | 6 +++--- tests/system/Helpers/HTMLHelperTest.php | 2 +- tests/system/Helpers/InflectorHelperTest.php | 4 ++-- tests/system/Helpers/NumberHelperTest.php | 2 +- tests/system/Helpers/SecurityHelperTest.php | 2 +- tests/system/Helpers/TextHelperTest.php | 2 +- tests/system/Helpers/URLHelper/CurrentUrlTest.php | 6 +++--- tests/system/Helpers/URLHelper/MiscUrlTest.php | 10 +++++----- tests/system/Helpers/URLHelper/SiteUrlCliTest.php | 6 +++--- tests/system/Helpers/URLHelper/SiteUrlTest.php | 6 +++--- tests/system/Helpers/XMLHelperTest.php | 2 +- tests/system/HomeTest.php | 2 +- tests/system/Honeypot/HoneypotTest.php | 4 ++-- tests/system/HotReloader/DirectoryHasherTest.php | 2 +- tests/system/I18n/TimeDifferenceTest.php | 2 +- tests/system/I18n/TimeLegacyTest.php | 4 ++-- tests/system/I18n/TimeTest.php | 4 ++-- tests/system/Images/BaseHandlerTest.php | 2 +- tests/system/Images/GDHandlerTest.php | 2 +- tests/system/Images/ImageMagickHandlerTest.php | 6 +++--- tests/system/Images/ImageTest.php | 2 +- tests/system/Language/LanguageTest.php | 4 ++-- tests/system/Log/Handlers/ChromeLoggerHandlerTest.php | 2 +- tests/system/Log/Handlers/ErrorlogHandlerTest.php | 2 +- tests/system/Log/Handlers/FileHandlerTest.php | 2 +- tests/system/Log/LoggerTest.php | 2 +- tests/system/Models/DataConverterModelTest.php | 2 +- tests/system/Models/DeleteModelTest.php | 4 ++-- tests/system/Models/EventsModelTest.php | 2 +- tests/system/Models/FindModelTest.php | 4 ++-- tests/system/Models/GeneralModelTest.php | 2 +- tests/system/Models/GetCompiledModelTest.php | 2 +- tests/system/Models/InsertModelTest.php | 2 +- tests/system/Models/MiscellaneousModelTest.php | 2 +- tests/system/Models/SaveModelTest.php | 2 +- tests/system/Models/TimestampModelTest.php | 2 +- tests/system/Models/UpdateModelTest.php | 4 ++-- tests/system/Models/ValidationModelRuleGroupTest.php | 2 +- tests/system/Models/ValidationModelTest.php | 2 +- tests/system/Pager/PagerRendererTest.php | 2 +- tests/system/Pager/PagerTest.php | 4 ++-- tests/system/Publisher/ContentReplacerTest.php | 2 +- tests/system/Publisher/PublisherContentReplaceTest.php | 2 +- tests/system/Publisher/PublisherInputTest.php | 2 +- tests/system/Publisher/PublisherOutputTest.php | 2 +- tests/system/Publisher/PublisherRestrictionsTest.php | 4 ++-- tests/system/Publisher/PublisherSupportTest.php | 2 +- tests/system/RESTful/ResourceControllerTest.php | 6 +++--- tests/system/RESTful/ResourcePresenterTest.php | 6 +++--- tests/system/Router/AutoRouterImprovedTest.php | 4 ++-- tests/system/Router/DefinedRouteCollectorTest.php | 2 +- .../system/Router/RouteCollectionReverseRouteTest.php | 4 ++-- tests/system/Router/RouteCollectionTest.php | 4 ++-- tests/system/Router/RouterTest.php | 4 ++-- tests/system/Security/CheckPhpIniTest.php | 2 +- .../Security/SecurityCSRFCookieRandomizeTokenTest.php | 2 +- .../Security/SecurityCSRFSessionRandomizeTokenTest.php | 6 +++--- tests/system/Security/SecurityCSRFSessionTest.php | 6 +++--- tests/system/Security/SecurityTest.php | 4 ++-- .../Session/Handlers/Database/MySQLiHandlerTest.php | 2 +- .../Session/Handlers/Database/PostgreHandlerTest.php | 2 +- .../Session/Handlers/Database/RedisHandlerTest.php | 6 +++--- tests/system/Session/SessionTest.php | 6 +++--- tests/system/SparkTest.php | 2 +- tests/system/SuperglobalsTest.php | 2 +- tests/system/Test/BootstrapFCPATHTest.php | 1 + tests/system/Test/ControllerTestTraitTest.php | 6 +++--- tests/system/Test/DOMParserTest.php | 3 ++- tests/system/Test/FabricatorTest.php | 2 +- .../system/Test/FeatureTestAutoRoutingImprovedTest.php | 2 +- tests/system/Test/FeatureTestTraitTest.php | 4 ++-- tests/system/Test/FilterTestTraitTest.php | 2 +- tests/system/Test/TestCaseEmissionsTest.php | 6 +++--- tests/system/Test/TestCaseTest.php | 2 +- tests/system/Test/TestLoggerTest.php | 4 ++-- tests/system/Test/TestResponseTest.php | 4 ++-- tests/system/Throttle/ThrottleTest.php | 4 ++-- tests/system/Typography/TypographyTest.php | 2 +- tests/system/Validation/CreditCardRulesTest.php | 4 ++-- tests/system/Validation/DatabaseRelatedRulesTest.php | 2 +- tests/system/Validation/DotArrayFilterTest.php | 2 +- tests/system/Validation/FileRulesTest.php | 2 +- tests/system/Validation/FormatRulesTest.php | 4 ++-- tests/system/Validation/RulesTest.php | 4 ++-- .../Validation/StrictRules/CreditCardRulesTest.php | 4 ++-- .../StrictRules/DatabaseRelatedRulesTest.php | 2 +- tests/system/Validation/StrictRules/FileRulesTest.php | 2 +- .../system/Validation/StrictRules/FormatRulesTest.php | 2 +- tests/system/Validation/StrictRules/RulesTest.php | 4 ++-- tests/system/Validation/StrictRules/ValidationTest.php | 2 +- tests/system/Validation/ValidationTest.php | 4 ++-- tests/system/View/CellTest.php | 2 +- tests/system/View/ControlledCellTest.php | 2 +- tests/system/View/DecoratorsTest.php | 2 +- tests/system/View/ParserFilterTest.php | 2 +- tests/system/View/ParserPluginTest.php | 6 +++--- tests/system/View/ParserTest.php | 4 ++-- tests/system/View/TableTest.php | 6 +++--- tests/system/View/ViewTest.php | 2 +- 313 files changed, 457 insertions(+), 454 deletions(-) diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index fc2c4dea2467..0887c673d616 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\API; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Format\FormatterInterface; use CodeIgniter\Format\JSONFormatter; @@ -25,6 +24,7 @@ use CodeIgniter\Test\Mock\MockResponse; use Config\App; use Config\Cookie; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/AutoReview/ComposerJsonTest.php b/tests/system/AutoReview/ComposerJsonTest.php index 89f4dcdeec29..995ef99f4f2b 100644 --- a/tests/system/AutoReview/ComposerJsonTest.php +++ b/tests/system/AutoReview/ComposerJsonTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\AutoReview; -use PHPUnit\Framework\Attributes\CoversNothing; -use PHPUnit\Framework\Attributes\Group; use InvalidArgumentException; use JsonException; +use PHPUnit\Framework\Attributes\CoversNothing; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; /** diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index fcbd5851dbc1..b8b155bbbf28 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\AutoReview; -use PHPUnit\Framework\Attributes\DataProvider; use FilesystemIterator; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use RecursiveDirectoryIterator; diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index 74d3a4cace3b..647b041d5f78 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Autoloader; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use App\Controllers\Home; use Closure; use CodeIgniter\Exceptions\ConfigException; @@ -25,6 +22,9 @@ use Config\Modules; use Config\Services; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use RuntimeException; use UnnamespacedClass; diff --git a/tests/system/Autoloader/FileLocatorCachedTest.php b/tests/system/Autoloader/FileLocatorCachedTest.php index 68bb9245dfdd..0aac85a8c59c 100644 --- a/tests/system/Autoloader/FileLocatorCachedTest.php +++ b/tests/system/Autoloader/FileLocatorCachedTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Autoloader; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\FactoriesCache\FileVarExportHandler; use Config\Autoload; use Config\Modules; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index 8c185bbae6ea..e3a20286acc6 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Autoloader; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Header; use CodeIgniter\Test\CIUnitTestCase; use Config\Autoload; use Config\Modules; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 063f4dace051..fc62e5888e53 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\CLI; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\PhpStreamWrapper; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionProperty; use RuntimeException; diff --git a/tests/system/CLI/ConsoleTest.php b/tests/system/CLI/ConsoleTest.php index 116e480f5563..cabe2152b684 100644 --- a/tests/system/CLI/ConsoleTest.php +++ b/tests/system/CLI/ConsoleTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\CLI; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CodeIgniter; use CodeIgniter\Config\DotEnv; use CodeIgniter\Events\Events; @@ -21,6 +20,7 @@ use CodeIgniter\Test\Mock\MockCLIConfig; use CodeIgniter\Test\Mock\MockCodeIgniter; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/CacheFactoryTest.php b/tests/system/Cache/CacheFactoryTest.php index 2a2150509001..0947f31d5045 100644 --- a/tests/system/Cache/CacheFactoryTest.php +++ b/tests/system/Cache/CacheFactoryTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Cache; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\Exceptions\CacheException; use CodeIgniter\Cache\Handlers\DummyHandler; use CodeIgniter\Test\CIUnitTestCase; use Config\Cache; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/CacheMockTest.php b/tests/system/Cache/CacheMockTest.php index 6a1361d1b972..c867bebc4249 100644 --- a/tests/system/Cache/CacheMockTest.php +++ b/tests/system/Cache/CacheMockTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Cache; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\Handlers\BaseHandler; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockCache; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/FactoriesCacheFileHandlerTest.php b/tests/system/Cache/FactoriesCacheFileHandlerTest.php index 769bfd2cb2db..892eb7260638 100644 --- a/tests/system/Cache/FactoriesCacheFileHandlerTest.php +++ b/tests/system/Cache/FactoriesCacheFileHandlerTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Cache; -use PHPUnit\Framework\Attributes\Group; use Config\Cache as CacheConfig; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php b/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php index 690674ccf810..8bf5c79d9209 100644 --- a/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php +++ b/tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Cache; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\FactoriesCache\FileVarExportHandler; use CodeIgniter\Config\Factories; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/Handlers/BaseHandlerTest.php b/tests/system/Cache/Handlers/BaseHandlerTest.php index 55b51abcc7cd..06d3c4a98f8e 100644 --- a/tests/system/Cache/Handlers/BaseHandlerTest.php +++ b/tests/system/Cache/Handlers/BaseHandlerTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Cache\Handlers; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use stdClass; use Tests\Support\Cache\RestrictiveHandler; diff --git a/tests/system/Cache/Handlers/DummyHandlerTest.php b/tests/system/Cache/Handlers/DummyHandlerTest.php index 09782e3a699b..1b6fa3aa773a 100644 --- a/tests/system/Cache/Handlers/DummyHandlerTest.php +++ b/tests/system/Cache/Handlers/DummyHandlerTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Cache\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index 4cd0f638893c..9a7213374dd2 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Cache\Handlers; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RequiresOperatingSystem; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Cache\Exceptions\CacheException; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; use Config\Cache; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresOperatingSystem; /** * @internal diff --git a/tests/system/Cache/Handlers/MemcachedHandlerTest.php b/tests/system/Cache/Handlers/MemcachedHandlerTest.php index 16990f5c87e3..4aad8288401c 100644 --- a/tests/system/Cache/Handlers/MemcachedHandlerTest.php +++ b/tests/system/Cache/Handlers/MemcachedHandlerTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Cache\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; use Config\Cache; use Exception; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/Handlers/PredisHandlerTest.php b/tests/system/Cache/Handlers/PredisHandlerTest.php index 341ea6dcc62d..6d88d6e3f609 100644 --- a/tests/system/Cache/Handlers/PredisHandlerTest.php +++ b/tests/system/Cache/Handlers/PredisHandlerTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Cache\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; use Config\Cache; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/Handlers/RedisHandlerTest.php b/tests/system/Cache/Handlers/RedisHandlerTest.php index 67ba3c5ebde0..e5880f8ae0c2 100644 --- a/tests/system/Cache/Handlers/RedisHandlerTest.php +++ b/tests/system/Cache/Handlers/RedisHandlerTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Cache\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; use Config\Cache; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cache/ResponseCacheTest.php b/tests/system/Cache/ResponseCacheTest.php index 8ba6d85c8d62..b0b73855231a 100644 --- a/tests/system/Cache/ResponseCacheTest.php +++ b/tests/system/Cache/ResponseCacheTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Cache; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Response; @@ -26,6 +24,8 @@ use Config\Cache as CacheConfig; use ErrorException; use Exception; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index 33368fb5cb73..b3908b462777 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -13,10 +13,6 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use App\Controllers\Home; use CodeIgniter\Config\Services; use CodeIgniter\Debug\Timer; @@ -34,6 +30,10 @@ use Config\Filters as FiltersConfig; use Config\Modules; use Config\Routing; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use Tests\Support\Filters\Customfilter; use Tests\Support\Filters\RedirectFilter; diff --git a/tests/system/Commands/BaseCommandTest.php b/tests/system/Commands/BaseCommandTest.php index b9a05d51eae5..9e9a2d3408a0 100644 --- a/tests/system/Commands/BaseCommandTest.php +++ b/tests/system/Commands/BaseCommandTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Log\Logger; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Commands\AppInfo; /** diff --git a/tests/system/Commands/CellGeneratorTest.php b/tests/system/Commands/CellGeneratorTest.php index a8f4bdb460b9..31ec6dc3921e 100644 --- a/tests/system/Commands/CellGeneratorTest.php +++ b/tests/system/Commands/CellGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ClearCacheTest.php b/tests/system/Commands/ClearCacheTest.php index 7221edc43b63..e27978e40919 100644 --- a/tests/system/Commands/ClearCacheTest.php +++ b/tests/system/Commands/ClearCacheTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\CacheFactory; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ClearDebugbarTest.php b/tests/system/Commands/ClearDebugbarTest.php index 51635e5f0307..b3c2de18c394 100644 --- a/tests/system/Commands/ClearDebugbarTest.php +++ b/tests/system/Commands/ClearDebugbarTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ClearLogsTest.php b/tests/system/Commands/ClearLogsTest.php index 4a559300ed95..28019d5d51f6 100644 --- a/tests/system/Commands/ClearLogsTest.php +++ b/tests/system/Commands/ClearLogsTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/CommandGeneratorTest.php b/tests/system/Commands/CommandGeneratorTest.php index a8d9d93de14b..d485d6e4f063 100644 --- a/tests/system/Commands/CommandGeneratorTest.php +++ b/tests/system/Commands/CommandGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index a687474cb87e..aa8c4959ac75 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\CLI\Commands; use CodeIgniter\Log\Logger; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Services; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Commands\ParamsReveal; /** diff --git a/tests/system/Commands/ConfigGeneratorTest.php b/tests/system/Commands/ConfigGeneratorTest.php index 45068084da30..ab4914914719 100644 --- a/tests/system/Commands/ConfigGeneratorTest.php +++ b/tests/system/Commands/ConfigGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ConfigurableSortImportsTest.php b/tests/system/Commands/ConfigurableSortImportsTest.php index bd0df985dd76..4f54390d7ffe 100644 --- a/tests/system/Commands/ConfigurableSortImportsTest.php +++ b/tests/system/Commands/ConfigurableSortImportsTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ControllerGeneratorTest.php b/tests/system/Commands/ControllerGeneratorTest.php index d41c34535b55..dc8293bb3997 100644 --- a/tests/system/Commands/ControllerGeneratorTest.php +++ b/tests/system/Commands/ControllerGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/CreateDatabaseTest.php b/tests/system/Commands/CreateDatabaseTest.php index e6bdfc2f3b51..6bf93f4a2eb3 100644 --- a/tests/system/Commands/CreateDatabaseTest.php +++ b/tests/system/Commands/CreateDatabaseTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Database\Database as DatabaseFactory; use CodeIgniter\Database\OCI8\Connection as OCI8Connection; @@ -21,6 +20,7 @@ use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Database/MigrateStatusTest.php b/tests/system/Commands/Database/MigrateStatusTest.php index 9e4324cf725c..5e54b380fdee 100644 --- a/tests/system/Commands/Database/MigrateStatusTest.php +++ b/tests/system/Commands/Database/MigrateStatusTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Commands\Database; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Database/ShowTableInfoMockIOTest.php b/tests/system/Commands/Database/ShowTableInfoMockIOTest.php index ac9a20f84d75..0842c28ae12a 100644 --- a/tests/system/Commands/Database/ShowTableInfoMockIOTest.php +++ b/tests/system/Commands/Database/ShowTableInfoMockIOTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Commands\Database; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use CodeIgniter\Test\Mock\MockInputOutput; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Database/ShowTableInfoTest.php b/tests/system/Commands/Database/ShowTableInfoTest.php index da845f7a1710..a707f519a858 100644 --- a/tests/system/Commands/Database/ShowTableInfoTest.php +++ b/tests/system/Commands/Database/ShowTableInfoTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Commands\Database; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use CodeIgniter\Test\StreamFilterTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Commands/DatabaseCommandsTest.php b/tests/system/Commands/DatabaseCommandsTest.php index 4e90d52e7dfd..1ccdea9251ee 100644 --- a/tests/system/Commands/DatabaseCommandsTest.php +++ b/tests/system/Commands/DatabaseCommandsTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/EntityGeneratorTest.php b/tests/system/Commands/EntityGeneratorTest.php index e694cd74819e..1e764add9cec 100644 --- a/tests/system/Commands/EntityGeneratorTest.php +++ b/tests/system/Commands/EntityGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/EnvironmentCommandTest.php b/tests/system/Commands/EnvironmentCommandTest.php index eff814707356..177becf34f9f 100644 --- a/tests/system/Commands/EnvironmentCommandTest.php +++ b/tests/system/Commands/EnvironmentCommandTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/FilterCheckTest.php b/tests/system/Commands/FilterCheckTest.php index b63e4b774cdc..0c26dd9bf349 100644 --- a/tests/system/Commands/FilterCheckTest.php +++ b/tests/system/Commands/FilterCheckTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/FilterGeneratorTest.php b/tests/system/Commands/FilterGeneratorTest.php index 8a00ed717e0b..b336387d3ab4 100644 --- a/tests/system/Commands/FilterGeneratorTest.php +++ b/tests/system/Commands/FilterGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php index d6d36cfbfaa7..85bd0f9078c2 100644 --- a/tests/system/Commands/GenerateKeyTest.php +++ b/tests/system/Commands/GenerateKeyTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Filters\CITestStreamFilter; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/Commands/GeneratorsTest.php b/tests/system/Commands/GeneratorsTest.php index 99d7ceb51281..f72ceabc710c 100644 --- a/tests/system/Commands/GeneratorsTest.php +++ b/tests/system/Commands/GeneratorsTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/HelpCommandTest.php b/tests/system/Commands/HelpCommandTest.php index a05b5ebca0fa..7ce07d8129fb 100644 --- a/tests/system/Commands/HelpCommandTest.php +++ b/tests/system/Commands/HelpCommandTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/InfoCacheTest.php b/tests/system/Commands/InfoCacheTest.php index c157bd9e8a4a..1c3ad93db5f0 100644 --- a/tests/system/Commands/InfoCacheTest.php +++ b/tests/system/Commands/InfoCacheTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cache\CacheFactory; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/MigrationGeneratorTest.php b/tests/system/Commands/MigrationGeneratorTest.php index d6cb31dbc28f..0f999d638789 100644 --- a/tests/system/Commands/MigrationGeneratorTest.php +++ b/tests/system/Commands/MigrationGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/MigrationIntegrationTest.php b/tests/system/Commands/MigrationIntegrationTest.php index 90f7c1b01166..14b66ccb920a 100644 --- a/tests/system/Commands/MigrationIntegrationTest.php +++ b/tests/system/Commands/MigrationIntegrationTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ModelGeneratorTest.php b/tests/system/Commands/ModelGeneratorTest.php index 3108be0c1971..65596958606c 100644 --- a/tests/system/Commands/ModelGeneratorTest.php +++ b/tests/system/Commands/ModelGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/PublishCommandTest.php b/tests/system/Commands/PublishCommandTest.php index 4494f8418be0..0cd2605aaa1e 100644 --- a/tests/system/Commands/PublishCommandTest.php +++ b/tests/system/Commands/PublishCommandTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Publishers\TestPublisher; /** diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index 2d25b178bec4..4c0ffd174550 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Router\RouteCollection; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ScaffoldGeneratorTest.php b/tests/system/Commands/ScaffoldGeneratorTest.php index 7e9f7ce91184..aca2bf2a2469 100644 --- a/tests/system/Commands/ScaffoldGeneratorTest.php +++ b/tests/system/Commands/ScaffoldGeneratorTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\Autoload; use Config\Modules; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/SeederGeneratorTest.php b/tests/system/Commands/SeederGeneratorTest.php index a0f678e67715..b8f504489c5b 100644 --- a/tests/system/Commands/SeederGeneratorTest.php +++ b/tests/system/Commands/SeederGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/TestGeneratorTest.php b/tests/system/Commands/TestGeneratorTest.php index 5641a9a62c53..b449afd76f05 100644 --- a/tests/system/Commands/TestGeneratorTest.php +++ b/tests/system/Commands/TestGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Translation/LocalizationFinderTest.php b/tests/system/Commands/Translation/LocalizationFinderTest.php index 88224ceb4f33..85bb59c7c09b 100644 --- a/tests/system/Commands/Translation/LocalizationFinderTest.php +++ b/tests/system/Commands/Translation/LocalizationFinderTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Commands\Translation; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\App; use Config\Services; use Locale; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Utilities/ConfigCheckTest.php b/tests/system/Commands/Utilities/ConfigCheckTest.php index 4bc2bf4dce3d..535cb0dd0489 100644 --- a/tests/system/Commands/Utilities/ConfigCheckTest.php +++ b/tests/system/Commands/Utilities/ConfigCheckTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Commands\Utilities; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use Config\App; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index efb95c58d3ac..c32d9280aef4 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands\Utilities; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php index 77381e83617f..ef8e43282b92 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Commands\Utilities\Routes; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php index 78636caeaee0..a669385568dd 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Method; use CodeIgniter\Test\CIUnitTestCase; use Config\Filters; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php index 44c2a69e8662..936b2b8fe184 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers\Dash_folder\Dash_controller; use CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers\Home; use CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers\SubDir\BlogController; use CodeIgniter\Config\Factories; use CodeIgniter\Test\CIUnitTestCase; use Config\Routing; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Controllers\Newautorouting; use Tests\Support\Controllers\Remap; diff --git a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php index acfe87d82bc9..1f6ecce2ec3e 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Commands\Utilities\Routes; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Controllers\Hello; /** diff --git a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php index 2a44d79756fe..04563a481d7b 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Commands\Utilities\Routes; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Controllers\Popcorn; use Tests\Support\Controllers\Remap; diff --git a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php index 07d7f0dc76e8..e3b86fcf9a56 100644 --- a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Commands\Utilities\Routes; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Method; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php index 387da092b697..d96571c6b2f2 100644 --- a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Commands\Utilities\Routes; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Filters\CSRF; use CodeIgniter\Filters\DebugToolbar; @@ -30,6 +29,7 @@ use Config\Filters as FiltersConfig; use Config\Modules; use Config\Routing; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index eef413ebe73a..d5f3d4a542c8 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Commands\Utilities\Routes; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Commands/ValidationGeneratorTest.php b/tests/system/Commands/ValidationGeneratorTest.php index 6fdaddd55b28..0bcbcdec12e7 100644 --- a/tests/system/Commands/ValidationGeneratorTest.php +++ b/tests/system/Commands/ValidationGeneratorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Commands; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/CommonFunctionsSendTest.php b/tests/system/CommonFunctionsSendTest.php index f389efb2366a..8af14200ea7f 100644 --- a/tests/system/CommonFunctionsSendTest.php +++ b/tests/system/CommonFunctionsSendTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter; +use CodeIgniter\Test\CIUnitTestCase; use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\Attributes\PreserveGlobalState; -use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index 308d45d5dec2..226f9f79c776 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -13,11 +13,6 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\BaseService; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\CLIRequest; @@ -46,6 +41,11 @@ use Config\Session as SessionConfig; use Exception; use Kint; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use RuntimeException; use stdClass; use Tests\Support\Models\JobModel; diff --git a/tests/system/CommonHelperTest.php b/tests/system/CommonHelperTest.php index 29b60dc472a3..819b5c582d4c 100644 --- a/tests/system/CommonHelperTest.php +++ b/tests/system/CommonHelperTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\CoversFunction; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; +use PHPUnit\Framework\Attributes\CoversFunction; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\MockObject\MockObject; use RuntimeException; use Tests\Support\Autoloader\FatalLocator; diff --git a/tests/system/CommonSingleServiceTest.php b/tests/system/CommonSingleServiceTest.php index 59c07c7f4ff1..a8b4c6dabc32 100644 --- a/tests/system/CommonSingleServiceTest.php +++ b/tests/system/CommonSingleServiceTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockSecurity; use Config\Security as SecurityConfig; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use ReflectionMethod; diff --git a/tests/system/Config/BaseConfigTest.php b/tests/system/Config/BaseConfigTest.php index 89ecfdabff8c..68776b671fda 100644 --- a/tests/system/Config/BaseConfigTest.php +++ b/tests/system/Config/BaseConfigTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Config; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; use Encryption; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\MockObject\MockObject; use RegistrarConfig; use RuntimeException; diff --git a/tests/system/Config/DotEnvTest.php b/tests/system/Config/DotEnvTest.php index 218940a46e01..8ffc4c5dafbc 100644 --- a/tests/system/Config/DotEnvTest.php +++ b/tests/system/Config/DotEnvTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\Config; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use TypeError; /** diff --git a/tests/system/Config/FactoriesTest.php b/tests/system/Config/FactoriesTest.php index 73c7c0363947..11a5e77a433e 100644 --- a/tests/system/Config/FactoriesTest.php +++ b/tests/system/Config/FactoriesTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Config; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\Depends; use CodeIgniter\Test\CIUnitTestCase; use Config\App; use Config\Database; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use ReflectionClass; use stdClass; use Tests\Support\Config\TestRegistrar; diff --git a/tests/system/Config/MimesTest.php b/tests/system/Config/MimesTest.php index 25b3f9a50011..bcf5923f5b9d 100644 --- a/tests/system/Config/MimesTest.php +++ b/tests/system/Config/MimesTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Config; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Mimes; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index c6735c4e2158..17b97dd2e259 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Config; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Autoloader\Autoloader; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Database\MigrationRunner; @@ -49,6 +46,9 @@ use Config\App; use Config\Exceptions; use Config\Security as SecurityConfig; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use RuntimeException; use Tests\Support\Config\Services; diff --git a/tests/system/ControllerTest.php b/tests/system/ControllerTest.php index 9271d046d590..7cbe664aabc0 100644 --- a/tests/system/ControllerTest.php +++ b/tests/system/ControllerTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\Exceptions\RedirectException; use CodeIgniter\HTTP\IncomingRequest; @@ -27,6 +25,8 @@ use Config\App; use Config\Services; use Config\Validation as ValidationConfig; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; use Psr\Log\LoggerInterface; /** diff --git a/tests/system/Cookie/CookieStoreTest.php b/tests/system/Cookie/CookieStoreTest.php index 5ad93e82ac4c..7e752fde5da5 100644 --- a/tests/system/Cookie/CookieStoreTest.php +++ b/tests/system/Cookie/CookieStoreTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Cookie; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\Test\CIUnitTestCase; use DateTimeImmutable; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index d8af2eb184a7..51016ca0061e 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\Cookie; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\Test\CIUnitTestCase; use Config\Cookie as CookieConfig; use DateTimeImmutable; use DateTimeZone; use LogicException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/DataConverter/DataConverterTest.php b/tests/system/DataConverter/DataConverterTest.php index 109b8b92c66c..6592f4d801c6 100644 --- a/tests/system/DataConverter/DataConverterTest.php +++ b/tests/system/DataConverter/DataConverterTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\DataConverter; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use Closure; use CodeIgniter\HTTP\URI; use CodeIgniter\I18n\Time; use CodeIgniter\Test\CIUnitTestCase; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Entity\CustomUser; use Tests\Support\Entity\User; diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 0dda2d3a4ef5..b36ec7ea022a 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Throwable; /** diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php index d6ec78243abe..a87bc64e727a 100644 --- a/tests/system/Database/BaseQueryTest.php +++ b/tests/system/Database/BaseQueryTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/AliasTest.php b/tests/system/Database/Builder/AliasTest.php index bd6ddb3a12a7..9528ba6aabb2 100644 --- a/tests/system/Database/Builder/AliasTest.php +++ b/tests/system/Database/Builder/AliasTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/BaseTest.php b/tests/system/Database/Builder/BaseTest.php index 2305ca765674..49f74da2762d 100644 --- a/tests/system/Database/Builder/BaseTest.php +++ b/tests/system/Database/Builder/BaseTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/CountTest.php b/tests/system/Database/Builder/CountTest.php index acfc9569310e..8d129efb5c31 100644 --- a/tests/system/Database/Builder/CountTest.php +++ b/tests/system/Database/Builder/CountTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/DeleteTest.php b/tests/system/Database/Builder/DeleteTest.php index 36387ec3d3e3..53b66eed805b 100644 --- a/tests/system/Database/Builder/DeleteTest.php +++ b/tests/system/Database/Builder/DeleteTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/DistinctTest.php b/tests/system/Database/Builder/DistinctTest.php index fb089d77ae57..5a5712db2c0e 100644 --- a/tests/system/Database/Builder/DistinctTest.php +++ b/tests/system/Database/Builder/DistinctTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/EmptyTest.php b/tests/system/Database/Builder/EmptyTest.php index 76aa16aadf29..959bfbc81c56 100644 --- a/tests/system/Database/Builder/EmptyTest.php +++ b/tests/system/Database/Builder/EmptyTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/FromTest.php b/tests/system/Database/Builder/FromTest.php index bfe1af812ec9..99bacd97fe18 100644 --- a/tests/system/Database/Builder/FromTest.php +++ b/tests/system/Database/Builder/FromTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\SQLSRV\Builder as SQLSRVBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/GetTest.php b/tests/system/Database/Builder/GetTest.php index e7ceb5030d0c..2447511c89ca 100644 --- a/tests/system/Database/Builder/GetTest.php +++ b/tests/system/Database/Builder/GetTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; use Config\Feature; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/GroupTest.php b/tests/system/Database/Builder/GroupTest.php index 82cc3e96649b..d03937ca6b3f 100644 --- a/tests/system/Database/Builder/GroupTest.php +++ b/tests/system/Database/Builder/GroupTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/InsertTest.php b/tests/system/Database/Builder/InsertTest.php index ed0120ba5543..e021472b72fc 100644 --- a/tests/system/Database/Builder/InsertTest.php +++ b/tests/system/Database/Builder/InsertTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Query; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/JoinTest.php b/tests/system/Database/Builder/JoinTest.php index 1d94ebe49ffd..377df4816e57 100644 --- a/tests/system/Database/Builder/JoinTest.php +++ b/tests/system/Database/Builder/JoinTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\Postgre\Builder as PostgreBuilder; use CodeIgniter\Database\RawSql; use CodeIgniter\Database\SQLSRV\Builder as SQLSRVBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/LikeTest.php b/tests/system/Database/Builder/LikeTest.php index b6fc8e16327d..d2a534b5bf27 100644 --- a/tests/system/Database/Builder/LikeTest.php +++ b/tests/system/Database/Builder/LikeTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/LimitTest.php b/tests/system/Database/Builder/LimitTest.php index e05fcab2ff12..4e7bbfd40203 100644 --- a/tests/system/Database/Builder/LimitTest.php +++ b/tests/system/Database/Builder/LimitTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/OrderTest.php b/tests/system/Database/Builder/OrderTest.php index 20bcbc9ea6ce..b1b2a684d9df 100644 --- a/tests/system/Database/Builder/OrderTest.php +++ b/tests/system/Database/Builder/OrderTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/PrefixTest.php b/tests/system/Database/Builder/PrefixTest.php index 586b1c38dc53..03b8cd99e4d3 100644 --- a/tests/system/Database/Builder/PrefixTest.php +++ b/tests/system/Database/Builder/PrefixTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/ReplaceTest.php b/tests/system/Database/Builder/ReplaceTest.php index e75c90f63fdd..c0aa754ac9e5 100644 --- a/tests/system/Database/Builder/ReplaceTest.php +++ b/tests/system/Database/Builder/ReplaceTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/SelectTest.php b/tests/system/Database/Builder/SelectTest.php index f072b79e2055..cd3f39029f6b 100644 --- a/tests/system/Database/Builder/SelectTest.php +++ b/tests/system/Database/Builder/SelectTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Database\RawSql; use CodeIgniter\Database\SQLSRV\Builder as SQLSRVBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/TruncateTest.php b/tests/system/Database/Builder/TruncateTest.php index 71251e98e2b5..1b9d4199ade0 100644 --- a/tests/system/Database/Builder/TruncateTest.php +++ b/tests/system/Database/Builder/TruncateTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/UnionTest.php b/tests/system/Database/Builder/UnionTest.php index ed1be13c8f1b..bd498e2e2cab 100644 --- a/tests/system/Database/Builder/UnionTest.php +++ b/tests/system/Database/Builder/UnionTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\SQLSRV\Connection as SQLSRVConnection; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/UpdateTest.php b/tests/system/Database/Builder/UpdateTest.php index 32bce616e140..b13739dfbd58 100644 --- a/tests/system/Database/Builder/UpdateTest.php +++ b/tests/system/Database/Builder/UpdateTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; use CodeIgniter\Test\Mock\MockQuery; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/WhenTest.php b/tests/system/Database/Builder/WhenTest.php index be38c73406bc..a7fede7879d3 100644 --- a/tests/system/Database/Builder/WhenTest.php +++ b/tests/system/Database/Builder/WhenTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index d7133013ff07..57980f28ee8c 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Database\Builder; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; @@ -22,6 +20,8 @@ use DateTime; use Error; use ErrorException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/Database/ConfigTest.php b/tests/system/Database/ConfigTest.php index e380a19be0a2..882301692352 100644 --- a/tests/system/Database/ConfigTest.php +++ b/tests/system/Database/ConfigTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\ReflectionHelper; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/DatabaseSeederTest.php b/tests/system/Database/DatabaseSeederTest.php index c481ebfd1c8b..398052636246 100644 --- a/tests/system/Database/DatabaseSeederTest.php +++ b/tests/system/Database/DatabaseSeederTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Database; use Faker\Generator; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php index eb47fa4bcb56..8a0980f853a9 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce1Test.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\DatabaseTestCase; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * DatabaseTestCaseMigrationOnce1Test and DatabaseTestCaseMigrationOnce2Test diff --git a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php index 1703bdd8c01f..5c4013e055e1 100644 --- a/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php +++ b/tests/system/Database/DatabaseTestCase/DatabaseTestCaseMigrationOnce2Test.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\DatabaseTestCase; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * DatabaseTestCaseMigrationOnce1Test and DatabaseTestCaseMigrationOnce2Test diff --git a/tests/system/Database/DatabaseTestCaseTest.php b/tests/system/Database/DatabaseTestCaseTest.php index 5fbcf517b407..c6a03022df72 100644 --- a/tests/system/Database/DatabaseTestCaseTest.php +++ b/tests/system/Database/DatabaseTestCaseTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; use Config\Services; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\AnotherSeeder; use Tests\Support\Database\Seeds\CITestSeeder; diff --git a/tests/system/Database/Forge/CreateTableTest.php b/tests/system/Database/Forge/CreateTableTest.php index b7919f1fdd74..115c5506d379 100644 --- a/tests/system/Database/Forge/CreateTableTest.php +++ b/tests/system/Database/Forge/CreateTableTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Forge; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Forge/DropForeignKeyTest.php b/tests/system/Database/Forge/DropForeignKeyTest.php index 09fc35b96ec6..8c2b37e10b2b 100644 --- a/tests/system/Database/Forge/DropForeignKeyTest.php +++ b/tests/system/Database/Forge/DropForeignKeyTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Forge; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/AliasTest.php b/tests/system/Database/Live/AliasTest.php index d0b02d7d6815..ccd83ee361b8 100644 --- a/tests/system/Database/Live/AliasTest.php +++ b/tests/system/Database/Live/AliasTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/BadQueryTest.php b/tests/system/Database/Live/BadQueryTest.php index 7e7be58ffef3..8b842b21b930 100644 --- a/tests/system/Database/Live/BadQueryTest.php +++ b/tests/system/Database/Live/BadQueryTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/ConnectTest.php b/tests/system/Database/Live/ConnectTest.php index ee74f8f7f86e..3f7941a201ec 100644 --- a/tests/system/Database/Live/ConnectTest.php +++ b/tests/system/Database/Live/ConnectTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Database\SQLite3\Connection; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/CountTest.php b/tests/system/Database/Live/CountTest.php index e9ca2bc5372c..c5aa64d4c700 100644 --- a/tests/system/Database/Live/CountTest.php +++ b/tests/system/Database/Live/CountTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/DatabaseTestTraitCaseTest.php b/tests/system/Database/Live/DatabaseTestTraitCaseTest.php index bb7996fd9f6c..dc43976de9f1 100644 --- a/tests/system/Database/Live/DatabaseTestTraitCaseTest.php +++ b/tests/system/Database/Live/DatabaseTestTraitCaseTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/DbDebugTest.php b/tests/system/Database/Live/DbDebugTest.php index 86698123ff05..8155e9e42db2 100644 --- a/tests/system/Database/Live/DbDebugTest.php +++ b/tests/system/Database/Live/DbDebugTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/DbUtilsTest.php b/tests/system/Database/Live/DbUtilsTest.php index ec6c1f5c4b8a..b7fd56923334 100644 --- a/tests/system/Database/Live/DbUtilsTest.php +++ b/tests/system/Database/Live/DbUtilsTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Database; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/DeleteTest.php b/tests/system/Database/Live/DeleteTest.php index f3c7c4b2b737..421f5c0f430f 100644 --- a/tests/system/Database/Live/DeleteTest.php +++ b/tests/system/Database/Live/DeleteTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/EmptyTest.php b/tests/system/Database/Live/EmptyTest.php index 97224a247f59..42f21af10f39 100644 --- a/tests/system/Database/Live/EmptyTest.php +++ b/tests/system/Database/Live/EmptyTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/EscapeTest.php b/tests/system/Database/Live/EscapeTest.php index afbc3e3b85da..adc5d414e34e 100644 --- a/tests/system/Database/Live/EscapeTest.php +++ b/tests/system/Database/Live/EscapeTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\RawSql; use CodeIgniter\I18n\Time; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/FabricatorLiveTest.php b/tests/system/Database/Live/FabricatorLiveTest.php index 103358366240..a865d2fef4c8 100644 --- a/tests/system/Database/Live/FabricatorLiveTest.php +++ b/tests/system/Database/Live/FabricatorLiveTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use CodeIgniter\Test\Fabricator; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\UserModel; use Tests\Support\Models\ValidModel; diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index 0652b7c3cfe2..7fccd6b1d298 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; use LogicException; +use PHPUnit\Framework\Attributes\Group; use RuntimeException; use stdClass; use Tests\Support\Database\Seeds\CITestSeeder; diff --git a/tests/system/Database/Live/FromTest.php b/tests/system/Database/Live/FromTest.php index d6f9ee673e79..8e26ef0cad78 100644 --- a/tests/system/Database/Live/FromTest.php +++ b/tests/system/Database/Live/FromTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/GetNumRowsTest.php b/tests/system/Database/Live/GetNumRowsTest.php index 90ad2d8537ed..c7575462d598 100644 --- a/tests/system/Database/Live/GetNumRowsTest.php +++ b/tests/system/Database/Live/GetNumRowsTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/GetTest.php b/tests/system/Database/Live/GetTest.php index 29dd82028f60..681af7344183 100644 --- a/tests/system/Database/Live/GetTest.php +++ b/tests/system/Database/Live/GetTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Feature; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/GetVersionTest.php b/tests/system/Database/Live/GetVersionTest.php index de4bd119241e..73da7c07071d 100644 --- a/tests/system/Database/Live/GetVersionTest.php +++ b/tests/system/Database/Live/GetVersionTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/GroupTest.php b/tests/system/Database/Live/GroupTest.php index 7319f1f353cb..7dee9b1e5a67 100644 --- a/tests/system/Database/Live/GroupTest.php +++ b/tests/system/Database/Live/GroupTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/IncrementTest.php b/tests/system/Database/Live/IncrementTest.php index 645344cf85c2..0051e1a9039d 100644 --- a/tests/system/Database/Live/IncrementTest.php +++ b/tests/system/Database/Live/IncrementTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/InsertTest.php b/tests/system/Database/Live/InsertTest.php index 6b0bef010679..217632551b29 100644 --- a/tests/system/Database/Live/InsertTest.php +++ b/tests/system/Database/Live/InsertTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/JoinTest.php b/tests/system/Database/Live/JoinTest.php index f739685c74e6..77324cea6403 100644 --- a/tests/system/Database/Live/JoinTest.php +++ b/tests/system/Database/Live/JoinTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/LikeTest.php b/tests/system/Database/Live/LikeTest.php index 8d06e180739f..5884f9d01220 100644 --- a/tests/system/Database/Live/LikeTest.php +++ b/tests/system/Database/Live/LikeTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/LimitTest.php b/tests/system/Database/Live/LimitTest.php index 135dd7a6bf74..a35bf1d8056c 100644 --- a/tests/system/Database/Live/LimitTest.php +++ b/tests/system/Database/Live/LimitTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/MetadataTest.php b/tests/system/Database/Live/MetadataTest.php index 738ee094e6ce..56e5d70a60e8 100644 --- a/tests/system/Database/Live/MetadataTest.php +++ b/tests/system/Database/Live/MetadataTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php b/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php index a50fddd557da..98403c46e8a8 100644 --- a/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/MySQLi/GetFieldDataTestCase.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live\MySQLi; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/MySQLi/NumberNativeTest.php b/tests/system/Database/Live/MySQLi/NumberNativeTest.php index 048c615bce15..4469e4c3659a 100644 --- a/tests/system/Database/Live/MySQLi/NumberNativeTest.php +++ b/tests/system/Database/Live/MySQLi/NumberNativeTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live\MySQLi; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/MySQLi/RawSqlTest.php b/tests/system/Database/Live/MySQLi/RawSqlTest.php index dd4cfac57d20..e136d526e2de 100644 --- a/tests/system/Database/Live/MySQLi/RawSqlTest.php +++ b/tests/system/Database/Live/MySQLi/RawSqlTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live\MySQLi; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use stdclass; use Tests\Support\Database\Seeds\CITestSeeder; diff --git a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php index 78a866a610d4..2baffb669957 100644 --- a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php +++ b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live\OCI8; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php index 89c6f9d157b4..a45c893dc3f9 100644 --- a/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/OCI8/GetFieldDataTestCase.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live\OCI8; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; use LogicException; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/Database/Live/OCI8/LastInsertIDTest.php b/tests/system/Database/Live/OCI8/LastInsertIDTest.php index 4a5ed73ee0a3..5cc88e39510b 100644 --- a/tests/system/Database/Live/OCI8/LastInsertIDTest.php +++ b/tests/system/Database/Live/OCI8/LastInsertIDTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live\OCI8; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Query; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/OrderTest.php b/tests/system/Database/Live/OrderTest.php index 31bdddcff28c..1451222b5ceb 100644 --- a/tests/system/Database/Live/OrderTest.php +++ b/tests/system/Database/Live/OrderTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php b/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php index 1ed01ddd292e..42e823397926 100644 --- a/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/Postgre/GetFieldDataTestCase.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live\Postgre; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/PreparedQueryTest.php b/tests/system/Database/Live/PreparedQueryTest.php index e1315cc16d3c..fd3b6cedb403 100644 --- a/tests/system/Database/Live/PreparedQueryTest.php +++ b/tests/system/Database/Live/PreparedQueryTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use BadMethodCallException; use CodeIgniter\Database\BasePreparedQuery; use CodeIgniter\Database\Exceptions\DatabaseException; @@ -21,6 +20,7 @@ use CodeIgniter\Database\ResultInterface; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/PretendTest.php b/tests/system/Database/Live/PretendTest.php index 9b44880b3341..b3e6506c1be6 100644 --- a/tests/system/Database/Live/PretendTest.php +++ b/tests/system/Database/Live/PretendTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Query; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php b/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php index 561b1cae2e48..bf00175c4fab 100644 --- a/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/SQLSRV/GetFieldDataTestCase.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live\SQLSRV; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/SQLite3/AlterTableTest.php b/tests/system/Database/Live/SQLite3/AlterTableTest.php index 9440a3721cc9..46806b9618fb 100644 --- a/tests/system/Database/Live/SQLite3/AlterTableTest.php +++ b/tests/system/Database/Live/SQLite3/AlterTableTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\Database\Live\SQLite3; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RequiresPhpExtension; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Database\SQLite3\Forge; use CodeIgniter\Database\SQLite3\Table; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; /** * @internal diff --git a/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php b/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php index d04e8fa8e77f..c628b01aea21 100644 --- a/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php +++ b/tests/system/Database/Live/SQLite3/ForgeModifyColumnTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live\SQLite3; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Forge; use CodeIgniter\Test\CIUnitTestCase; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php b/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php index fc5d7959b143..9fb6d881f019 100644 --- a/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php +++ b/tests/system/Database/Live/SQLite3/GetFieldDataTestCase.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live\SQLite3; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Live\AbstractGetFieldDataTestCase; use Config\Database; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php index 3881b4331638..5ef439644417 100644 --- a/tests/system/Database/Live/SQLite3/GetIndexDataTest.php +++ b/tests/system/Database/Live/SQLite3/GetIndexDataTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Live\SQLite3; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\SQLite3\Connection; use CodeIgniter\Database\SQLite3\Forge; use CodeIgniter\Test\CIUnitTestCase; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/Database/Live/SelectTest.php b/tests/system/Database/Live/SelectTest.php index 5d8e3402e716..8fbd416da8ee 100644 --- a/tests/system/Database/Live/SelectTest.php +++ b/tests/system/Database/Live/SelectTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/TransactionDBDebugFalseTest.php b/tests/system/Database/Live/TransactionDBDebugFalseTest.php index e4dd8d344420..8be00575abed 100644 --- a/tests/system/Database/Live/TransactionDBDebugFalseTest.php +++ b/tests/system/Database/Live/TransactionDBDebugFalseTest.php @@ -14,6 +14,7 @@ namespace CodeIgniter\Database\Live; use PHPUnit\Framework\Attributes\Group; + /** * @internal */ diff --git a/tests/system/Database/Live/TransactionDBDebugTrueTest.php b/tests/system/Database/Live/TransactionDBDebugTrueTest.php index 5d9178a35509..da77edb9b975 100644 --- a/tests/system/Database/Live/TransactionDBDebugTrueTest.php +++ b/tests/system/Database/Live/TransactionDBDebugTrueTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/TransactionTest.php b/tests/system/Database/Live/TransactionTest.php index a69de8246d84..3414d2dfffdf 100644 --- a/tests/system/Database/Live/TransactionTest.php +++ b/tests/system/Database/Live/TransactionTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/UnionTest.php b/tests/system/Database/Live/UnionTest.php index 3f8643d0fe71..c3ddee84c5b1 100644 --- a/tests/system/Database/Live/UnionTest.php +++ b/tests/system/Database/Live/UnionTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/UpdateTest.php b/tests/system/Database/Live/UpdateTest.php index ed03b37ad554..8af549fc638e 100644 --- a/tests/system/Database/Live/UpdateTest.php +++ b/tests/system/Database/Live/UpdateTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/UpsertTest.php b/tests/system/Database/Live/UpsertTest.php index e1248c3d98f4..94732e694d50 100644 --- a/tests/system/Database/Live/UpsertTest.php +++ b/tests/system/Database/Live/UpsertTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge; use CodeIgniter\Database\RawSql; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use stdclass; use Tests\Support\Database\Seeds\CITestSeeder; diff --git a/tests/system/Database/Live/WhereTest.php b/tests/system/Database/Live/WhereTest.php index 3c0d8d654db9..8513144356cf 100644 --- a/tests/system/Database/Live/WhereTest.php +++ b/tests/system/Database/Live/WhereTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Live/WriteTypeQueryTest.php b/tests/system/Database/Live/WriteTypeQueryTest.php index 356db13567e6..faaa7bfabddb 100644 --- a/tests/system/Database/Live/WriteTypeQueryTest.php +++ b/tests/system/Database/Live/WriteTypeQueryTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Live; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Database\Seeds\CITestSeeder; /** diff --git a/tests/system/Database/Migrations/MigrationRunnerTest.php b/tests/system/Database/Migrations/MigrationRunnerTest.php index a9c28d29d914..547eec670ce4 100644 --- a/tests/system/Database/Migrations/MigrationRunnerTest.php +++ b/tests/system/Database/Migrations/MigrationRunnerTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Database\Migrations; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Database\MigrationRunner; use CodeIgniter\Events\Events; @@ -25,6 +24,7 @@ use Config\Services; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\MigrationTestMigrations\Database\Migrations\Migration_another_migration; use Tests\Support\MigrationTestMigrations\Database\Migrations\Migration_some_migration; diff --git a/tests/system/Database/Migrations/MigrationTest.php b/tests/system/Database/Migrations/MigrationTest.php index 6873541a4225..7e4049a113ce 100644 --- a/tests/system/Database/Migrations/MigrationTest.php +++ b/tests/system/Database/Migrations/MigrationTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Database\Migrations; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Migration; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Database/RawSqlTest.php b/tests/system/Database/RawSqlTest.php index 795533158768..340e85c0ffba 100644 --- a/tests/system/Database/RawSqlTest.php +++ b/tests/system/Database/RawSqlTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Database; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Debug/ExceptionHandlerTest.php b/tests/system/Debug/ExceptionHandlerTest.php index 6c2843a6d369..85eaed74621b 100644 --- a/tests/system/Debug/ExceptionHandlerTest.php +++ b/tests/system/Debug/ExceptionHandlerTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Debug; -use PHPUnit\Framework\Attributes\Group; use App\Controllers\Home; use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Test\CIUnitTestCase; @@ -21,6 +20,7 @@ use CodeIgniter\Test\StreamFilterTrait; use Config\Exceptions as ExceptionsConfig; use Config\Services; +use PHPUnit\Framework\Attributes\Group; use RuntimeException; /** diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index 3548301facc6..aa3c2d8b49a6 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -11,8 +11,6 @@ namespace CodeIgniter\Debug; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RequiresPhp; use App\Controllers\Home; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Entity\Exceptions\CastException; @@ -22,6 +20,8 @@ use CodeIgniter\Test\ReflectionHelper; use Config\Exceptions as ExceptionsConfig; use ErrorException; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhp; use RuntimeException; /** diff --git a/tests/system/Debug/TimerTest.php b/tests/system/Debug/TimerTest.php index f3067c21dcc5..eb3cb243b398 100644 --- a/tests/system/Debug/TimerTest.php +++ b/tests/system/Debug/TimerTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Debug; -use PHPUnit\Framework\Attributes\Group; use ArgumentCountError; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use RuntimeException; /** diff --git a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php index abeacfbce43e..9c091ee4e530 100644 --- a/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php +++ b/tests/system/Debug/Toolbar/Collectors/DatabaseTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Debug\Toolbar\Collectors; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Query; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\MockObject\MockObject; /** diff --git a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php index 6c7c6f9a8fbb..3a5411a96a0f 100644 --- a/tests/system/Debug/Toolbar/Collectors/HistoryTest.php +++ b/tests/system/Debug/Toolbar/Collectors/HistoryTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Debug\Toolbar\Collectors; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\StreamFilterTrait; use DateTime; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/DebugTraceableTraitTest.php b/tests/system/DebugTraceableTraitTest.php index 60499cedb57e..bd41fda23e33 100644 --- a/tests/system/DebugTraceableTraitTest.php +++ b/tests/system/DebugTraceableTraitTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\CoversClass; use CodeIgniter\Exceptions\DebugTraceableTrait; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index e5350e44e4ac..99918122d8cf 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Email; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Events\Events; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockEmail; use ErrorException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Encryption/EncryptionTest.php b/tests/system/Encryption/EncryptionTest.php index 7481dadd4224..de372e232411 100644 --- a/tests/system/Encryption/EncryptionTest.php +++ b/tests/system/Encryption/EncryptionTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Encryption; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Encryption\Exceptions\EncryptionException; use CodeIgniter\Test\CIUnitTestCase; use Config\Encryption as EncryptionConfig; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php b/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php index 7b99339d4dab..f82e9151cd3c 100644 --- a/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php +++ b/tests/system/Encryption/Handlers/OpenSSLHandlerTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Encryption\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Encryption\Encryption; use CodeIgniter\Encryption\Exceptions\EncryptionException; use CodeIgniter\Test\CIUnitTestCase; use Config\Encryption as EncryptionConfig; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Encryption/Handlers/SodiumHandlerTest.php b/tests/system/Encryption/Handlers/SodiumHandlerTest.php index d4255e2deba0..bf30036eb2a4 100644 --- a/tests/system/Encryption/Handlers/SodiumHandlerTest.php +++ b/tests/system/Encryption/Handlers/SodiumHandlerTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Encryption\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Encryption\Encryption; use CodeIgniter\Encryption\Exceptions\EncryptionException; use CodeIgniter\Test\CIUnitTestCase; use Config\Encryption as EncryptionConfig; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Entity/EntityTest.php b/tests/system/Entity/EntityTest.php index 17ef6a0ef95f..10947277926a 100644 --- a/tests/system/Entity/EntityTest.php +++ b/tests/system/Entity/EntityTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Entity; -use PHPUnit\Framework\Attributes\Group; use Closure; use CodeIgniter\Entity\Exceptions\CastException; use CodeIgniter\HTTP\URI; @@ -22,6 +21,7 @@ use CodeIgniter\Test\ReflectionHelper; use DateTime; use DateTimeInterface; +use PHPUnit\Framework\Attributes\Group; use ReflectionException; use Tests\Support\Entity\Cast\CastBase64; use Tests\Support\Entity\Cast\CastPassParameters; diff --git a/tests/system/Events/EventsTest.php b/tests/system/Events/EventsTest.php index a3210ae61cf6..8ea4fc54f4ce 100644 --- a/tests/system/Events/EventsTest.php +++ b/tests/system/Events/EventsTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Events; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockEvents; use Config\Modules; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/Files/FileCollectionTest.php b/tests/system/Files/FileCollectionTest.php index 4aa071c9756f..51e8b10e9955 100644 --- a/tests/system/Files/FileCollectionTest.php +++ b/tests/system/Files/FileCollectionTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Files; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Files\Exceptions\FileException; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Files/FileTest.php b/tests/system/Files/FileTest.php index 392c4463f361..800a1ac278f1 100644 --- a/tests/system/Files/FileTest.php +++ b/tests/system/Files/FileTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Files; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use ZipArchive; /** diff --git a/tests/system/Files/FileWithVfsTest.php b/tests/system/Files/FileWithVfsTest.php index 9ef3e585102b..9a1075ad9a1c 100644 --- a/tests/system/Files/FileWithVfsTest.php +++ b/tests/system/Files/FileWithVfsTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Files; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Filters/CSRFTest.php b/tests/system/Filters/CSRFTest.php index 8a2eb2995463..c0d85b02150d 100644 --- a/tests/system/Filters/CSRFTest.php +++ b/tests/system/Filters/CSRFTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Filters; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Response; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Filters/CorsTest.php b/tests/system/Filters/CorsTest.php index 86a69e091728..78023ddfdadc 100644 --- a/tests/system/Filters/CorsTest.php +++ b/tests/system/Filters/CorsTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Filters; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; @@ -24,6 +23,7 @@ use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockAppConfig; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * This test case is based on: diff --git a/tests/system/Filters/DebugToolbarTest.php b/tests/system/Filters/DebugToolbarTest.php index 674fd3f3c123..6cb716ee9556 100644 --- a/tests/system/Filters/DebugToolbarTest.php +++ b/tests/system/Filters/DebugToolbarTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\Filters; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Response; use CodeIgniter\Test\CIUnitTestCase; use Config\Filters as FilterConfig; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index e08e94a62f77..3a35920989e5 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Filters; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\Filters\Exceptions\FilterException; @@ -34,6 +31,9 @@ use CodeIgniter\Test\ConfigFromArrayTrait; use CodeIgniter\Test\Mock\MockAppConfig; use Config\Filters as FiltersConfig; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; require_once __DIR__ . '/fixtures/GoogleMe.php'; require_once __DIR__ . '/fixtures/GoogleYou.php'; diff --git a/tests/system/Filters/HoneypotTest.php b/tests/system/Filters/HoneypotTest.php index f5c5db756c10..ee7b37a8df73 100644 --- a/tests/system/Filters/HoneypotTest.php +++ b/tests/system/Filters/HoneypotTest.php @@ -13,10 +13,6 @@ namespace CodeIgniter\Filters; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Config\Services; use CodeIgniter\Honeypot\Exceptions\HoneypotException; use CodeIgniter\HTTP\CLIRequest; @@ -24,6 +20,10 @@ use CodeIgniter\HTTP\Response; use CodeIgniter\Test\CIUnitTestCase; use Config\Honeypot; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/Filters/InvalidCharsTest.php b/tests/system/Filters/InvalidCharsTest.php index ad63d6225131..ea2ee644b135 100644 --- a/tests/system/Filters/InvalidCharsTest.php +++ b/tests/system/Filters/InvalidCharsTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Filters; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\SiteURI; @@ -23,6 +20,9 @@ use CodeIgniter\Security\Exceptions\SecurityException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockAppConfig; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Filters/SecureHeadersTest.php b/tests/system/Filters/SecureHeadersTest.php index e8c0a40a7a8f..48ff8bb7d04f 100644 --- a/tests/system/Filters/SecureHeadersTest.php +++ b/tests/system/Filters/SecureHeadersTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Filters; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Format/FormatTest.php b/tests/system/Format/FormatTest.php index fc8977267810..89fab7512368 100644 --- a/tests/system/Format/FormatTest.php +++ b/tests/system/Format/FormatTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Format; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Format\Exceptions\FormatException; use CodeIgniter\HTTP\URI; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Format/JSONFormatterTest.php b/tests/system/Format/JSONFormatterTest.php index 4e203bd5c7c8..a479be9e8f63 100644 --- a/tests/system/Format/JSONFormatterTest.php +++ b/tests/system/Format/JSONFormatterTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Format; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use RuntimeException; /** diff --git a/tests/system/Format/XMLFormatterTest.php b/tests/system/Format/XMLFormatterTest.php index 2e1cb84d221f..0615a1eafd91 100644 --- a/tests/system/Format/XMLFormatterTest.php +++ b/tests/system/Format/XMLFormatterTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Format; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use DOMDocument; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/CLIRequestTest.php b/tests/system/HTTP/CLIRequestTest.php index c401ec1816f6..854d8430528b 100644 --- a/tests/system/HTTP/CLIRequestTest.php +++ b/tests/system/HTTP/CLIRequestTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * This should be the same as RequestTest, diff --git a/tests/system/HTTP/CURLRequestShareOptionsTest.php b/tests/system/HTTP/CURLRequestShareOptionsTest.php index 0f584d3c9e10..38612ad03e05 100644 --- a/tests/system/HTTP/CURLRequestShareOptionsTest.php +++ b/tests/system/HTTP/CURLRequestShareOptionsTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Test\Mock\MockCURLRequest; use Config\App; use Config\CURLRequest as ConfigCURLRequest; +use PHPUnit\Framework\Attributes\Group; /** * This test case is for the case where shareOptions is true. diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index 575cb273080f..dc48eb621d80 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\BackupGlobals; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\Exceptions\HTTPException; @@ -23,6 +21,8 @@ use Config\App; use Config\CURLRequest as ConfigCURLRequest; use CURLFile; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index 50f8a707d22a..50d93e8c0412 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\TestResponse; use Config\App; use Config\ContentSecurityPolicy as CSPConfig; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * Test the CSP policy directive creation. diff --git a/tests/system/HTTP/CorsTest.php b/tests/system/HTTP/CorsTest.php index 88b63a96cb11..9f2a7280bee4 100644 --- a/tests/system/HTTP/CorsTest.php +++ b/tests/system/HTTP/CorsTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/DownloadResponseTest.php b/tests/system/HTTP/DownloadResponseTest.php index 5116c47eb6da..20d9d1f39784 100644 --- a/tests/system/HTTP/DownloadResponseTest.php +++ b/tests/system/HTTP/DownloadResponseTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Exceptions\DownloadException; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Test\CIUnitTestCase; use DateTime; use DateTimeZone; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/HTTP/Files/FileCollectionTest.php b/tests/system/HTTP/Files/FileCollectionTest.php index 6861a81dc343..a0d7bb1de771 100644 --- a/tests/system/HTTP/Files/FileCollectionTest.php +++ b/tests/system/HTTP/Files/FileCollectionTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\HTTP\Files; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Mimes; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index b33c5867cf50..c07116970b5a 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\HTTP\Files; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/HeaderTest.php b/tests/system/HTTP/HeaderTest.php index 52b29fe44cb1..6ca5180ff838 100644 --- a/tests/system/HTTP/HeaderTest.php +++ b/tests/system/HTTP/HeaderTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Error; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/HTTP/IncomingRequestDetectingTest.php b/tests/system/HTTP/IncomingRequestDetectingTest.php index ad6e3295f941..fa53060b6a83 100644 --- a/tests/system/HTTP/IncomingRequestDetectingTest.php +++ b/tests/system/HTTP/IncomingRequestDetectingTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index 7ac764b18d88..eb15b2c37c91 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -13,11 +13,6 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\HTTP\Exceptions\HTTPException; @@ -26,6 +21,11 @@ use Config\App; use InvalidArgumentException; use JsonException; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use TypeError; /** diff --git a/tests/system/HTTP/MessageTest.php b/tests/system/HTTP/MessageTest.php index 304478338294..d16224367a6f 100644 --- a/tests/system/HTTP/MessageTest.php +++ b/tests/system/HTTP/MessageTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/NegotiateTest.php b/tests/system/HTTP/NegotiateTest.php index 90cdf81ac378..18d546c0a9c6 100644 --- a/tests/system/HTTP/NegotiateTest.php +++ b/tests/system/HTTP/NegotiateTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/OutgoingRequestTest.php b/tests/system/HTTP/OutgoingRequestTest.php index c1645f9c1a71..37b22a6cf8c6 100644 --- a/tests/system/HTTP/OutgoingRequestTest.php +++ b/tests/system/HTTP/OutgoingRequestTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/RedirectExceptionTest.php b/tests/system/HTTP/RedirectExceptionTest.php index cb0ae7024de8..e77c0ea060d3 100644 --- a/tests/system/HTTP/RedirectExceptionTest.php +++ b/tests/system/HTTP/RedirectExceptionTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Exceptions\RedirectException; use CodeIgniter\I18n\Time; use CodeIgniter\Log\Logger; use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; use Config\Services; use LogicException; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Tests\Support\Log\Handlers\TestHandler; diff --git a/tests/system/HTTP/RedirectResponseTest.php b/tests/system/HTTP/RedirectResponseTest.php index 2c96c2651f70..b1dc20121903 100644 --- a/tests/system/HTTP/RedirectResponseTest.php +++ b/tests/system/HTTP/RedirectResponseTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Router\RouteCollection; @@ -26,6 +23,9 @@ use Config\Modules; use Config\Routing; use Config\Services; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/HTTP/RequestTest.php b/tests/system/HTTP/RequestTest.php index 0dc74a5d12a0..e2073268d794 100644 --- a/tests/system/HTTP/RequestTest.php +++ b/tests/system/HTTP/RequestTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/ResponseCookieTest.php b/tests/system/HTTP/ResponseCookieTest.php index 5831540169d9..9782287fd70a 100644 --- a/tests/system/HTTP/ResponseCookieTest.php +++ b/tests/system/HTTP/ResponseCookieTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Cookie; use CodeIgniter\Cookie\CookieStore; @@ -21,6 +20,7 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\App; use Config\Cookie as CookieConfig; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/ResponseSendTest.php b/tests/system/HTTP/ResponseSendTest.php index 1d6e94de8985..cd78155bb656 100644 --- a/tests/system/HTTP/ResponseSendTest.php +++ b/tests/system/HTTP/ResponseSendTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Security\Exceptions\SecurityException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; use Config\Services; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * This test suite has been created separately from diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index d80db9c45083..bb939741dda1 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; @@ -23,6 +21,8 @@ use Config\Services; use DateTime; use DateTimeZone; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php index bde5fe629e51..d14a6e5e4151 100644 --- a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php +++ b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Superglobals; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/SiteURIFactoryTest.php b/tests/system/HTTP/SiteURIFactoryTest.php index 9b2acf06d51e..62e20639b5e0 100644 --- a/tests/system/HTTP/SiteURIFactoryTest.php +++ b/tests/system/HTTP/SiteURIFactoryTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Superglobals; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/SiteURITest.php b/tests/system/HTTP/SiteURITest.php index b529b215abf7..644aaa795b6d 100644 --- a/tests/system/HTTP/SiteURITest.php +++ b/tests/system/HTTP/SiteURITest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use BadMethodCallException; use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index 1ada5869ecb5..8a953ee3cab1 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HTTP/UserAgentTest.php b/tests/system/HTTP/UserAgentTest.php index a72ff9129f5e..9799a79c2851 100644 --- a/tests/system/HTTP/UserAgentTest.php +++ b/tests/system/HTTP/UserAgentTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\HTTP; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php b/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php index ead5b25643f2..ea7b379d0b44 100644 --- a/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php +++ b/tests/system/Helpers/Array/ArrayHelperDotKeyExistsTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Helpers\Array; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php b/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php index dfd2ac994f98..2bb1c594def1 100644 --- a/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php +++ b/tests/system/Helpers/Array/ArrayHelperRecursiveDiffTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Helpers\Array; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php b/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php index 5ed25d142be8..4529b4da6918 100644 --- a/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php +++ b/tests/system/Helpers/Array/ArrayHelperSortValuesByNaturalTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Helpers\Array; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index dc6289b6aa2e..a7ed8ae8ec8a 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use ValueError; /** diff --git a/tests/system/Helpers/CookieHelperTest.php b/tests/system/Helpers/CookieHelperTest.php index a872fb1ffe05..619a21717f86 100755 --- a/tests/system/Helpers/CookieHelperTest.php +++ b/tests/system/Helpers/CookieHelperTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\HTTP\IncomingRequest; @@ -26,6 +25,7 @@ use Config\Cookie; use Config\Cookie as CookieConfig; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/DateHelperTest.php b/tests/system/Helpers/DateHelperTest.php index cfbbbc5da25b..173a979e29e3 100644 --- a/tests/system/Helpers/DateHelperTest.php +++ b/tests/system/Helpers/DateHelperTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\I18n\Time; use CodeIgniter\Test\CIUnitTestCase; use DateTimeZone; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index f0caa2264b01..403cfb14da50 100644 --- a/tests/system/Helpers/FilesystemHelperTest.php +++ b/tests/system/Helpers/FilesystemHelperTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\visitor\vfsStreamStructureVisitor; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php index 9c3a22d57527..a74582b67ebf 100644 --- a/tests/system/Helpers/FormHelperTest.php +++ b/tests/system/Helpers/FormHelperTest.php @@ -13,15 +13,15 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\HTTP\SiteURI; use CodeIgniter\Test\CIUnitTestCase; use Config\App; use Config\DocTypes; use Config\Filters; use Config\Services; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php index ecf576734790..b7159253706e 100755 --- a/tests/system/Helpers/HTMLHelperTest.php +++ b/tests/system/Helpers/HTMLHelperTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; use Config\DocTypes; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/InflectorHelperTest.php b/tests/system/Helpers/InflectorHelperTest.php index bb5cb8da21c8..f0df11977126 100755 --- a/tests/system/Helpers/InflectorHelperTest.php +++ b/tests/system/Helpers/InflectorHelperTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/NumberHelperTest.php b/tests/system/Helpers/NumberHelperTest.php index 68c133ea1d8f..9b3afa61992f 100755 --- a/tests/system/Helpers/NumberHelperTest.php +++ b/tests/system/Helpers/NumberHelperTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/SecurityHelperTest.php b/tests/system/Helpers/SecurityHelperTest.php index 59c85b9077ed..ba0c01849458 100644 --- a/tests/system/Helpers/SecurityHelperTest.php +++ b/tests/system/Helpers/SecurityHelperTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockSecurity; use Config\Security as SecurityConfig; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Config\Services; /** diff --git a/tests/system/Helpers/TextHelperTest.php b/tests/system/Helpers/TextHelperTest.php index 382c68b3aafd..e3acd7bb9c50 100755 --- a/tests/system/Helpers/TextHelperTest.php +++ b/tests/system/Helpers/TextHelperTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Helpers/URLHelper/CurrentUrlTest.php b/tests/system/Helpers/URLHelper/CurrentUrlTest.php index abe001aa60af..1c7de84586e2 100644 --- a/tests/system/Helpers/URLHelper/CurrentUrlTest.php +++ b/tests/system/Helpers/URLHelper/CurrentUrlTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Helpers\URLHelper; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -25,6 +22,9 @@ use CodeIgniter\Superglobals; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * Test cases for all URL Helper functions diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index def34b04cd93..87c6a3940208 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -13,11 +13,6 @@ namespace CodeIgniter\Helpers\URLHelper; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -28,6 +23,11 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\App; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/Helpers/URLHelper/SiteUrlCliTest.php b/tests/system/Helpers/URLHelper/SiteUrlCliTest.php index c688ba6fbcb4..2ae86cb883eb 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlCliTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlCliTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\Helpers\URLHelper; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * Since base_url() only slightly modifies diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index d07a9e50200f..cd9d1da66cde 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Helpers\URLHelper; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -24,6 +21,9 @@ use CodeIgniter\Superglobals; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * Since base_url() only slightly modifies diff --git a/tests/system/Helpers/XMLHelperTest.php b/tests/system/Helpers/XMLHelperTest.php index 681314127ea9..f0a52d104d64 100644 --- a/tests/system/Helpers/XMLHelperTest.php +++ b/tests/system/Helpers/XMLHelperTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Helpers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HomeTest.php b/tests/system/HomeTest.php index 161535aa1d22..67efb3961b58 100644 --- a/tests/system/HomeTest.php +++ b/tests/system/HomeTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\FeatureTestTrait; use CodeIgniter\Test\TestResponse; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Honeypot/HoneypotTest.php b/tests/system/Honeypot/HoneypotTest.php index d97794cb160e..ee048a1a785c 100644 --- a/tests/system/Honeypot/HoneypotTest.php +++ b/tests/system/Honeypot/HoneypotTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Honeypot; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\Filters\Filters; @@ -25,6 +23,8 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\App; use Config\Honeypot as HoneypotConfig; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/HotReloader/DirectoryHasherTest.php b/tests/system/HotReloader/DirectoryHasherTest.php index f8dcecedf0e5..3ef02c1217a4 100644 --- a/tests/system/HotReloader/DirectoryHasherTest.php +++ b/tests/system/HotReloader/DirectoryHasherTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\HotReloader; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/I18n/TimeDifferenceTest.php b/tests/system/I18n/TimeDifferenceTest.php index 0a1e244c19e9..4342d53f92ee 100644 --- a/tests/system/I18n/TimeDifferenceTest.php +++ b/tests/system/I18n/TimeDifferenceTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\I18n; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Locale; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index 2f85b7d9122b..771890699ece 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\I18n; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\I18n\Exceptions\I18nException; use CodeIgniter\Test\CIUnitTestCase; @@ -23,6 +21,8 @@ use DateTimeZone; use IntlDateFormatter; use Locale; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index 606e3cd0d6e8..34516948ef65 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\I18n; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\I18n\Exceptions\I18nException; use CodeIgniter\Test\CIUnitTestCase; @@ -23,6 +21,8 @@ use DateTimeZone; use IntlDateFormatter; use Locale; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Images/BaseHandlerTest.php b/tests/system/Images/BaseHandlerTest.php index cf02b4fb492c..7332eba9031f 100644 --- a/tests/system/Images/BaseHandlerTest.php +++ b/tests/system/Images/BaseHandlerTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Images; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Files\Exceptions\FileNotFoundException; use CodeIgniter\Images\Exceptions\ImageException; @@ -21,6 +20,7 @@ use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; /** * Test the common image processing functionality. diff --git a/tests/system/Images/GDHandlerTest.php b/tests/system/Images/GDHandlerTest.php index bab99482fe8f..db8297ae212f 100644 --- a/tests/system/Images/GDHandlerTest.php +++ b/tests/system/Images/GDHandlerTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Images; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\Images\Exceptions\ImageException; use CodeIgniter\Images\Handlers\BaseHandler; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; /** * Unit testing for the GD image handler. diff --git a/tests/system/Images/ImageMagickHandlerTest.php b/tests/system/Images/ImageMagickHandlerTest.php index 4e67fce70a4a..8ca59fd8dbbc 100644 --- a/tests/system/Images/ImageMagickHandlerTest.php +++ b/tests/system/Images/ImageMagickHandlerTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Images; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RequiresPhpExtension; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\Images\Exceptions\ImageException; use CodeIgniter\Images\Handlers\BaseHandler; @@ -23,6 +20,9 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\Images; use Imagick; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; /** * Unit testing for the ImageMagick image handler. diff --git a/tests/system/Images/ImageTest.php b/tests/system/Images/ImageTest.php index e1d782ea1a88..c4411dd7dedb 100644 --- a/tests/system/Images/ImageTest.php +++ b/tests/system/Images/ImageTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Images; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Images\Exceptions\ImageException; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index 69363c8fecae..2651413060c8 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Language; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockLanguage; use Config\Services; use MessageFormatter; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Language\SecondMockLanguage; /** diff --git a/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php b/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php index dfb34b5c840f..3dc0b1ccee80 100644 --- a/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php +++ b/tests/system/Log/Handlers/ChromeLoggerHandlerTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Log\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; use CodeIgniter\Test\Mock\MockResponse; use Config\App; use Config\Services; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/Log/Handlers/ErrorlogHandlerTest.php b/tests/system/Log/Handlers/ErrorlogHandlerTest.php index 728ef653d2c1..609cea39af7d 100644 --- a/tests/system/Log/Handlers/ErrorlogHandlerTest.php +++ b/tests/system/Log/Handlers/ErrorlogHandlerTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Log\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Log\Exceptions\LogException; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\MockObject\MockObject; /** diff --git a/tests/system/Log/Handlers/FileHandlerTest.php b/tests/system/Log/Handlers/FileHandlerTest.php index eb7af4d53dbb..7cf11c1f3cf9 100644 --- a/tests/system/Log/Handlers/FileHandlerTest.php +++ b/tests/system/Log/Handlers/FileHandlerTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Log\Handlers; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockFileLogger; use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Log\Handlers\TestHandler; /** diff --git a/tests/system/Log/LoggerTest.php b/tests/system/Log/LoggerTest.php index e909fccbad69..9464d4d286fd 100644 --- a/tests/system/Log/LoggerTest.php +++ b/tests/system/Log/LoggerTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Log; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\I18n\Time; use CodeIgniter\Log\Exceptions\LogException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockLogger as LoggerConfig; use Exception; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Log\Handlers\TestHandler; use TypeError; diff --git a/tests/system/Models/DataConverterModelTest.php b/tests/system/Models/DataConverterModelTest.php index 67df1ea3b356..cd50df0d8b00 100644 --- a/tests/system/Models/DataConverterModelTest.php +++ b/tests/system/Models/DataConverterModelTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\I18n\Time; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Entity\CustomUser; use Tests\Support\Entity\User; use Tests\Support\Models\UserCastsTimestampModel; diff --git a/tests/system/Models/DeleteModelTest.php b/tests/system/Models/DeleteModelTest.php index 1cc0b3245f2b..bb78ec46f00a 100644 --- a/tests/system/Models/DeleteModelTest.php +++ b/tests/system/Models/DeleteModelTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Exceptions\ModelException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\JobModel; use Tests\Support\Models\StringifyPkeyModel; use Tests\Support\Models\UserModel; diff --git a/tests/system/Models/EventsModelTest.php b/tests/system/Models/EventsModelTest.php index d3a00ee0111c..d697437d3534 100644 --- a/tests/system/Models/EventsModelTest.php +++ b/tests/system/Models/EventsModelTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\EventModel; /** diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index 362619855a59..b15857d4aaaf 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Exceptions\ModelException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Entity\UserWithCasts; use Tests\Support\Models\JobModel; use Tests\Support\Models\SecondaryModel; diff --git a/tests/system/Models/GeneralModelTest.php b/tests/system/Models/GeneralModelTest.php index f85f5d795813..d0e50768457a 100644 --- a/tests/system/Models/GeneralModelTest.php +++ b/tests/system/Models/GeneralModelTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use BadMethodCallException; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Model; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\JobModel; use Tests\Support\Models\UserModel; diff --git a/tests/system/Models/GetCompiledModelTest.php b/tests/system/Models/GetCompiledModelTest.php index 288c7b189fd4..77663bd49700 100644 --- a/tests/system/Models/GetCompiledModelTest.php +++ b/tests/system/Models/GetCompiledModelTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Exceptions\ModelException; use CodeIgniter\Model; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\UserObjModel; /** diff --git a/tests/system/Models/InsertModelTest.php b/tests/system/Models/InsertModelTest.php index 6afd2260df7f..d4a680d7696b 100644 --- a/tests/system/Models/InsertModelTest.php +++ b/tests/system/Models/InsertModelTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Entity\Entity; use CodeIgniter\I18n\Time; use CodeIgniter\Model; use Config\Database; +use PHPUnit\Framework\Attributes\Group; use stdClass; use Tests\Support\Entity\User; use Tests\Support\Models\JobModel; diff --git a/tests/system/Models/MiscellaneousModelTest.php b/tests/system/Models/MiscellaneousModelTest.php index c05896406054..f595973ca13e 100644 --- a/tests/system/Models/MiscellaneousModelTest.php +++ b/tests/system/Models/MiscellaneousModelTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\I18n\Time; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\EntityModel; use Tests\Support\Models\JobModel; use Tests\Support\Models\SimpleEntity; diff --git a/tests/system/Models/SaveModelTest.php b/tests/system/Models/SaveModelTest.php index 8af9677196c8..29f2959878e4 100644 --- a/tests/system/Models/SaveModelTest.php +++ b/tests/system/Models/SaveModelTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Entity\Entity; use CodeIgniter\I18n\Time; use CodeIgniter\Model; +use PHPUnit\Framework\Attributes\Group; use stdClass; use Tests\Support\Models\EntityModel; use Tests\Support\Models\JobModel; diff --git a/tests/system/Models/TimestampModelTest.php b/tests/system/Models/TimestampModelTest.php index 36ea733cd643..8736691b2d4a 100644 --- a/tests/system/Models/TimestampModelTest.php +++ b/tests/system/Models/TimestampModelTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\I18n\Time; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Entity\User; use Tests\Support\Models\UserTimestampModel; diff --git a/tests/system/Models/UpdateModelTest.php b/tests/system/Models/UpdateModelTest.php index c2f90705f998..c7c8b9ad51d4 100644 --- a/tests/system/Models/UpdateModelTest.php +++ b/tests/system/Models/UpdateModelTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Entity\Entity; use Config\Database; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use stdClass; use Tests\Support\Entity\User; use Tests\Support\Entity\UUID; diff --git a/tests/system/Models/ValidationModelRuleGroupTest.php b/tests/system/Models/ValidationModelRuleGroupTest.php index 48bf900caa2a..4274d5d1578f 100644 --- a/tests/system/Models/ValidationModelRuleGroupTest.php +++ b/tests/system/Models/ValidationModelRuleGroupTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Model; use Config\Services; +use PHPUnit\Framework\Attributes\Group; use stdClass; use Tests\Support\Config\Validation; use Tests\Support\Models\JobModel; diff --git a/tests/system/Models/ValidationModelTest.php b/tests/system/Models/ValidationModelTest.php index 0abce78b7f51..d2c9c7d0dab8 100644 --- a/tests/system/Models/ValidationModelTest.php +++ b/tests/system/Models/ValidationModelTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Models; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Model; use Config\Validation; +use PHPUnit\Framework\Attributes\Group; use stdClass; use Tests\Support\Models\JobModel; use Tests\Support\Models\SimpleEntity; diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index c0dd61b05186..8ac8683a4327 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Pager; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\URI; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Pager/PagerTest.php b/tests/system/Pager/PagerTest.php index d3bec487a475..047637a2025f 100644 --- a/tests/system/Pager/PagerTest.php +++ b/tests/system/Pager/PagerTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Pager; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\SiteURI; @@ -25,6 +23,8 @@ use Config\App; use Config\Pager as PagerConfig; use Config\Services; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Publisher/ContentReplacerTest.php b/tests/system/Publisher/ContentReplacerTest.php index 6e667215da48..b5d0c1b4604d 100644 --- a/tests/system/Publisher/ContentReplacerTest.php +++ b/tests/system/Publisher/ContentReplacerTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Publisher; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Publisher/PublisherContentReplaceTest.php b/tests/system/Publisher/PublisherContentReplaceTest.php index 7c873602b1a5..3b612a93baee 100644 --- a/tests/system/Publisher/PublisherContentReplaceTest.php +++ b/tests/system/Publisher/PublisherContentReplaceTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Publisher; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Publisher/PublisherInputTest.php b/tests/system/Publisher/PublisherInputTest.php index 481ecb5403a2..c2eeb14d13a9 100644 --- a/tests/system/Publisher/PublisherInputTest.php +++ b/tests/system/Publisher/PublisherInputTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Publisher; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Publisher/PublisherOutputTest.php b/tests/system/Publisher/PublisherOutputTest.php index b79144006592..1d8c2858d8fb 100644 --- a/tests/system/Publisher/PublisherOutputTest.php +++ b/tests/system/Publisher/PublisherOutputTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Publisher; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index 0f67e5e0056c..eaa326ee82eb 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Publisher; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Publisher\Exceptions\PublisherException; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * Publisher Restrictions Test diff --git a/tests/system/Publisher/PublisherSupportTest.php b/tests/system/Publisher/PublisherSupportTest.php index 079e14a30692..5854e1c516d9 100644 --- a/tests/system/Publisher/PublisherSupportTest.php +++ b/tests/system/Publisher/PublisherSupportTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Publisher; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Publisher\Exceptions\PublisherException; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Publishers\TestPublisher; /** diff --git a/tests/system/RESTful/ResourceControllerTest.php b/tests/system/RESTful/ResourceControllerTest.php index 717884a83250..dcf59b1c3c19 100644 --- a/tests/system/RESTful/ResourceControllerTest.php +++ b/tests/system/RESTful/ResourceControllerTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\RESTful; -use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CodeIgniter; use CodeIgniter\Config\Services; use CodeIgniter\Format\JSONFormatter; @@ -30,6 +27,9 @@ use CodeIgniter\Test\Mock\MockCodeIgniter; use CodeIgniter\Test\Mock\MockResourceController; use Config\App; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use Psr\Log\NullLogger; use Tests\Support\Models\UserModel; use Tests\Support\RESTful\Worker; diff --git a/tests/system/RESTful/ResourcePresenterTest.php b/tests/system/RESTful/ResourcePresenterTest.php index 389f54ef38f6..42772edd09a7 100644 --- a/tests/system/RESTful/ResourcePresenterTest.php +++ b/tests/system/RESTful/ResourcePresenterTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\RESTful; -use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CodeIgniter; use CodeIgniter\Config\Services; use CodeIgniter\Model; @@ -24,6 +21,9 @@ use CodeIgniter\Test\Mock\MockCodeIgniter; use CodeIgniter\Test\Mock\MockResourcePresenter; use Config\App; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use Tests\Support\Models\EntityModel; use Tests\Support\Models\UserModel; use Tests\Support\RESTful\Worker2; diff --git a/tests/system/Router/AutoRouterImprovedTest.php b/tests/system/Router/AutoRouterImprovedTest.php index 9b438d821809..c60c978e4a3c 100644 --- a/tests/system/Router/AutoRouterImprovedTest.php +++ b/tests/system/Router/AutoRouterImprovedTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Router; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\Exceptions\PageNotFoundException; @@ -27,6 +25,8 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; use Config\Routing; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Router/DefinedRouteCollectorTest.php b/tests/system/Router/DefinedRouteCollectorTest.php index 351b02437696..ca10a2fd7b51 100644 --- a/tests/system/Router/DefinedRouteCollectorTest.php +++ b/tests/system/Router/DefinedRouteCollectorTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Router; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\Method; use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; use Config\Routing; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index 34be8aea84d0..ebe344293f46 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\Router; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\Method; use CodeIgniter\Router\Exceptions\RouterException; use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; use Config\Routing; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index 420ac9f607ea..89959cd5f33e 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Router; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use App\Controllers\Product; use CodeIgniter\Config\Services; use CodeIgniter\controller; @@ -23,6 +21,8 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; use Config\Routing; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Controllers\Hello; /** diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index a2fc16dbd1d5..bb5302e721dc 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Router; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\Exceptions\PageNotFoundException; @@ -27,6 +25,8 @@ use Config\App; use Config\Modules; use Config\Routing; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Filters\Customfilter; /** diff --git a/tests/system/Security/CheckPhpIniTest.php b/tests/system/Security/CheckPhpIniTest.php index 38d5ced76a3f..8636337f2893 100644 --- a/tests/system/Security/CheckPhpIniTest.php +++ b/tests/system/Security/CheckPhpIniTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Security; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockInputOutput; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php b/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php index 796b8f5ec22c..459de0a47fa7 100644 --- a/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php +++ b/tests/system/Security/SecurityCSRFCookieRandomizeTokenTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Security; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Cookie; use CodeIgniter\HTTP\IncomingRequest; @@ -23,6 +22,7 @@ use CodeIgniter\Test\Mock\MockAppConfig; use CodeIgniter\Test\Mock\MockSecurity; use Config\Security as SecurityConfig; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php index bce3d3735063..d49973488b8e 100644 --- a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php +++ b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Security; -use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -35,6 +32,9 @@ use Config\Logger as LoggerConfig; use Config\Security as SecurityConfig; use Config\Session as SessionConfig; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use PHPUnit\Framework\Attributes\WithoutErrorHandler; /** diff --git a/tests/system/Security/SecurityCSRFSessionTest.php b/tests/system/Security/SecurityCSRFSessionTest.php index ee553b6db73a..501967c0c28e 100644 --- a/tests/system/Security/SecurityCSRFSessionTest.php +++ b/tests/system/Security/SecurityCSRFSessionTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Security; -use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\HTTP\IncomingRequest; @@ -34,6 +31,9 @@ use Config\Logger as LoggerConfig; use Config\Security as SecurityConfig; use Config\Session as SessionConfig; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; /** * @internal diff --git a/tests/system/Security/SecurityTest.php b/tests/system/Security/SecurityTest.php index bce6c47824d0..0ccc092e7e29 100644 --- a/tests/system/Security/SecurityTest.php +++ b/tests/system/Security/SecurityTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Security; -use PHPUnit\Framework\Attributes\BackupGlobals; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\Request; @@ -26,6 +24,8 @@ use CodeIgniter\Test\Mock\MockSecurity; use Config\Security as SecurityConfig; use Config\Services; +use PHPUnit\Framework\Attributes\BackupGlobals; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php index 165bab9088f8..0b364c7f6559 100644 --- a/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php +++ b/tests/system/Session/Handlers/Database/MySQLiHandlerTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Session\Handlers\Database; -use PHPUnit\Framework\Attributes\Group; use Config\Database as DatabaseConfig; use Config\Session as SessionConfig; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php index 69f052b5a59c..21fb96b96244 100644 --- a/tests/system/Session/Handlers/Database/PostgreHandlerTest.php +++ b/tests/system/Session/Handlers/Database/PostgreHandlerTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Session\Handlers\Database; -use PHPUnit\Framework\Attributes\Group; use Config\Database as DatabaseConfig; use Config\Session as SessionConfig; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Session/Handlers/Database/RedisHandlerTest.php b/tests/system/Session/Handlers/Database/RedisHandlerTest.php index eba8152ee587..f7e3a5558a13 100644 --- a/tests/system/Session/Handlers/Database/RedisHandlerTest.php +++ b/tests/system/Session/Handlers/Database/RedisHandlerTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\Session\Handlers\Database; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RequiresPhpExtension; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Session\Handlers\RedisHandler; use CodeIgniter\Test\CIUnitTestCase; use Config\Session as SessionConfig; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; /** * @internal diff --git a/tests/system/Session/SessionTest.php b/tests/system/Session/SessionTest.php index 40afe2dc789d..39479d03f21d 100644 --- a/tests/system/Session/SessionTest.php +++ b/tests/system/Session/SessionTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Session; -use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\Session\Handlers\FileHandler; @@ -25,6 +22,9 @@ use Config\Cookie as CookieConfig; use Config\Logger as LoggerConfig; use Config\Session as SessionConfig; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; /** * @internal diff --git a/tests/system/SparkTest.php b/tests/system/SparkTest.php index ab70dc4e3aff..19f5b9934db9 100644 --- a/tests/system/SparkTest.php +++ b/tests/system/SparkTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/SuperglobalsTest.php b/tests/system/SuperglobalsTest.php index 272f502a8ada..904e3e913d21 100644 --- a/tests/system/SuperglobalsTest.php +++ b/tests/system/SuperglobalsTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Test/BootstrapFCPATHTest.php b/tests/system/Test/BootstrapFCPATHTest.php index a48c20a89515..61d2e1ca1695 100644 --- a/tests/system/Test/BootstrapFCPATHTest.php +++ b/tests/system/Test/BootstrapFCPATHTest.php @@ -14,6 +14,7 @@ namespace CodeIgniter\Test; use PHPUnit\Framework\Attributes\Group; + /** * Class BootstrapFCPATHTest * diff --git a/tests/system/Test/ControllerTestTraitTest.php b/tests/system/Test/ControllerTestTraitTest.php index 600359cc8112..8230dd9d6248 100644 --- a/tests/system/Test/ControllerTestTraitTest.php +++ b/tests/system/Test/ControllerTestTraitTest.php @@ -13,9 +13,6 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\Group; use App\Controllers\Home; use App\Controllers\NeverHeardOfIt; use CodeIgniter\Controller; @@ -24,6 +21,9 @@ use Config\App; use Config\Services; use Exception; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use Tests\Support\Controllers\Newautorouting; use Tests\Support\Controllers\Popcorn; diff --git a/tests/system/Test/DOMParserTest.php b/tests/system/Test/DOMParserTest.php index 0477fc0561fb..31d9b65342a4 100644 --- a/tests/system/Test/DOMParserTest.php +++ b/tests/system/Test/DOMParserTest.php @@ -13,8 +13,9 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; + /** * @internal */ diff --git a/tests/system/Test/FabricatorTest.php b/tests/system/Test/FabricatorTest.php index 39243804a47c..46e7f7d95cfe 100644 --- a/tests/system/Test/FabricatorTest.php +++ b/tests/system/Test/FabricatorTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Config\Factories; use CodeIgniter\Model; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Models\EntityModel; use Tests\Support\Models\EventModel; use Tests\Support\Models\FabricatorModel; diff --git a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php index 1ad1be055569..3b8703f08ea8 100644 --- a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php +++ b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Events\Events; use Config\Feature; use Config\Services; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index e7c658eda821..4fd921d6e9a6 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Config\Factories; use CodeIgniter\Events\Events; use CodeIgniter\Exceptions\PageNotFoundException; @@ -24,6 +22,8 @@ use Config\App; use Config\Routing; use Config\Services; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Test/FilterTestTraitTest.php b/tests/system/Test/FilterTestTraitTest.php index 7b8f123b9109..233e5c13cd22 100644 --- a/tests/system/Test/FilterTestTraitTest.php +++ b/tests/system/Test/FilterTestTraitTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\RequestInterface; use Config\Services; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Filters\Customfilter; /** diff --git a/tests/system/Test/TestCaseEmissionsTest.php b/tests/system/Test/TestCaseEmissionsTest.php index 40559aeef3fb..83f695d8302e 100644 --- a/tests/system/Test/TestCaseEmissionsTest.php +++ b/tests/system/Test/TestCaseEmissionsTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\HTTP\Response; use Config\App; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * This test suite has been created separately from diff --git a/tests/system/Test/TestCaseTest.php b/tests/system/Test/TestCaseTest.php index c64867f9da03..6905d825533a 100644 --- a/tests/system/Test/TestCaseTest.php +++ b/tests/system/Test/TestCaseTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\CLI\CLI; use CodeIgniter\Events\Events; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Test\TestForReflectionHelper; /** diff --git a/tests/system/Test/TestLoggerTest.php b/tests/system/Test/TestLoggerTest.php index d4b95bbfe02b..4c9f38df0dad 100644 --- a/tests/system/Test/TestLoggerTest.php +++ b/tests/system/Test/TestLoggerTest.php @@ -13,9 +13,9 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use Config\Logger; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 2145d174cd5a..7fedf05bab65 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -13,13 +13,13 @@ namespace CodeIgniter\Test; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\Response; use Config\App; use Config\Services; use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 0d0b5d219dea..655cc21dfcfa 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Throttle; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Cache\CacheInterface; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockCache; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Typography/TypographyTest.php b/tests/system/Typography/TypographyTest.php index 399f1d96dd9a..aa46e639e180 100644 --- a/tests/system/Typography/TypographyTest.php +++ b/tests/system/Typography/TypographyTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Typography; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Validation/CreditCardRulesTest.php b/tests/system/Validation/CreditCardRulesTest.php index 9b587374eaf9..9e6b58cdc192 100644 --- a/tests/system/Validation/CreditCardRulesTest.php +++ b/tests/system/Validation/CreditCardRulesTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Validation; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/DatabaseRelatedRulesTest.php b/tests/system/Validation/DatabaseRelatedRulesTest.php index d9656b02d777..d683320e968b 100644 --- a/tests/system/Validation/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/DatabaseRelatedRulesTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Validation; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Validation\StrictRules\DatabaseRelatedRulesTest as StrictDatabaseRelatedRulesTest; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/DotArrayFilterTest.php b/tests/system/Validation/DotArrayFilterTest.php index 6db223279f6e..e83b4fe9e566 100644 --- a/tests/system/Validation/DotArrayFilterTest.php +++ b/tests/system/Validation/DotArrayFilterTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Validation; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/Validation/FileRulesTest.php b/tests/system/Validation/FileRulesTest.php index 7bd681a3b074..6d59af537a06 100644 --- a/tests/system/Validation/FileRulesTest.php +++ b/tests/system/Validation/FileRulesTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Validation; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index 827d74f2e09a..a952e25f8e7b 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Validation; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; use Generator; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 3737bf7216d1..25b3510323bb 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Validation; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use Config\Services; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use stdClass; use Tests\Support\Validation\TestRules; diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index 867eefdf8aba..4705cdcb9c90 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Validation\StrictRules; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php index 556c40bf656c..1535d265f729 100644 --- a/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php +++ b/tests/system/Validation/StrictRules/DatabaseRelatedRulesTest.php @@ -13,7 +13,6 @@ namespace CodeIgniter\Validation\StrictRules; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\DatabaseTestTrait; use CodeIgniter\Validation\Validation; @@ -21,6 +20,7 @@ use Config\Services; use InvalidArgumentException; use LogicException; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/StrictRules/FileRulesTest.php b/tests/system/Validation/StrictRules/FileRulesTest.php index f09e1416817f..07dfc44ad8ce 100644 --- a/tests/system/Validation/StrictRules/FileRulesTest.php +++ b/tests/system/Validation/StrictRules/FileRulesTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\Validation\StrictRules; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/StrictRules/FormatRulesTest.php b/tests/system/Validation/StrictRules/FormatRulesTest.php index 1da8403017ea..998f8f324a16 100644 --- a/tests/system/Validation/StrictRules/FormatRulesTest.php +++ b/tests/system/Validation/StrictRules/FormatRulesTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Validation\StrictRules; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Validation\FormatRulesTest as TraditionalFormatRulesTest; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/StrictRules/RulesTest.php b/tests/system/Validation/StrictRules/RulesTest.php index 0145459265ca..e211ed38e888 100644 --- a/tests/system/Validation/StrictRules/RulesTest.php +++ b/tests/system/Validation/StrictRules/RulesTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\Validation\StrictRules; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Validation\RulesTest as TraditionalRulesTest; use CodeIgniter\Validation\Validation; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/StrictRules/ValidationTest.php b/tests/system/Validation/StrictRules/ValidationTest.php index fd778e748b3d..ca0160ee44e2 100644 --- a/tests/system/Validation/StrictRules/ValidationTest.php +++ b/tests/system/Validation/StrictRules/ValidationTest.php @@ -13,8 +13,8 @@ namespace CodeIgniter\Validation\StrictRules; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Validation\ValidationTest as TraditionalValidationTest; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\Validation\TestRules; /** diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index 9e789edde1bc..b5493a682c8e 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -13,8 +13,6 @@ namespace CodeIgniter\Validation; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\SiteURI; @@ -23,6 +21,8 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use Config\App; use Config\Services; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\ExpectationFailedException; use Tests\Support\Validation\TestRules; use Throwable; diff --git a/tests/system/View/CellTest.php b/tests/system/View/CellTest.php index 79d561c6a0ae..27dd6512d174 100644 --- a/tests/system/View/CellTest.php +++ b/tests/system/View/CellTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\HTTP\Response; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockCache; use CodeIgniter\View\Exceptions\ViewException; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/View/ControlledCellTest.php b/tests/system/View/ControlledCellTest.php index f94aa47b7672..8448aed22ced 100644 --- a/tests/system/View/ControlledCellTest.php +++ b/tests/system/View/ControlledCellTest.php @@ -13,10 +13,10 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\View\Exceptions\ViewException; use LogicException; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\View\Cells\AdditionCell; use Tests\Support\View\Cells\AwesomeCell; use Tests\Support\View\Cells\BadCell; diff --git a/tests/system/View/DecoratorsTest.php b/tests/system/View/DecoratorsTest.php index 2e3faae0dae7..6964575dd5c3 100644 --- a/tests/system/View/DecoratorsTest.php +++ b/tests/system/View/DecoratorsTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Factories; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\View\Exceptions\ViewException; +use PHPUnit\Framework\Attributes\Group; use Tests\Support\View\BadDecorator; use Tests\Support\View\WorldDecorator; diff --git a/tests/system/View/ParserFilterTest.php b/tests/system/View/ParserFilterTest.php index f0270edb1c33..c11310299cc0 100644 --- a/tests/system/View/ParserFilterTest.php +++ b/tests/system/View/ParserFilterTest.php @@ -13,11 +13,11 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; use Config\View; +use PHPUnit\Framework\Attributes\Group; /** * @internal diff --git a/tests/system/View/ParserPluginTest.php b/tests/system/View/ParserPluginTest.php index 146d05cf2940..31b6ebba5b48 100644 --- a/tests/system/View/ParserPluginTest.php +++ b/tests/system/View/ParserPluginTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; -use PHPUnit\Framework\Attributes\PreserveGlobalState; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; /** * @internal diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php index 48a9343e5d68..0cce9f722ebf 100644 --- a/tests/system/View/ParserTest.php +++ b/tests/system/View/ParserTest.php @@ -13,14 +13,14 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Entity\Entity; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\View\Exceptions\ViewException; use Config\Services; use Config\View as ViewConfig; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/View/TableTest.php b/tests/system/View/TableTest.php index d7572760838c..97fb1e2ed1a9 100644 --- a/tests/system/View/TableTest.php +++ b/tests/system/View/TableTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; -use PHPUnit\Framework\Attributes\Depends; -use PHPUnit\Framework\Attributes\DataProvider; use CodeIgniter\Database\MySQLi\Result; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockTable; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use stdClass; /** diff --git a/tests/system/View/ViewTest.php b/tests/system/View/ViewTest.php index a4c5e34af5f4..d1455a604f1b 100644 --- a/tests/system/View/ViewTest.php +++ b/tests/system/View/ViewTest.php @@ -13,12 +13,12 @@ namespace CodeIgniter\View; -use PHPUnit\Framework\Attributes\Group; use CodeIgniter\Autoloader\FileLocator; use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\View\Exceptions\ViewException; use Config; +use PHPUnit\Framework\Attributes\Group; use RuntimeException; /** From b71b7ee9449973c744384868a97a46973e9a9b51 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 May 2024 19:07:28 +0900 Subject: [PATCH 103/220] chore: add tests/ to paths --- .github/workflows/test-phpstan.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-phpstan.yml b/.github/workflows/test-phpstan.yml index a8e6eaefcb49..360b403ac923 100644 --- a/.github/workflows/test-phpstan.yml +++ b/.github/workflows/test-phpstan.yml @@ -10,6 +10,7 @@ on: paths: - 'app/**.php' - 'system/**.php' + - 'tests/**.php' - 'utils/**.php' - composer.json - phpstan.neon.dist @@ -23,6 +24,7 @@ on: paths: - 'app/**.php' - 'system/**.php' + - 'tests/**.php' - 'utils/**.php' - composer.json - phpstan.neon.dist From cfa7878089f0984dce127d34505b1da65ec6b626 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 6 May 2024 19:08:15 +0900 Subject: [PATCH 104/220] chore: vendor/bin/phpstan analyze --generate-baseline phpstan-baseline.php --- phpstan-baseline.php | 63 ++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index fc9b102f8b3f..358e9633dbe0 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1,5 +1,6 @@ '#^PHPDoc type array\\\\>\\> of property Config\\\\Filters\\:\\:\\$filters is not the same as PHPDoc type array of overridden property CodeIgniter\\\\Config\\\\Filters\\:\\:\\$filters\\.$#', 'count' => 1, @@ -10216,12 +10217,12 @@ 'path' => __DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\AutoReview\\\\FrameworkCodeTest\\:\\:provideEachTestClassHasCorrectGroupAnnotation\\(\\) return type has no value type specified in iterable type iterable\\.$#', + 'message' => '#^Method CodeIgniter\\\\AutoReview\\\\FrameworkCodeTest\\:\\:provideEachTestClassHasCorrectGroupAttributeName\\(\\) return type has no value type specified in iterable type iterable\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\AutoReview\\\\FrameworkCodeTest\\:\\:\\$recognizedGroupAnnotations type has no value type specified in iterable type array\\.$#', + 'message' => '#^Property CodeIgniter\\\\AutoReview\\\\FrameworkCodeTest\\:\\:\\$recognizedGroupAttributeNames type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/AutoReview/FrameworkCodeTest.php', ]; @@ -10966,7 +10967,7 @@ 'path' => __DIR__ . '/tests/system/Config/FactoriesTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Config/FactoriesTest\\.php\\:88\\:\\:\\$widgets has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Config/FactoriesTest\\.php\\:89\\:\\:\\$widgets has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Config/FactoriesTest.php', ]; @@ -14071,122 +14072,122 @@ 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$_options has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$_options has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$country has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$country has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$created_at has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$created_at has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$deleted has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$deleted has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$email has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$email has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$id has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$id has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$name has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$name has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:197\\:\\:\\$updated_at has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:198\\:\\:\\$updated_at has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$_options has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$_options has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$country has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$country has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$created_at has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$created_at has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$deleted has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$deleted has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$email has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$email has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$id has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$id has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$name has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$name has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:216\\:\\:\\$updated_at has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:217\\:\\:\\$updated_at has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$_options has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$_options has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$country has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$country has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$created_at has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$created_at has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$deleted has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$deleted has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$email has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$email has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$id has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$id has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$name has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$name has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:349\\:\\:\\$updated_at has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/Models/UpdateModelTest\\.php\\:350\\:\\:\\$updated_at has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php', ]; @@ -15901,7 +15902,7 @@ 'path' => __DIR__ . '/tests/system/View/ParserTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method class@anonymous/tests/system/View/ParserTest\\.php\\:339\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#', + 'message' => '#^Method class@anonymous/tests/system/View/ParserTest\\.php\\:340\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/View/ParserTest.php', ]; @@ -15916,17 +15917,17 @@ 'path' => __DIR__ . '/tests/system/View/ParserTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:339\\:\\:\\$bar has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:340\\:\\:\\$bar has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/View/ParserTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:339\\:\\:\\$foo has no type specified\\.$#', + 'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:340\\:\\:\\$foo has no type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/View/ParserTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:369\\:\\:\\$attributes type has no value type specified in iterable type array\\.$#', + 'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:370\\:\\:\\$attributes type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/View/ParserTest.php', ]; From 2f9f9d69a09154d7351ce780a9b246b9f5f43069 Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 6 May 2024 13:15:55 +0200 Subject: [PATCH 105/220] docs: Small typo in libraries/file_collections.rst Small typo in libraries/file_collections.rst --- user_guide_src/source/libraries/file_collections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/file_collections.rst b/user_guide_src/source/libraries/file_collections.rst index 4b54f0ab07a8..a60784d32372 100644 --- a/user_guide_src/source/libraries/file_collections.rst +++ b/user_guide_src/source/libraries/file_collections.rst @@ -13,7 +13,7 @@ locating and working with groups of files across the filesystem. Basic Usage *********** -At its most basic, ``FileCollection`` is an index +At its most basic, ``FileCollection`` is an array of files you set or build: .. literalinclude:: files/011.php From c1395479e88969f0e1e809ec058438d37764546b Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 6 May 2024 13:29:56 +0200 Subject: [PATCH 106/220] docs: Small typos in libraries/honeypot.rst Small typos in libraries/honeypot.rst --- user_guide_src/source/libraries/honeypot.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/honeypot.rst b/user_guide_src/source/libraries/honeypot.rst index e034e0dc08db..c6ebf14af0ce 100644 --- a/user_guide_src/source/libraries/honeypot.rst +++ b/user_guide_src/source/libraries/honeypot.rst @@ -3,7 +3,7 @@ Honeypot Class ############## The Honeypot Class makes it possible to determine when a Bot makes a request to a CodeIgniter4 application, -if it's enabled in **app\Config\Filters.php** file. This is done by attaching form fields to any form, +if it's enabled in **app/Config/Filters.php** file. This is done by attaching form fields to any form, and this form field is hidden from a human but accessible to a Bot. When data is entered into the field, it's assumed the request is coming from a Bot, and you can throw a ``HoneypotException``. @@ -22,7 +22,7 @@ from the ``$globals`` array, like: A sample Honeypot filter is bundled, as **system/Filters/Honeypot.php**. If it is not suitable, make your own at **app/Filters/Honeypot.php**, -and modify the ``$aliases`` in the configuration appropriately. +and modify the ``$aliases`` in **app/Config/Filters.php** appropriately. ******************** Customizing Honeypot @@ -37,4 +37,4 @@ Honeypot can be customized. The fields below can be set either in * ``$template`` - form field template used for the honeypot; default is ``''`` * ``$container`` - container tag for the template; default is ``'
{template}
'``. If you enables CSP, you can remove ``style="display:none"``. -* ``$containerId`` - [Since v4.3.0] this setting is used only when you enables CSP. You can change the id attribute for the container tag; default is ``'hpc'`` +* ``$containerId`` - [Since v4.3.0] this setting is used only when you enable CSP. You can change the id attribute for the container tag; default is ``'hpc'`` From 737846eea1c4c6198478df2cf784a4dd1fe67c47 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Wed, 8 May 2024 00:05:19 +0800 Subject: [PATCH 107/220] enable `ordered_attributes` --- .php-cs-fixer.dist.php | 1 + .php-cs-fixer.no-header.php | 1 + .php-cs-fixer.tests.php | 1 + .php-cs-fixer.user-guide.php | 1 + 4 files changed, 4 insertions(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 478b266693e8..4ce5e25fbc1d 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -44,6 +44,7 @@ $overrides = [ // for updating to coding-standard 'modernize_strpos' => true, + 'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'], 'php_unit_attributes' => true, ]; diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index f46f526120e0..e7d9647e317e 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -32,6 +32,7 @@ $overrides = [ // for updating to coding-standard 'modernize_strpos' => true, + 'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'], 'php_unit_attributes' => true, ]; diff --git a/.php-cs-fixer.tests.php b/.php-cs-fixer.tests.php index 404959f26fce..1b4bfd71e30d 100644 --- a/.php-cs-fixer.tests.php +++ b/.php-cs-fixer.tests.php @@ -37,6 +37,7 @@ 'void_return' => true, // for updating to coding-standard 'modernize_strpos' => true, + 'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'], 'php_unit_attributes' => true, ]; diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index 5356cef28d93..3be7cd45c708 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -41,6 +41,7 @@ ], // for updating to coding-standard 'modernize_strpos' => true, + 'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'], 'php_unit_attributes' => true, ]; From 13015dbb94da4e8b0732c89ee55906dd7f7f78db Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Wed, 8 May 2024 00:05:51 +0800 Subject: [PATCH 108/220] run `composer cs-fix` --- tests/system/Autoloader/AutoloaderTest.php | 2 +- tests/system/CodeIgniterTest.php | 2 +- tests/system/Commands/GenerateKeyTest.php | 2 +- tests/system/CommonFunctionsSendTest.php | 2 +- tests/system/CommonFunctionsTest.php | 18 +++--- tests/system/CommonHelperTest.php | 2 +- tests/system/Config/BaseConfigTest.php | 6 +- tests/system/Config/DotEnvTest.php | 4 +- tests/system/Config/ServicesTest.php | 14 ++--- tests/system/DebugTraceableTraitTest.php | 2 +- tests/system/Events/EventsTest.php | 2 +- tests/system/Filters/HoneypotTest.php | 4 +- tests/system/Filters/InvalidCharsTest.php | 2 +- .../system/HTTP/ContentSecurityPolicyTest.php | 62 +++++++++---------- tests/system/HTTP/DownloadResponseTest.php | 2 +- tests/system/HTTP/IncomingRequestTest.php | 2 +- tests/system/HTTP/RedirectResponseTest.php | 14 ++--- tests/system/HTTP/ResponseSendTest.php | 6 +- tests/system/Helpers/FormHelperTest.php | 6 +- .../system/Helpers/URLHelper/MiscUrlTest.php | 8 +-- .../system/RESTful/ResourceControllerTest.php | 4 +- .../system/RESTful/ResourcePresenterTest.php | 4 +- .../SecurityCSRFSessionRandomizeTokenTest.php | 4 +- .../Security/SecurityCSRFSessionTest.php | 4 +- tests/system/Session/SessionTest.php | 4 +- tests/system/Test/ControllerTestTraitTest.php | 4 +- tests/system/Test/TestCaseEmissionsTest.php | 4 +- tests/system/View/ParserPluginTest.php | 4 +- 28 files changed, 97 insertions(+), 97 deletions(-) diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index 647b041d5f78..04dfe04e991f 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -392,8 +392,8 @@ public function testAutoloaderLoadsNonClassFiles(): void $loader->unregister(); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testLoadHelpers(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index b3908b462777..a550e098e9b0 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -40,9 +40,9 @@ /** * @internal */ -#[RunTestsInSeparateProcesses] #[BackupGlobals(true)] #[Group('Others')] +#[RunTestsInSeparateProcesses] final class CodeIgniterTest extends CIUnitTestCase { private CodeIgniter $codeigniter; diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php index 85bd0f9078c2..289a294f5d0c 100644 --- a/tests/system/Commands/GenerateKeyTest.php +++ b/tests/system/Commands/GenerateKeyTest.php @@ -88,8 +88,8 @@ public function testGenerateKeyShowsEncodedKey(): void $this->assertStringContainsString('hex2bin:', $this->getBuffer()); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testGenerateKeyCreatesNewKey(): void { command('key:generate'); diff --git a/tests/system/CommonFunctionsSendTest.php b/tests/system/CommonFunctionsSendTest.php index 8af14200ea7f..46871c6284df 100644 --- a/tests/system/CommonFunctionsSendTest.php +++ b/tests/system/CommonFunctionsSendTest.php @@ -39,8 +39,8 @@ protected function setUp(): void * Make sure cookies are set by RedirectResponse this way * See https://github.com/codeigniter4/CodeIgniter4/issues/1393 */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testRedirectResponseCookiesSent(): void { $loginTime = time(); diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index 226f9f79c776..fbbece86ddd1 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -272,8 +272,8 @@ public function testEscapeRecursiveArrayRaw(): void $this->assertSame($data, esc($data, 'raw')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSessionInstance(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -285,8 +285,8 @@ public function testSessionInstance(): void $this->assertInstanceOf(Session::class, session()); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSessionVariable(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -300,8 +300,8 @@ public function testSessionVariable(): void $this->assertSame('Hi there', session('notbogus')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSessionVariableNotThere(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -426,8 +426,8 @@ public function testModelExistsAbsoluteClassname(): void $this->assertInstanceOf(JobModel::class, model(JobModel::class)); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testOldInput(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -463,8 +463,8 @@ public function testOldInput(): void $this->assertSame('fritz', old('zibble')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testOldInputSerializeData(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -501,8 +501,8 @@ public function testOldInputSerializeData(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492 */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testOldInputArray(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -620,8 +620,8 @@ public function testRedirectResponseCookies1(): void $this->assertTrue($answer1->hasCookie('login_time')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testTrace(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -645,8 +645,8 @@ public function testViewNotSaveData(): void $this->assertStringContainsString('

is_not

', view('\Tests\Support\View\Views\simples')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testForceHttpsNullRequestAndResponse(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -761,8 +761,8 @@ public function testDWithCSP(): void Kint::$cli_detection = $cliDetection; } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testTraceWithCSP(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/CommonHelperTest.php b/tests/system/CommonHelperTest.php index 819b5c582d4c..90b417d41639 100644 --- a/tests/system/CommonHelperTest.php +++ b/tests/system/CommonHelperTest.php @@ -25,8 +25,8 @@ /** * @internal */ -#[Group('Others')] #[CoversFunction('helper')] +#[Group('Others')] final class CommonHelperTest extends CIUnitTestCase { private array $dummyHelpers = [ diff --git a/tests/system/Config/BaseConfigTest.php b/tests/system/Config/BaseConfigTest.php index 68776b671fda..c8e27dce75ef 100644 --- a/tests/system/Config/BaseConfigTest.php +++ b/tests/system/Config/BaseConfigTest.php @@ -101,8 +101,8 @@ public function testUseDefaultValueTypeStringValue(): void $this->assertSame('123456', $config->password); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testServerValues(): void { $_SERVER = [ @@ -195,8 +195,8 @@ public function testSetsDefaultValues(): void $this->assertSame('bar', $config->second); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void { $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); @@ -208,8 +208,8 @@ public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void $this->assertSame('OpenSSL', $config->driver); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSetDefaultValuesEncryptionUsingBase64(): void { $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); diff --git a/tests/system/Config/DotEnvTest.php b/tests/system/Config/DotEnvTest.php index 8ffc4c5dafbc..db54d2663820 100644 --- a/tests/system/Config/DotEnvTest.php +++ b/tests/system/Config/DotEnvTest.php @@ -89,8 +89,8 @@ public static function provideLoadsVars(): iterable ]; } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testLoadsHex2Bin(): void { $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); @@ -101,8 +101,8 @@ public function testLoadsHex2Bin(): void $this->assertSame('OpenSSL', getenv('encryption.driver')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testLoadsBase64(): void { $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index 17b97dd2e259..7825687841c7 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -243,24 +243,24 @@ public function testNewViewcell(): void $this->assertInstanceOf(Cell::class, $actual); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testNewSession(): void { $actual = Services::session(); $this->assertInstanceOf(Session::class, $actual); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testNewSessionWithNullConfig(): void { $actual = Services::session(null, false); $this->assertInstanceOf(Session::class, $actual); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testCallStatic(): void { // __callStatic should kick in for this but fail @@ -271,8 +271,8 @@ public function testCallStatic(): void $this->assertInstanceOf(Session::class, $actual); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testCallStaticDirectly(): void { // $actual = \CodeIgniter\Config\Services::SeSsIoN(null, false); // original @@ -280,8 +280,8 @@ public function testCallStaticDirectly(): void $this->assertInstanceOf(Session::class, $actual); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testMockInjection(): void { Services::injectMock('response', new MockResponse(new App())); @@ -300,8 +300,8 @@ public function testMockInjection(): void $this->assertSame($response, $response3); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testReset(): void { Services::injectMock('response', new MockResponse(new App())); @@ -317,8 +317,8 @@ public function testReset(): void $this->assertNotSame($response2, $response); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testResetSingle(): void { Services::injectMock('response', new MockResponse(new App())); diff --git a/tests/system/DebugTraceableTraitTest.php b/tests/system/DebugTraceableTraitTest.php index bd41fda23e33..26161d8de683 100644 --- a/tests/system/DebugTraceableTraitTest.php +++ b/tests/system/DebugTraceableTraitTest.php @@ -22,8 +22,8 @@ /** * @internal */ -#[Group('Others')] #[CoversClass(DebugTraceableTrait::class)] +#[Group('Others')] final class DebugTraceableTraitTest extends CIUnitTestCase { public function testFactoryInstanceReturnsWhereItIsRaised(): void diff --git a/tests/system/Events/EventsTest.php b/tests/system/Events/EventsTest.php index 8ea4fc54f4ce..a2de4fb2f432 100644 --- a/tests/system/Events/EventsTest.php +++ b/tests/system/Events/EventsTest.php @@ -49,8 +49,8 @@ protected function tearDown(): void Events::simulate(false); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testInitialize(): void { /** diff --git a/tests/system/Filters/HoneypotTest.php b/tests/system/Filters/HoneypotTest.php index ee7b37a8df73..50909abe5a3e 100644 --- a/tests/system/Filters/HoneypotTest.php +++ b/tests/system/Filters/HoneypotTest.php @@ -94,8 +94,8 @@ public function testBeforeClean(): void $this->assertSame($expected, $request); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testAfter(): void { $this->config->globals = [ @@ -114,8 +114,8 @@ public function testAfter(): void $this->assertStringContainsString($this->honey->name, $this->response->getBody()); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testAfterNotApplicable(): void { $this->config->globals = [ diff --git a/tests/system/Filters/InvalidCharsTest.php b/tests/system/Filters/InvalidCharsTest.php index ea2ee644b135..a0546ef586bc 100644 --- a/tests/system/Filters/InvalidCharsTest.php +++ b/tests/system/Filters/InvalidCharsTest.php @@ -112,8 +112,8 @@ public function testBeforeInvalidControlCharCausesException(): void $this->invalidChars->before($this->request); } - #[DoesNotPerformAssertions] #[DataProvider('provideCheckControlStringWithLineBreakAndTabReturnsTheString')] + #[DoesNotPerformAssertions] public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $input): void { $_GET['val'] = $input; diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index 50d93e8c0412..31c915b09b1b 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -72,8 +72,8 @@ protected function work(string $parm = 'Hello') return $buffer; } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testExistence(): void { $this->prepare(); @@ -82,8 +82,8 @@ public function testExistence(): void $this->assertHeaderEmitted('Content-Security-Policy:'); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testReportOnly(): void { $this->prepare(); @@ -93,8 +93,8 @@ public function testReportOnly(): void $this->assertHeaderEmitted('Content-Security-Policy:'); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testDefaults(): void { $this->prepare(); @@ -110,8 +110,8 @@ public function testDefaults(): void $this->assertStringContainsString("style-src 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testChildSrc(): void { $this->prepare(); @@ -125,8 +125,8 @@ public function testChildSrc(): void $this->assertStringContainsString("child-src 'self' good.com;", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testConnectSrc(): void { $this->prepare(); @@ -139,8 +139,8 @@ public function testConnectSrc(): void $this->assertStringContainsString("connect-src 'self' iffy.com maybe.com;", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testFontSrc(): void { $this->prepare(); @@ -155,8 +155,8 @@ public function testFontSrc(): void $this->assertStringContainsString('font-src fontsrus.com;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testFormAction(): void { $this->prepare(); @@ -171,8 +171,8 @@ public function testFormAction(): void $this->assertStringNotContainsString("form-action 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testFrameAncestor(): void { $this->prepare(); @@ -186,8 +186,8 @@ public function testFrameAncestor(): void $this->assertStringContainsString("frame-ancestors 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testFrameSrc(): void { $this->prepare(); @@ -201,8 +201,8 @@ public function testFrameSrc(): void $this->assertStringContainsString("frame-src 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testImageSrc(): void { $this->prepare(); @@ -216,8 +216,8 @@ public function testImageSrc(): void $this->assertStringContainsString("img-src 'self' cdn.cloudy.com;", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testMediaSrc(): void { $this->prepare(); @@ -231,8 +231,8 @@ public function testMediaSrc(): void $this->assertStringContainsString("media-src 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testManifestSrc(): void { $this->prepare(); @@ -246,8 +246,8 @@ public function testManifestSrc(): void $this->assertStringContainsString('manifest-src cdn.cloudy.com;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testPluginType(): void { $this->prepare(); @@ -261,8 +261,8 @@ public function testPluginType(): void $this->assertStringContainsString("plugin-types 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testPluginArray(): void { $this->prepare(); @@ -274,8 +274,8 @@ public function testPluginArray(): void $this->assertStringContainsString('plugin-types application/x-shockwave-flash application/wacky-hacky;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testObjectSrc(): void { $this->prepare(); @@ -289,8 +289,8 @@ public function testObjectSrc(): void $this->assertStringContainsString("object-src 'self' cdn.cloudy.com;", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testScriptSrc(): void { $this->prepare(); @@ -304,8 +304,8 @@ public function testScriptSrc(): void $this->assertStringContainsString("script-src 'self' cdn.cloudy.com;", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testStyleSrc(): void { $this->prepare(); @@ -319,8 +319,8 @@ public function testStyleSrc(): void $this->assertStringContainsString("style-src 'self' cdn.cloudy.com;", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testBaseURIDefault(): void { $this->prepare(); @@ -330,8 +330,8 @@ public function testBaseURIDefault(): void $this->assertStringContainsString("base-uri 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testBaseURI(): void { $this->prepare(); @@ -342,8 +342,8 @@ public function testBaseURI(): void $this->assertStringContainsString('base-uri example.com;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testBaseURIRich(): void { $this->prepare(); @@ -354,8 +354,8 @@ public function testBaseURIRich(): void $this->assertStringContainsString("base-uri 'self' example.com;", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testDefaultSrc(): void { $this->prepare(); @@ -368,8 +368,8 @@ public function testDefaultSrc(): void $this->assertStringContainsString('default-src iffy.com;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testReportURI(): void { $this->prepare(); @@ -381,8 +381,8 @@ public function testReportURI(): void $this->assertStringContainsString('report-uri http://example.com/csptracker;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSandboxFlags(): void { $this->prepare(); @@ -395,8 +395,8 @@ public function testSandboxFlags(): void $this->assertStringContainsString('sandbox allow-popups allow-top-navigation;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testUpgradeInsecureRequests(): void { $this->prepare(); @@ -407,8 +407,8 @@ public function testUpgradeInsecureRequests(): void $this->assertStringContainsString('upgrade-insecure-requests;', $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testBodyEmpty(): void { $this->prepare(); @@ -418,8 +418,8 @@ public function testBodyEmpty(): void $this->assertSame($body, $this->response->getBody()); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testBodyScriptNonce(): void { $this->prepare(); @@ -493,8 +493,8 @@ public function testBodyStyleNonceDisableAutoNonce(): void $result->assertHeader('Content-Security-Policy'); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testBodyStyleNonce(): void { $this->prepare(); @@ -530,8 +530,8 @@ public function testBodyStyleNonceCustomStyleTag(): void $this->assertStringContainsString('nonce=', $response->getBody()); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHeaderWrongCaseNotFound(): void { $this->prepare(); @@ -541,8 +541,8 @@ public function testHeaderWrongCaseNotFound(): void $this->assertNull($result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHeaderIgnoreCase(): void { $this->prepare(); @@ -552,8 +552,8 @@ public function testHeaderIgnoreCase(): void $this->assertStringContainsString("base-uri 'self';", $result); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testCSPDisabled(): void { $this->prepare(false); @@ -581,8 +581,8 @@ public function testGetStyleNonce(): void $this->assertMatchesRegularExpression('/\A[0-9a-z]{24}\z/', $nonce); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHeaderScriptNonceEmittedOnceGetScriptNonceCalled(): void { $this->prepare(); diff --git a/tests/system/HTTP/DownloadResponseTest.php b/tests/system/HTTP/DownloadResponseTest.php index 20d9d1f39784..2f27bc4651ea 100644 --- a/tests/system/HTTP/DownloadResponseTest.php +++ b/tests/system/HTTP/DownloadResponseTest.php @@ -319,8 +319,8 @@ public function testPretendOutput(): void $this->assertSame(file_get_contents(__FILE__), $actual); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testRealOutput(): void { $response = new DownloadResponse('unit-test.php', false); diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index eb15b2c37c91..f76ea4a0c7cf 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -148,8 +148,8 @@ public function testCanGetOldInputArrayWithSESSION(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492 */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testCanGetOldInputArrayWithSessionService(): void { $locations = [ diff --git a/tests/system/HTTP/RedirectResponseTest.php b/tests/system/HTTP/RedirectResponseTest.php index b1dc20121903..a800ce0afb2b 100644 --- a/tests/system/HTTP/RedirectResponseTest.php +++ b/tests/system/HTTP/RedirectResponseTest.php @@ -131,8 +131,8 @@ public function testRedirectRelativeConvertsToFullURI(): void $this->assertSame('http://example.com/index.php/foo', $response->getHeaderLine('Location')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testWithInput(): void { $_SESSION = []; @@ -149,8 +149,8 @@ public function testWithInput(): void $this->assertSame('baz', $_SESSION['_ci_old_input']['post']['bar']); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testWithValidationErrors(): void { $_SESSION = []; @@ -167,8 +167,8 @@ public function testWithValidationErrors(): void $this->assertArrayHasKey('_ci_validation_errors', $_SESSION); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testWith(): void { $_SESSION = []; @@ -181,8 +181,8 @@ public function testWith(): void $this->assertArrayHasKey('foo', $_SESSION); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testRedirectBack(): void { $_SERVER['HTTP_REFERER'] = 'http://somewhere.com'; @@ -196,8 +196,8 @@ public function testRedirectBack(): void $this->assertSame('http://somewhere.com', $returned->header('location')->getValue()); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testRedirectBackMissing(): void { $_SESSION = []; @@ -212,8 +212,8 @@ public function testRedirectBackMissing(): void /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/2119 */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testRedirectRouteBaseUrl(): void { $config = new App(); @@ -249,8 +249,8 @@ public function testWithCookies(): void $this->assertTrue($response->hasCookie('foo', 'bar')); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testWithCookiesWithEmptyCookies(): void { $_SESSION = []; diff --git a/tests/system/HTTP/ResponseSendTest.php b/tests/system/HTTP/ResponseSendTest.php index cd78155bb656..d910b2de5c29 100644 --- a/tests/system/HTTP/ResponseSendTest.php +++ b/tests/system/HTTP/ResponseSendTest.php @@ -45,8 +45,8 @@ final class ResponseSendTest extends CIUnitTestCase * The tests includes a basic sanity check, to make sure that * the body we thought would be sent actually was. */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHeadersMissingDate(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -81,8 +81,8 @@ public function testHeadersMissingDate(): void * This test does not test that CSP is handled properly - * it makes sure that sending gives CSP a chance to do its thing. */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHeadersWithCSP(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -120,8 +120,8 @@ public function testHeadersWithCSP(): void * * @see https://github.com/codeigniter4/CodeIgniter4/issues/1393 */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testRedirectResponseCookies(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php index a74582b67ebf..35ed834a174c 100644 --- a/tests/system/Helpers/FormHelperTest.php +++ b/tests/system/Helpers/FormHelperTest.php @@ -955,8 +955,8 @@ public function testSetCheckboxWithUnchecked(): void ); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSetRadioFromSessionOldInput(): void { $_SESSION = [ @@ -973,8 +973,8 @@ public function testSetRadioFromSessionOldInput(): void unset($_SESSION['_ci_old_input']); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSetRadioFromPost(): void { $_POST['bar'] = 'baz'; @@ -984,8 +984,8 @@ public function testSetRadioFromPost(): void $this->assertSame('', set_radio('bar', 'boop', true)); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testSetRadioFromPostWithValueZero(): void { $_POST['bar'] = '0'; diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index 87c6a3940208..d38db01c56bf 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -58,9 +58,9 @@ protected function tearDown(): void $_SERVER = []; } - #[RunInSeparateProcess] - #[PreserveGlobalState(false)] #[Group('SeparateProcess')] + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testPreviousURLUsesSessionFirst(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -93,9 +93,9 @@ private function createRequest(string $uri): void Factories::injectMock('config', 'App', $this->config); } - #[RunInSeparateProcess] - #[PreserveGlobalState(false)] #[Group('SeparateProcess')] + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testPreviousURLUsesRefererIfNeeded(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/RESTful/ResourceControllerTest.php b/tests/system/RESTful/ResourceControllerTest.php index dcf59b1c3c19..000abee6e317 100644 --- a/tests/system/RESTful/ResourceControllerTest.php +++ b/tests/system/RESTful/ResourceControllerTest.php @@ -42,9 +42,9 @@ * * @internal */ -#[RunTestsInSeparateProcesses] -#[PreserveGlobalState(false)] #[Group('SeparateProcess')] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] final class ResourceControllerTest extends CIUnitTestCase { private CodeIgniter $codeigniter; diff --git a/tests/system/RESTful/ResourcePresenterTest.php b/tests/system/RESTful/ResourcePresenterTest.php index 42772edd09a7..5d98dee4e583 100644 --- a/tests/system/RESTful/ResourcePresenterTest.php +++ b/tests/system/RESTful/ResourcePresenterTest.php @@ -36,9 +36,9 @@ * * @internal */ -#[RunTestsInSeparateProcesses] -#[PreserveGlobalState(false)] #[Group('SeparateProcess')] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] final class ResourcePresenterTest extends CIUnitTestCase { private CodeIgniter $codeigniter; diff --git a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php index d49973488b8e..7e8f753d08e0 100644 --- a/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php +++ b/tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php @@ -40,9 +40,9 @@ /** * @internal */ -#[RunTestsInSeparateProcesses] -#[PreserveGlobalState(false)] #[Group('SeparateProcess')] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] final class SecurityCSRFSessionRandomizeTokenTest extends CIUnitTestCase { /** diff --git a/tests/system/Security/SecurityCSRFSessionTest.php b/tests/system/Security/SecurityCSRFSessionTest.php index 501967c0c28e..771193bc3171 100644 --- a/tests/system/Security/SecurityCSRFSessionTest.php +++ b/tests/system/Security/SecurityCSRFSessionTest.php @@ -38,9 +38,9 @@ /** * @internal */ -#[RunTestsInSeparateProcesses] -#[PreserveGlobalState(false)] #[Group('SeparateProcess')] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] final class SecurityCSRFSessionTest extends CIUnitTestCase { /** diff --git a/tests/system/Session/SessionTest.php b/tests/system/Session/SessionTest.php index 39479d03f21d..9faadb66b219 100644 --- a/tests/system/Session/SessionTest.php +++ b/tests/system/Session/SessionTest.php @@ -29,9 +29,9 @@ /** * @internal */ -#[RunTestsInSeparateProcesses] -#[PreserveGlobalState(false)] #[Group('SeparateProcess')] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] final class SessionTest extends CIUnitTestCase { protected function setUp(): void diff --git a/tests/system/Test/ControllerTestTraitTest.php b/tests/system/Test/ControllerTestTraitTest.php index 8230dd9d6248..8708bcce2008 100644 --- a/tests/system/Test/ControllerTestTraitTest.php +++ b/tests/system/Test/ControllerTestTraitTest.php @@ -32,9 +32,9 @@ * * @internal */ -#[RunTestsInSeparateProcesses] -#[PreserveGlobalState(false)] #[Group('SeparateProcess')] +#[PreserveGlobalState(false)] +#[RunTestsInSeparateProcesses] final class ControllerTestTraitTest extends CIUnitTestCase { use ControllerTestTrait; diff --git a/tests/system/Test/TestCaseEmissionsTest.php b/tests/system/Test/TestCaseEmissionsTest.php index 83f695d8302e..e46a4bf5581d 100644 --- a/tests/system/Test/TestCaseEmissionsTest.php +++ b/tests/system/Test/TestCaseEmissionsTest.php @@ -43,8 +43,8 @@ final class TestCaseEmissionsTest extends CIUnitTestCase * The tests includes a basic sanity check, to make sure that * the body we thought would be sent actually was. */ - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHeadersEmitted(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. @@ -73,8 +73,8 @@ public function testHeadersEmitted(): void $this->assertHeaderEmitted('set-cookie: FOO=bar', true); } - #[RunInSeparateProcess] #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testHeadersNotEmitted(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. diff --git a/tests/system/View/ParserPluginTest.php b/tests/system/View/ParserPluginTest.php index 31b6ebba5b48..e37aab0e2309 100644 --- a/tests/system/View/ParserPluginTest.php +++ b/tests/system/View/ParserPluginTest.php @@ -46,9 +46,9 @@ public function testCurrentURL(): void $this->assertSame(current_url(), $this->parser->renderString($template)); } - #[RunInSeparateProcess] - #[PreserveGlobalState(false)] #[Group('SeparateProcess')] + #[PreserveGlobalState(false)] + #[RunInSeparateProcess] public function testPreviousURL(): void { // Workaround for errors on PHPUnit 10 and PHP 8.3. From e132901016f90ecfb52fc3b7b891bc340639876b Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 08:55:57 +0900 Subject: [PATCH 109/220] chore: remove sqlsrv ext version Use the latest. --- .github/workflows/test-phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index afc6d56ace2c..ba566ce5c9d1 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -114,7 +114,7 @@ jobs: enable-artifact-upload: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }} enable-coverage: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }} enable-profiling: ${{ matrix.php-version == needs.coverage-php-version.outputs.version }} - extra-extensions: mysqli, oci8, pgsql, sqlsrv-5.10.1, sqlite3 + extra-extensions: mysqli, oci8, pgsql, sqlsrv, sqlite3 extra-composer-options: ${{ matrix.composer-option }} separate-process-tests: From be71fbb726d67213fd3f51e7733d48a7ead0600e Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 08:56:38 +0900 Subject: [PATCH 110/220] chore: add db extentions --- .github/workflows/test-psalm.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-psalm.yml b/.github/workflows/test-psalm.yml index 98ca5c44c5b3..a623109fbb15 100644 --- a/.github/workflows/test-psalm.yml +++ b/.github/workflows/test-psalm.yml @@ -34,8 +34,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.1' - tools: phpstan, phpunit - extensions: intl, json, mbstring, xml, oci8 + extensions: intl, json, mbstring, xml, mysqli, oci8, pgsql, sqlsrv, sqlite3 coverage: none env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7485e25ec1f9aa61c8b61f136c41891abbefa6c5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:01:02 +0900 Subject: [PATCH 111/220] docs: update comment --- app/Config/Exceptions.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Config/Exceptions.php b/app/Config/Exceptions.php index c240675efb37..4e3396346b80 100644 --- a/app/Config/Exceptions.php +++ b/app/Config/Exceptions.php @@ -60,12 +60,10 @@ class Exceptions extends BaseConfig /** * -------------------------------------------------------------------------- - * LOG DEPRECATIONS INSTEAD OF THROWING? + * WHETHER TO THROW AN EXCEPTION ON DEPRECATED ERRORS * -------------------------------------------------------------------------- - * By default, CodeIgniter converts deprecations into exceptions. Also, - * starting in PHP 8.1 will cause a lot of deprecated usage warnings. - * Use this option to temporarily cease the warnings and instead log those. - * This option also works for user deprecations. + * If set to `true`, DEPRECATED errors are only logged and no exceptions are + * thrown. This option also works for user deprecations. */ public bool $logDeprecations = true; From da1203aa007563d2d3f50750705e71d1629a6d23 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:01:31 +0900 Subject: [PATCH 112/220] docs: update "Logging Deprecation Warnings" It was a bit misleading. Now by default, CI4 does not throw Exceptions for deprecation errors. --- user_guide_src/source/general/errors.rst | 24 ++++++++++++++++---- user_guide_src/source/general/errors/012.php | 7 +++--- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 2b6eafce8c33..061676aff050 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -94,12 +94,26 @@ Logging Deprecation Warnings .. versionadded:: 4.3.0 -By default, all errors reported by ``error_reporting()`` will be thrown as an ``ErrorException`` object. These -include both ``E_DEPRECATED`` and ``E_USER_DEPRECATED`` errors. With the surge in use of PHP 8.1+, many users -may see exceptions thrown for `passing null to non-nullable arguments of internal functions `_. -To ease the migration to PHP 8.1, you can instruct CodeIgniter to log the deprecations instead of throwing them. +Prior to v4.3.0, all errors reported by ``error_reporting()`` will be thrown as +an ``ErrorException`` object. -First, make sure your copy of ``Config\Exceptions`` is updated with the two new properties and set as follows: +But with the surge in use of PHP 8.1+, many users may see exceptions thrown for +`passing null to non-nullable arguments of internal functions `_. + +To ease the migration to PHP 8.1, starting with v4.3.0, CodeIgniter has the feature +that only logs the deprecation errors (``E_DEPRECATED`` and ``E_USER_DEPRECATED``) +without throwing them as exceptions. + +By default, CodeIgniter will only log deprecations without throwing exceptions in +development environment. In production environment, no logging is done and no +exceptions are thrown. + +Configuration +^^^^^^^^^^^^^ + +The settings for this feature are as follows. +First, make sure your copy of ``Config\Exceptions`` is updated with the two new +properties and set as follows: .. literalinclude:: errors/012.php diff --git a/user_guide_src/source/general/errors/012.php b/user_guide_src/source/general/errors/012.php index 1b773613143c..4c534b21bc1b 100644 --- a/user_guide_src/source/general/errors/012.php +++ b/user_guide_src/source/general/errors/012.php @@ -7,8 +7,9 @@ class Exceptions extends BaseConfig { - // ... other properties - - public bool $logDeprecations = true; + // ... + public bool $logDeprecations = true; // If set to false, an exception will be thrown. + // ... public string $deprecationLogLevel = LogLevel::WARNING; // this should be one of the log levels supported by PSR-3 + // ... } From 185e41bc95e0963c8bd52055827e42e961346620 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:04:27 +0900 Subject: [PATCH 113/220] docs: update comment --- user_guide_src/source/general/errors/012.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/errors/012.php b/user_guide_src/source/general/errors/012.php index 4c534b21bc1b..2c81e8784757 100644 --- a/user_guide_src/source/general/errors/012.php +++ b/user_guide_src/source/general/errors/012.php @@ -10,6 +10,6 @@ class Exceptions extends BaseConfig // ... public bool $logDeprecations = true; // If set to false, an exception will be thrown. // ... - public string $deprecationLogLevel = LogLevel::WARNING; // this should be one of the log levels supported by PSR-3 + public string $deprecationLogLevel = LogLevel::WARNING; // This should be one of the log levels supported by PSR-3. // ... } From 53fccdc831f3afe7ac9045230f4afb4a611cb256 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:17:03 +0900 Subject: [PATCH 114/220] docs: update sample config --- user_guide_src/source/general/errors/013.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/errors/013.php b/user_guide_src/source/general/errors/013.php index 23352f0ef54e..b099c6d19b3c 100644 --- a/user_guide_src/source/general/errors/013.php +++ b/user_guide_src/source/general/errors/013.php @@ -6,7 +6,8 @@ class Logger extends BaseConfig { - // .. other properties - - public $threshold = 5; // originally 4 but changed to 5 to log the warnings from the deprecations + // ... + // This must contain the log level (5 for LogLevel::WARNING) corresponding to $deprecationLogLevel. + public $threshold = (ENVIRONMENT === 'production') ? 4 : 9; + // ... } From 02c71f9c306e47ac500104b5495f6d86bcd743bf Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:20:10 +0900 Subject: [PATCH 115/220] docs: update description --- user_guide_src/source/general/errors.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 061676aff050..87ce25fb75a8 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -123,7 +123,8 @@ it accordingly. .. literalinclude:: errors/013.php -After that, subsequent deprecations will be logged instead of thrown. +After that, subsequent deprecations will be logged as configured without throwing +as exceptions. This feature also works with user deprecations: From a4e5a8a4d37575a230625a3ac2884d5d18d74a04 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:46:27 +0900 Subject: [PATCH 116/220] docs: add namespace to sample code --- user_guide_src/source/libraries/files/014.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/libraries/files/014.php b/user_guide_src/source/libraries/files/014.php index cbd6f90e5388..fb11f62d31e6 100644 --- a/user_guide_src/source/libraries/files/014.php +++ b/user_guide_src/source/libraries/files/014.php @@ -1,5 +1,7 @@ Date: Wed, 8 May 2024 10:46:54 +0900 Subject: [PATCH 117/220] docs: add empty line --- user_guide_src/source/libraries/file_collections.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/file_collections.rst b/user_guide_src/source/libraries/file_collections.rst index 4b54f0ab07a8..15ff9dc048b5 100644 --- a/user_guide_src/source/libraries/file_collections.rst +++ b/user_guide_src/source/libraries/file_collections.rst @@ -44,7 +44,9 @@ define() ======== Allows child classes to define their own initial files. This method is called by the constructor and allows -predefined collections without having to use their methods. Example: +predefined collections without having to use their methods. + +Example: .. literalinclude:: files/014.php From a0a5c8eb1e1181b3bac120763db0a0c9981798b4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:47:56 +0900 Subject: [PATCH 118/220] docs: improve description --- user_guide_src/source/libraries/file_collections.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/file_collections.rst b/user_guide_src/source/libraries/file_collections.rst index 15ff9dc048b5..25ce4e4c0632 100644 --- a/user_guide_src/source/libraries/file_collections.rst +++ b/user_guide_src/source/libraries/file_collections.rst @@ -50,8 +50,9 @@ Example: .. literalinclude:: files/014.php -Now you may use the ``ConfigCollection`` anywhere in your project to access all App Config files without -having to re-call the collection methods every time. +Now you may use the ``ConfigCollection`` anywhere in your project to access all +PHP files in **app/Config/** without having to re-call the collection methods +every time. set(array $files) ================= From a56b5f38f9033f6e5bfb71aa67aafe05c5869c6e Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:50:14 +0900 Subject: [PATCH 119/220] docs: break long lines --- .../source/libraries/file_collections.rst | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/user_guide_src/source/libraries/file_collections.rst b/user_guide_src/source/libraries/file_collections.rst index 25ce4e4c0632..7ad0eea4cc92 100644 --- a/user_guide_src/source/libraries/file_collections.rst +++ b/user_guide_src/source/libraries/file_collections.rst @@ -2,8 +2,9 @@ File Collections ################ -Working with groups of files can be cumbersome, so the framework supplies the ``FileCollection`` class to facilitate -locating and working with groups of files across the filesystem. +Working with groups of files can be cumbersome, so the framework supplies the +``FileCollection`` class to facilitate locating and working with groups of files +across the filesystem. .. contents:: :local: @@ -18,13 +19,15 @@ of files you set or build: .. literalinclude:: files/011.php -After you have input the files you would like to work with you may remove files or use the filtering commands to remove -or retain files matching a certain regex or glob-style pattern: +After you have input the files you would like to work with you may remove files +or use the filtering commands to remove or retain files matching a certain regex +or glob-style pattern: .. literalinclude:: files/012.php -When your collection is complete, you can use ``get()`` to retrieve the final list of file paths, or take advantage of -``FileCollection`` being countable and iterable to work directly with each ``File``: +When your collection is complete, you can use ``get()`` to retrieve the final +list of file paths, or take advantage of ``FileCollection`` being countable and +iterable to work directly with each ``File``: .. literalinclude:: files/013.php @@ -37,14 +40,16 @@ Starting a Collection __construct(string[] $files = []) ================================= -The constructor accepts an optional array of file paths to use as the initial collection. These are passed to -``add()`` so any files supplied by child classes in the ``$files`` will remain. +The constructor accepts an optional array of file paths to use as the initial +collection. These are passed to ``add()`` so any files supplied by child classes +in the ``$files`` will remain. define() ======== -Allows child classes to define their own initial files. This method is called by the constructor and allows -predefined collections without having to use their methods. +Allows child classes to define their own initial files. This method is called by +the constructor and allows predefined collections without having to use their +methods. Example: @@ -57,8 +62,9 @@ every time. set(array $files) ================= -Sets the list of input files to the provided string array of file paths. This will remove any existing -files from the collection, so ``$collection->set([])`` is essentially a hard reset. +Sets the list of input files to the provided string array of file paths. This +will remove any existing files from the collection, so ``$collection->set([])`` +is essentially a hard reset. *************** Inputting Files @@ -67,13 +73,14 @@ Inputting Files add(string[]|string $paths, bool $recursive = true) =================================================== -Adds all files indicated by the path or array of paths. If the path resolves to a directory then ``$recursive`` -will include sub-directories. +Adds all files indicated by the path or array of paths. If the path resolves to +a directory then ``$recursive`` will include sub-directories. addFile(string $file) / addFiles(array $files) ============================================== -Adds the file or files to the current list of input files. Files are absolute paths to actual files. +Adds the file or files to the current list of input files. Files are absolute +paths to actual files. removeFile(string $file) / removeFiles(array $files) ==================================================== @@ -85,8 +92,8 @@ addDirectory(string $directory, bool $recursive = false) addDirectories(array $directories, bool $recursive = false) =========================================================== -Adds all files from the directory or directories, optionally recursing into sub-directories. Directories are -absolute paths to actual directories. +Adds all files from the directory or directories, optionally recursing into +sub-directories. Directories are absolute paths to actual directories. *************** Filtering Files @@ -97,11 +104,12 @@ removePattern(string $pattern, string $scope = null) retainPattern(string $pattern, string $scope = null) ==================================================== -Filters the current file list through the pattern (and optional scope), removing or retaining matched -files. ``$pattern`` may be a complete regex (like ``'#[A-Za-z]+\.php#'``) or a pseudo-regex similar -to ``glob()`` (like ``*.css``). -If a ``$scope`` is provided then only files in or under that directory will be considered (i.e. files -outside of ``$scope`` are always retained). When no scope is provided then all files are subject. +Filters the current file list through the pattern (and optional scope), removing +or retaining matched files. ``$pattern`` may be a complete regex (like ``'#[A-Za-z]+\.php#'``) +or a pseudo-regex similar to ``glob()`` (like ``*.css``). If a ``$scope`` is +provided then only files in or under that directory will be considered (i.e. files +outside of ``$scope`` are always retained). When no scope is provided then all +files are subject. Examples: @@ -116,4 +124,5 @@ get(): string[] Returns an array of all the loaded input files. -.. note:: ``FileCollection`` is an ``IteratorAggregate`` so you can work with it directly (e.g. ``foreach ($collection as $file)``). +.. note:: ``FileCollection`` is an ``IteratorAggregate`` so you can work with it + directly (e.g. ``foreach ($collection as $file)``). From 3dc1a097ef0662f86fe7379a09d9d5e5781ad786 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:52:02 +0900 Subject: [PATCH 120/220] docs: add empty lines --- .../source/libraries/file_collections.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/file_collections.rst b/user_guide_src/source/libraries/file_collections.rst index 7ad0eea4cc92..a9871f259fa8 100644 --- a/user_guide_src/source/libraries/file_collections.rst +++ b/user_guide_src/source/libraries/file_collections.rst @@ -105,11 +105,14 @@ retainPattern(string $pattern, string $scope = null) ==================================================== Filters the current file list through the pattern (and optional scope), removing -or retaining matched files. ``$pattern`` may be a complete regex (like ``'#[A-Za-z]+\.php#'``) -or a pseudo-regex similar to ``glob()`` (like ``*.css``). If a ``$scope`` is -provided then only files in or under that directory will be considered (i.e. files -outside of ``$scope`` are always retained). When no scope is provided then all -files are subject. +or retaining matched files. + +``$pattern`` may be a complete regex (like ``'#[A-Za-z]+\.php#'``) or a pseudo-regex +similar to ``glob()`` (like ``*.css``). + +If a ``$scope`` is provided then only files in or under that directory will be +considered (i.e. files outside of ``$scope`` are always retained). When no scope +is provided then all files are subject. Examples: From 003a3ed2d555071275673184c0240d0cfccc4ef0 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:53:08 +0900 Subject: [PATCH 121/220] docs: improve code samples --- user_guide_src/source/libraries/file_collections.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/file_collections.rst b/user_guide_src/source/libraries/file_collections.rst index a9871f259fa8..e0050b87e247 100644 --- a/user_guide_src/source/libraries/file_collections.rst +++ b/user_guide_src/source/libraries/file_collections.rst @@ -107,8 +107,8 @@ retainPattern(string $pattern, string $scope = null) Filters the current file list through the pattern (and optional scope), removing or retaining matched files. -``$pattern`` may be a complete regex (like ``'#[A-Za-z]+\.php#'``) or a pseudo-regex -similar to ``glob()`` (like ``*.css``). +``$pattern`` may be a complete regex (like ``'#\A[A-Za-z]+\.php\z#'``) or a +pseudo-regex similar to ``glob()`` (like ``'*.css'``). If a ``$scope`` is provided then only files in or under that directory will be considered (i.e. files outside of ``$scope`` are always retained). When no scope From 0125bc766ee690d6073182ee962708d78dc8fcf6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 10:56:47 +0900 Subject: [PATCH 122/220] docs: improve sample code --- user_guide_src/source/libraries/files/012.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/files/012.php b/user_guide_src/source/libraries/files/012.php index db0f881014c0..b87efe4a692a 100644 --- a/user_guide_src/source/libraries/files/012.php +++ b/user_guide_src/source/libraries/files/012.php @@ -1,6 +1,6 @@ removeFile(APPPATH . 'Filters/DevelopToolbar'); +$files->removeFile(APPPATH . 'Filters/DevelopToolbar.php'); $files->removePattern('#\.gitkeep#'); $files->retainPattern('*.php'); From 460d3dfe3859f4bf85f9d5bcc83b67952b881735 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 11:31:29 +0900 Subject: [PATCH 123/220] test: add test file for testing --- tests/_support/Files/baker/fig_3.php.txt | 0 tests/system/Files/FileCollectionTest.php | 13 +++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 tests/_support/Files/baker/fig_3.php.txt diff --git a/tests/_support/Files/baker/fig_3.php.txt b/tests/_support/Files/baker/fig_3.php.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/system/Files/FileCollectionTest.php b/tests/system/Files/FileCollectionTest.php index 51e8b10e9955..81005356fee3 100644 --- a/tests/system/Files/FileCollectionTest.php +++ b/tests/system/Files/FileCollectionTest.php @@ -175,6 +175,7 @@ public function testAddStringDirectoryRecursive(): void $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $files->add(SUPPORTPATH . 'Files'); @@ -227,6 +228,7 @@ public function testAddArrayRecursive(): void $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', SUPPORTPATH . 'Log/Handlers/TestHandler.php', ]; @@ -392,6 +394,7 @@ public function testAddDirectoryRecursive(): void $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $collection->addDirectory(SUPPORTPATH . 'Files', true); @@ -407,6 +410,7 @@ public function testAddDirectories(): void $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $collection->addDirectories([ @@ -425,6 +429,7 @@ public function testAddDirectoriesRecursive(): void $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', SUPPORTPATH . 'Log/Handlers/TestHandler.php', ]; @@ -471,6 +476,7 @@ public function testRemovePatternPseudo(): void $expected = [ $this->directory . 'apple.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $collection->removePattern('*_*.php'); @@ -485,6 +491,7 @@ public function testRemovePatternScope(): void $expected = [ SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $collection->removePattern('*.php', $this->directory); @@ -512,6 +519,7 @@ public function testRetainPatternRegex(): void $expected = [ $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $collection->retainPattern('#[a-z]+_.*#'); @@ -541,6 +549,7 @@ public function testRetainPatternScope(): void $expected = [ $this->directory . 'fig_3.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $collection->retainPattern('*_?.php', $this->directory); @@ -553,7 +562,7 @@ public function testCount(): void $collection = new FileCollection(); $collection->addDirectory(SUPPORTPATH . 'Files', true); - $this->assertCount(4, $collection); + $this->assertCount(5, $collection); } public function testIterable(): void @@ -568,6 +577,6 @@ public function testIterable(): void $count++; } - $this->assertSame($count, 4); + $this->assertSame($count, 5); } } From 700612c927e2f47faef86f48593b7d902901c75c Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 11:35:12 +0900 Subject: [PATCH 124/220] fix: FileCollection pseudo-regex --- system/Files/FileCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Files/FileCollection.php b/system/Files/FileCollection.php index b9456dcc15ba..f1310795867d 100644 --- a/system/Files/FileCollection.php +++ b/system/Files/FileCollection.php @@ -105,7 +105,7 @@ final protected static function matchFiles(array $files, string $pattern): array ['\#', '\.', '.*', '.'], $pattern ); - $pattern = "#{$pattern}#"; + $pattern = "#\\A{$pattern}\\z#"; } return array_filter($files, static fn ($value) => (bool) preg_match($pattern, basename($value))); From 79e33165bfab4043d3d40e11869189dfe61f313b Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 14:54:36 +0900 Subject: [PATCH 125/220] test: fix model for Model casting --- tests/_support/Models/UserCastsTimestampModel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/_support/Models/UserCastsTimestampModel.php b/tests/_support/Models/UserCastsTimestampModel.php index c19353f01319..30f6b3e6b6f7 100644 --- a/tests/_support/Models/UserCastsTimestampModel.php +++ b/tests/_support/Models/UserCastsTimestampModel.php @@ -28,8 +28,8 @@ class UserCastsTimestampModel extends Model 'id' => 'int', 'name' => 'base64', 'email' => 'json-array', - 'created_at' => 'datetime', - 'updated_at' => 'datetime', + 'created_at' => '?datetime', + 'updated_at' => '?datetime', ]; protected array $castHandlers = [ 'base64' => CastBase64::class, From 79ad7f1f640713d7d65934dd480ad4dabb84cc30 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 14:55:20 +0900 Subject: [PATCH 126/220] fix: InvalidArgumentException Invalid parameter: nullable --- system/DataCaster/DataCaster.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/DataCaster/DataCaster.php b/system/DataCaster/DataCaster.php index 854a0b50b32c..29de3987faa9 100644 --- a/system/DataCaster/DataCaster.php +++ b/system/DataCaster/DataCaster.php @@ -159,7 +159,7 @@ public function castAs(mixed $value, string $field, string $method = 'get'): mix $params = array_map('trim', explode(',', $matches[2])); } - if ($isNullable) { + if ($isNullable && ! $this->strict) { $params[] = 'nullable'; } From 28bb81591be2efc90c839f2618899b3edb51b518 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 15:07:06 +0900 Subject: [PATCH 127/220] test: update other test assertions --- tests/system/Helpers/FilesystemHelperTest.php | 19 ++++++++++++++----- tests/system/Publisher/PublisherInputTest.php | 2 ++ .../system/Publisher/PublisherOutputTest.php | 3 +++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 403cfb14da50..5896552a240b 100644 --- a/tests/system/Helpers/FilesystemHelperTest.php +++ b/tests/system/Helpers/FilesystemHelperTest.php @@ -429,15 +429,24 @@ public function testGetFilenamesWithSymlinks(): void public function testGetDirFileInfo(): void { - $file = SUPPORTPATH . 'Files/baker/banana.php'; - $info = get_file_info($file); + $file1 = SUPPORTPATH . 'Files/baker/banana.php'; + $info1 = get_file_info($file1); + $file2 = SUPPORTPATH . 'Files/baker/fig_3.php.txt'; + $info2 = get_file_info($file2); $expected = [ 'banana.php' => [ 'name' => 'banana.php', - 'server_path' => $file, - 'size' => $info['size'], - 'date' => $info['date'], + 'server_path' => $file1, + 'size' => $info1['size'], + 'date' => $info1['date'], + 'relative_path' => realpath(__DIR__ . '/../../_support/Files/baker'), + ], + 'fig_3.php.txt' => [ + 'name' => 'fig_3.php.txt', + 'server_path' => $file2, + 'size' => $info2['size'], + 'date' => $info2['date'], 'relative_path' => realpath(__DIR__ . '/../../_support/Files/baker'), ], ]; diff --git a/tests/system/Publisher/PublisherInputTest.php b/tests/system/Publisher/PublisherInputTest.php index c2eeb14d13a9..1336137defd4 100644 --- a/tests/system/Publisher/PublisherInputTest.php +++ b/tests/system/Publisher/PublisherInputTest.php @@ -86,6 +86,7 @@ public function testAddPathDirectoryRecursive(): void $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', ]; $publisher->addPath('Files'); @@ -121,6 +122,7 @@ public function testAddPathsRecursive(): void $this->directory . 'fig_3.php', $this->directory . 'prune_ripe.php', SUPPORTPATH . 'Files/baker/banana.php', + SUPPORTPATH . 'Files/baker/fig_3.php.txt', SUPPORTPATH . 'Log/Handlers/TestHandler.php', ]; diff --git a/tests/system/Publisher/PublisherOutputTest.php b/tests/system/Publisher/PublisherOutputTest.php index 1d8c2858d8fb..e03335e86fe6 100644 --- a/tests/system/Publisher/PublisherOutputTest.php +++ b/tests/system/Publisher/PublisherOutputTest.php @@ -161,6 +161,7 @@ public function testMerge(): void $this->root->url() . '/able/fig_3.php', $this->root->url() . '/able/prune_ripe.php', $this->root->url() . '/baker/banana.php', + $this->root->url() . '/baker/fig_3.php.txt', ]; $this->assertFileDoesNotExist($this->root->url() . '/able/fig_3.php'); @@ -183,6 +184,7 @@ public function testMergeReplace(): void $this->root->url() . '/able/fig_3.php', $this->root->url() . '/able/prune_ripe.php', $this->root->url() . '/baker/banana.php', + $this->root->url() . '/baker/fig_3.php.txt', ]; $result = $publisher->addPath('/')->merge(true); @@ -200,6 +202,7 @@ public function testMergeCollides(): void $this->root->url() . '/able/apple.php', $this->root->url() . '/able/prune_ripe.php', $this->root->url() . '/baker/banana.php', + $this->root->url() . '/baker/fig_3.php.txt', ]; mkdir($this->root->url() . '/able/fig_3.php'); From 19694721bc9f957cdfb545b18aaf86d44e03b1ad Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 15:22:10 +0900 Subject: [PATCH 128/220] test: add test cases for finding returns null --- .../system/Models/DataConverterModelTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/system/Models/DataConverterModelTest.php b/tests/system/Models/DataConverterModelTest.php index cd50df0d8b00..4dd6da072f5e 100644 --- a/tests/system/Models/DataConverterModelTest.php +++ b/tests/system/Models/DataConverterModelTest.php @@ -43,6 +43,16 @@ public function testFindAsArray(): void $this->seeInDatabase('user', ['name' => 'Sm9obiBTbWl0aA==']); } + public function testFindAsArrayReturnsNull(): void + { + $this->createModel(UserCastsTimestampModel::class); + $this->db->table('user')->truncate(); + + $user = $this->model->find(1); + + $this->assertNull($user); + } + /** * @return int|string Insert ID */ @@ -102,6 +112,16 @@ public function testFindAllAsArray(): void $this->assertInstanceOf(Time::class, $users[1]['created_at']); } + public function testFindAllAsArrayReturnsNull(): void + { + $this->createModel(UserCastsTimestampModel::class); + $this->db->table('user')->truncate(); + + $users = $this->model->findAll(); + + $this->assertSame([], $users); + } + private function prepareTwoRecords(): void { $this->prepareOneRecord(); @@ -170,6 +190,16 @@ public function testFirstAsArray(): void $this->assertInstanceOf(Time::class, $user['created_at']); } + public function testFirstAsArrayReturnsNull(): void + { + $this->createModel(UserCastsTimestampModel::class); + $this->db->table('user')->truncate(); + + $user = $this->model->first(); + + $this->assertNull($user); + } + public function testFirstAsObject(): void { $this->prepareTwoRecords(); From 5c05447288f7c02a26d306f75c934b0a10ff3ee9 Mon Sep 17 00:00:00 2001 From: Aleksey Grunin <49051631+avegacms@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:19:59 +0600 Subject: [PATCH 129/220] Fix bug #8806 Bug: when the query ($this->first()) result returns NULL we get TypeError --- system/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Model.php b/system/Model.php index b3ecfc653943..c4ca9b6cc6e9 100644 --- a/system/Model.php +++ b/system/Model.php @@ -318,7 +318,7 @@ protected function doFirst() $row = $builder->limit(1, 0)->get()->getFirstRow($this->tempReturnType); - if ($useCast) { + if ($useCast && $row !== null) { $row = $this->convertToReturnType($row, $returnType); $this->tempReturnType = $returnType; From 4639608862523fb2b042ee13d4d54c0eca3b5b10 Mon Sep 17 00:00:00 2001 From: Aleksey Grunin <49051631+avegacms@users.noreply.github.com> Date: Fri, 19 Apr 2024 21:21:27 +0600 Subject: [PATCH 130/220] Update Model.php Fix TypeError error in the methods: doFind and doFirst when using casts --- system/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Model.php b/system/Model.php index c4ca9b6cc6e9..03ca7525ec76 100644 --- a/system/Model.php +++ b/system/Model.php @@ -210,7 +210,7 @@ protected function doFind(bool $singleton, $id = null) $row = $builder->get()->getResult($this->tempReturnType); } - if ($useCast) { + if ($useCast && $row !== null) { $row = $this->convertToReturnType($row, $returnType); $this->tempReturnType = $returnType; From 7eb76047cea048a98ba9168bcbcd67c3e44016a6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 15:35:55 +0900 Subject: [PATCH 131/220] test: sort file info by array key It may fail unless sorting. --- tests/system/Helpers/FilesystemHelperTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/system/Helpers/FilesystemHelperTest.php b/tests/system/Helpers/FilesystemHelperTest.php index 5896552a240b..ad169cf3b58b 100644 --- a/tests/system/Helpers/FilesystemHelperTest.php +++ b/tests/system/Helpers/FilesystemHelperTest.php @@ -451,7 +451,10 @@ public function testGetDirFileInfo(): void ], ]; - $this->assertSame($expected, get_dir_file_info(SUPPORTPATH . 'Files/baker')); + $result = get_dir_file_info(SUPPORTPATH . 'Files/baker'); + ksort($result); + + $this->assertSame($expected, $result); } public function testGetDirFileInfoNested(): void From 573676cc6282c068a0394130f54c521dfafca536 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 17:13:35 +0900 Subject: [PATCH 132/220] test: call PhpStreamWrapper::restore() as soon as possible If it is not called, assertions may not work correctly. --- tests/system/CLI/CLITest.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index fc62e5888e53..2dfe15b20799 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -76,9 +76,9 @@ public function testWaitZero(): void $time = time(); CLI::wait(0); - $this->assertCloseEnough(0, time() - $time); - PhpStreamWrapper::restore(); + + $this->assertCloseEnough(0, time() - $time); } public function testPrompt(): void @@ -90,9 +90,9 @@ public function testPrompt(): void $output = CLI::prompt('What is your favorite color?'); - $this->assertSame($expected, $output); - PhpStreamWrapper::restore(); + + $this->assertSame($expected, $output); } public function testPromptByMultipleKeys(): void @@ -105,14 +105,13 @@ public function testPromptByMultipleKeys(): void $options = ['Playing game', 'Sleep', 'Badminton']; $output = CLI::promptByMultipleKeys('Select your hobbies:', $options); + PhpStreamWrapper::restore(); + $expected = [ 0 => 'Playing game', 1 => 'Sleep', ]; - $this->assertSame($expected, $output); - - PhpStreamWrapper::restore(); } public function testNewLine(): void From 7e918badffcd16ea16b1f2afe15dad6c39b82fa2 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 17:18:16 +0900 Subject: [PATCH 133/220] docs: fix typos in comment --- system/CLI/CLI.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index 865241b75cbf..f6646749f9df 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -343,9 +343,9 @@ public static function promptByMultipleKeys(string $text, array $options): array // find max from input $maxInput = max($inputToArray); - // return the prompt again if $input contain(s) non-numeric charachter, except a comma. - // And if max from $options less than max from input - // it is mean user tried to access null value in $options + // return the prompt again if $input contain(s) non-numeric character, except a comma. + // And if max from $options less than max from input, + // it means user tried to access null value in $options if (! $pattern || $maxOptions < $maxInput) { static::error('Please select correctly.'); CLI::newLine(); From 35a295c6147ee9a680d7b7f5ab49d8d5b34c147f Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 17:11:34 +0900 Subject: [PATCH 134/220] test: add test cases --- tests/system/CLI/CLITest.php | 110 +++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 2dfe15b20799..0a4e36316dbe 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -95,6 +95,80 @@ public function testPrompt(): void $this->assertSame($expected, $output); } + public function testPromptInputNothing(): void + { + PhpStreamWrapper::register(); + + $input = ''; + PhpStreamWrapper::setContent($input); + + $output = CLI::prompt('What is your favorite color?', 'red'); + + PhpStreamWrapper::restore(); + + $this->assertSame('red', $output); + } + + public function testPromptInputZero(): void + { + PhpStreamWrapper::register(); + + $input = '0'; + PhpStreamWrapper::setContent($input); + + $output = CLI::prompt('What is your favorite number?', '7'); + + PhpStreamWrapper::restore(); + + $this->assertSame('0', $output); + } + + public function testPromptByKey(): void + { + PhpStreamWrapper::register(); + + $input = '1'; + PhpStreamWrapper::setContent($input); + + $options = ['Playing game', 'Sleep', 'Badminton']; + $output = CLI::promptByKey('Select your hobbies:', $options); + + PhpStreamWrapper::restore(); + + $this->assertSame($input, $output); + } + + public function testPromptByKeyInputNothing(): void + { + PhpStreamWrapper::register(); + + $input = ''; // This is when you press the Enter key. + PhpStreamWrapper::setContent($input); + + $options = ['Playing game', 'Sleep', 'Badminton']; + $output = CLI::promptByKey('Select your hobbies:', $options); + + PhpStreamWrapper::restore(); + + $expected = '0'; + $this->assertSame($expected, $output); + } + + public function testPromptByKeyInputZero(): void + { + PhpStreamWrapper::register(); + + $input = '0'; + PhpStreamWrapper::setContent($input); + + $options = ['Playing game', 'Sleep', 'Badminton']; + $output = CLI::promptByKey('Select your hobbies:', $options); + + PhpStreamWrapper::restore(); + + $this->assertSame($input, $output); + } + public function testPromptByMultipleKeys(): void { PhpStreamWrapper::register(); @@ -114,6 +188,42 @@ public function testPromptByMultipleKeys(): void $this->assertSame($expected, $output); } + public function testPromptByMultipleKeysInputNothing(): void + { + PhpStreamWrapper::register(); + + $input = ''; // This is when you press the Enter key. + PhpStreamWrapper::setContent($input); + + $options = ['Playing game', 'Sleep', 'Badminton']; + $output = CLI::promptByMultipleKeys('Select your hobbies:', $options); + + PhpStreamWrapper::restore(); + + $expected = [ + 0 => 'Playing game', + ]; + $this->assertSame($expected, $output); + } + + public function testPromptByMultipleKeysInputZero(): void + { + PhpStreamWrapper::register(); + + $input = '0'; + PhpStreamWrapper::setContent($input); + + $options = ['Playing game', 'Sleep', 'Badminton']; + $output = CLI::promptByMultipleKeys('Select your hobbies:', $options); + + PhpStreamWrapper::restore(); + + $expected = [ + 0 => 'Playing game', + ]; + $this->assertSame($expected, $output); + } + public function testNewLine(): void { $this->expectOutputString(''); From 56f9c2dfe94f6aa8dbfeedc3d17b8114adf5d099 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 17:37:48 +0900 Subject: [PATCH 135/220] fix: TypeError in promptByMultipleKeys() --- system/CLI/CLI.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index f6646749f9df..790af4b7a788 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -330,7 +330,9 @@ public static function promptByMultipleKeys(string $text, array $options): array CLI::write($text); CLI::printKeysAndValues($options); CLI::newLine(); - $input = static::prompt($extraOutput) ?: 0; // 0 is default + + $input = static::prompt($extraOutput); + $input = ($input === '') ? '0' : $input; // 0 is default // validation while (true) { @@ -349,7 +351,9 @@ public static function promptByMultipleKeys(string $text, array $options): array if (! $pattern || $maxOptions < $maxInput) { static::error('Please select correctly.'); CLI::newLine(); - $input = static::prompt($extraOutput) ?: 0; + + $input = static::prompt($extraOutput); + $input = ($input === '') ? '0' : $input; } else { break; } From 94703ba5765849d171559b8871e6109a317d1da9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 17:39:08 +0900 Subject: [PATCH 136/220] fix: CLI::prompt() may incorrectly return default value See CLITest::testPromptInputZero(). --- system/CLI/CLI.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index 790af4b7a788..7badf1807dcd 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -258,7 +258,8 @@ public static function prompt(string $field, $options = null, $validation = null static::fwrite(STDOUT, $field . (trim($field) !== '' ? ' ' : '') . $extraOutput . ': '); // Read the input from keyboard. - $input = trim(static::$io->input()) ?: (string) $default; + $input = trim(static::$io->input()); + $input = ($input === '') ? (string) $default : $input; if ($validation !== []) { while (! static::validate('"' . trim($field) . '"', $input, $validation)) { From e772b9d06c8bd1ece519e11ede69f6f57a094e5d Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 8 May 2024 17:59:14 +0900 Subject: [PATCH 137/220] chore: update phpstan-baseline --- phpstan-baseline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 358e9633dbe0..c9b399ed3a8e 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -378,7 +378,7 @@ ]; $ignoreErrors[] = [ 'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#', - 'count' => 5, + 'count' => 2, 'path' => __DIR__ . '/system/CLI/CLI.php', ]; $ignoreErrors[] = [ From 5cd7ff266f1a0a4d1fda40700c6e20ed99b31b13 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 May 2024 10:24:16 +0900 Subject: [PATCH 138/220] docs: break long lines --- user_guide_src/source/libraries/uploaded_files.rst | 6 ++++-- user_guide_src/source/libraries/validation.rst | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index 118af85e86ee..fab3b714d76c 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -2,8 +2,10 @@ Working with Uploaded Files ########################### -CodeIgniter makes working with files uploaded through a form much simpler and more secure than using PHP's ``$_FILES`` -array directly. This extends the :doc:`File class ` and thus gains all of the features of that class. +CodeIgniter makes working with files uploaded through a form much simpler and +more secure than using PHP's ``$_FILES`` array directly. This extends the +:doc:`File class ` and thus gains all of the features of that +class. .. note:: This is not the same as the File Uploading class in CodeIgniter 3. This provides a raw interface to the uploaded files with a few small features. diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 19f0e0058a31..8fa91533c16b 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -1044,9 +1044,10 @@ file validation. files. Therefore, adding any general rules, like ``permit_empty``, to file validation rules array or string, the file validation will not work correctly. -Since the value of a file upload HTML field doesn't exist, and is stored in the ``$_FILES`` global, the name of the input field will -need to be used twice. Once to specify the field name as you would for any other rule, but again as the first parameter of all -file upload related rules:: +Since the value of a file upload HTML field doesn't exist, and is stored in the +``$_FILES`` global, the name of the input field will need to be used twice. Once +to specify the field name as you would for any other rule, but again as the first +parameter of all file upload related rules:: // In the HTML From 251f3aacea47b75f385073430ecc797e2f067510 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 May 2024 10:32:02 +0900 Subject: [PATCH 139/220] chore: change section title --- user_guide_src/source/libraries/uploaded_files.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index fab3b714d76c..7dd9ef5d6988 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -14,9 +14,11 @@ class. :local: :depth: 2 -*********** -The Process -*********** +.. _file-upload-form-tutorial: + +************************* +File Upload Form Tutorial +************************* Uploading a file involves the following general process: From 2c5b554d8ef88327700cae8a1163fb39e39d5503 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 May 2024 10:54:37 +0900 Subject: [PATCH 140/220] docs: remove unnecessary / in directory paths --- user_guide_src/source/libraries/uploaded_files.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index 7dd9ef5d6988..d2928bc4aa99 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -37,7 +37,7 @@ Creating the Upload Form ======================== Using a text editor, create a form called **upload_form.php**. In it, place -this code and save it to your **app/Views/** directory: +this code and save it to your **app/Views** directory: .. literalinclude:: uploaded_files/001.php @@ -51,7 +51,7 @@ The Success Page ================ Using a text editor, create a form called **upload_success.php**. In it, -place this code and save it to your **app/Views/** directory:: +place this code and save it to your **app/Views** directory:: @@ -77,7 +77,7 @@ The Controller ============== Using a text editor, create a controller called **Upload.php**. In it, place -this code and save it to your **app/Controllers/** directory: +this code and save it to your **app/Controllers** directory: .. literalinclude:: uploaded_files/002.php From 28ed8c9253e12a7d3398290070c5a2d9ebfaaec8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 May 2024 10:55:49 +0900 Subject: [PATCH 141/220] docs: add empty line --- user_guide_src/source/libraries/uploaded_files.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index d2928bc4aa99..ec139b59ae64 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -43,7 +43,9 @@ this code and save it to your **app/Views** directory: You'll notice we are using a form helper to create the opening form tag. File uploads require a multipart form, so the helper creates the proper -syntax for you. You'll also notice we have an ``$errors`` variable. This is +syntax for you. + +You'll also notice we have an ``$errors`` variable. This is so we can show error messages in the event the user does something wrong. From 312a951ed4029cf2308432b9eb65f1259345ffe5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 May 2024 10:56:06 +0900 Subject: [PATCH 142/220] docs: add descriptions --- .../source/libraries/uploaded_files.rst | 16 +++++++++++++--- user_guide_src/source/libraries/validation.rst | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index ec139b59ae64..ef1bc6b592f6 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -83,9 +83,19 @@ this code and save it to your **app/Controllers** directory: .. literalinclude:: uploaded_files/002.php -.. note:: Since the value of a file upload HTML field doesn't exist, and is stored in the ``$_FILES`` global, - only :ref:`rules-for-file-uploads` can be used to validate upload file with :doc:`validation`. - The rule ``required`` also can't be used, so use ``uploaded`` instead. +Since the value of a file upload HTML field doesn't exist, and is stored in the +``$_FILES`` global, only :ref:`rules-for-file-uploads` can be used to validate +upload file with :doc:`validation`. + +The rule ``required`` cannot be used either, so if the file is required, use +the rule ``uploaded`` instead. + +Note that an empty array (``[]``) is passed as the first argument to +``$this->validateData()``. It is because the file validation rules get the data +for the uploaded file directly from the Request object. + +If the form has fields other than file upload, pass the field data as the first +argument. The Routes ========== diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 8fa91533c16b..3b16ad588d87 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -885,6 +885,8 @@ Available Rules .. literalinclude:: validation/038.php :lines: 2- +.. _rules-for-general-use: + Rules for General Use ===================== @@ -1057,6 +1059,8 @@ parameter of all file upload related rules:: 'avatar' => 'uploaded[avatar]|max_size[avatar,1024]', ]); +See also :ref:`file-upload-form-tutorial`. + ======================= ========== ============================================= =================================================== Rule Parameter Description Example ======================= ========== ============================================= =================================================== From c6c370d1a482c3b25d97f81e02cbbb11fc2a1d2e Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 May 2024 11:43:14 +0900 Subject: [PATCH 143/220] docs: add notes for Config Caching --- user_guide_src/source/concepts/factories.rst | 7 +++++++ user_guide_src/source/installation/deployment.rst | 3 +++ 2 files changed, 10 insertions(+) diff --git a/user_guide_src/source/concepts/factories.rst b/user_guide_src/source/concepts/factories.rst index 6f6848bdb52b..10975798490b 100644 --- a/user_guide_src/source/concepts/factories.rst +++ b/user_guide_src/source/concepts/factories.rst @@ -270,6 +270,10 @@ Config Caching .. versionadded:: 4.4.0 +.. important:: Do not use this feature unless you have carefully read this section + and understand how this feature works. Otherwise, your application will not + function properly. + To improve performance, Config Caching has been implemented. Prerequisite @@ -287,6 +291,9 @@ Prerequisite How It Works ============ +.. important:: Once cached, configuration values are never changed until the cache + is deleted, even if the configuration file or **.env** is changed. + - Save the all Config instances in Factories into a cache file before shutdown, if the state of the Config instances in Factories changes. - Restore cached Config instances before CodeIgniter initialization if a cache diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 184d9216c42b..0eb206ee9d04 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -56,6 +56,9 @@ See :ref:`modules-specify-composer-packages`. Config Caching ============== +.. important:: Once cached, configuration values are never changed until the cache + is deleted, even if the configuration file or **.env** is changed. + Caching the Config objects can improve performance. However, the cache must be manually deleted when changing Config values. From 688a416a0717dd521c55f41d29166ac8cf873e28 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 9 May 2024 21:24:02 +0900 Subject: [PATCH 144/220] docs: replace @group with Group attribute --- tests/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/README.md b/tests/README.md index 5de4f7f2cc8e..fdcef8a6d57f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -62,8 +62,8 @@ exclude `@DatabaseLive` group. This will make the tests run quite a bit faster. ## Groups Each test class that we are running should belong to at least one -[@group](https://phpunit.readthedocs.io/en/9.5/annotations.html#group) that is written at class-level -doc block. +[Group](https://docs.phpunit.de/en/10.5/attributes.html#group) attribute that is +written at class-level doc block. The available groups to use are: From 3813e6fd66763c8efc3cfae2bba1a020d9b83765 Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 9 May 2024 17:30:56 +0200 Subject: [PATCH 145/220] docs: Small typos and modifications in libraries/sessions.rst Small typos and modifications in libraries/sessions.rst --- user_guide_src/source/libraries/sessions.rst | 50 +++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 0255e3f3b3ff..a0a5cd77cd93 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -43,7 +43,7 @@ How Do Sessions Work? ===================== When a page is loaded, the session class will check to see if a valid -session cookie is sent by the user's browser. If a sessions cookie does +session cookie is sent by the user's browser. If a session cookie does **not** exist (or if it doesn't match one stored on the server or has expired) a new session will be created and saved. @@ -480,7 +480,7 @@ Preference Default Description **sameSite** Lax The SameSite setting for the session cookie ============== =============== =========================================================================== -.. note:: The ``httponly`` setting doesn't have an effect on sessions. +.. note:: The ``httponly`` setting (in **app/Config/Cookie.php**) doesn't have an effect on sessions. Instead the HttpOnly parameter is always enabled, for security reasons. Additionally, the ``Config\Cookie::$prefix`` setting is completely ignored. @@ -488,7 +488,7 @@ Preference Default Description Session Drivers *************** -As already mentioned, the Session library comes with 4 handlers, or storage +As already mentioned, the Session library comes with five handlers, or storage engines, that you can use: - CodeIgniter\\Session\\Handlers\\FileHandler @@ -497,12 +497,12 @@ engines, that you can use: - CodeIgniter\\Session\\Handlers\\RedisHandler - CodeIgniter\\Session\\Handlers\\ArrayHandler -By default, the ``FileHandler`` Driver will be used when a session is initialized, +By default, the ``FileHandler`` will be used when a session is initialized, because it is the safest choice and is expected to work everywhere (virtually every environment has a file system). -However, any other driver may be selected via the ``public $driver`` -line in your **app/Config/Session.php** file, if you chose to do so. +However, any other driver may be selected via the ``$driver`` +setting in your **app/Config/Session.php** file, if you chose to do so. Have it in mind though, every driver has different caveats, so be sure to get yourself familiar with them (below) before you make that choice. @@ -515,22 +515,20 @@ FileHandler Driver (the default) The 'FileHandler' driver uses your file system for storing session data. It can safely be said that it works exactly like PHP's own default session -implementation, but in case this is an important detail for you, have it -mind that it is in fact not the same code and it has some limitations -(and advantages). +implementation, but in case this is an important detail for you, in fact it is not the same code +and it has some limitations (and advantages). To be more specific, it doesn't support PHP's `directory level and mode formats used in session.save_path `_, and it has most of the options hard-coded for safety. Instead, only -absolute paths are supported for ``public string $savePath``. +absolute paths are supported with ``$savePath`` setting. Another important thing that you should know, is to make sure that you don't use a publicly-readable or shared directory for storing your session -files. Make sure that *only you* have access to see the contents of your -chosen *savePath* directory. Otherwise, anybody who can do that, can -also steal any of the current sessions (also known as "session fixation" -attack). +files. *Only you* should have access to the contents of your +chosen *savePath* directory. Otherwise, anybody can see and +steal session data (also known as "session fixation" attack). On UNIX-like operating systems, this is usually achieved by setting the 0700 mode permissions on that directory via the `chmod` command, which @@ -554,14 +552,14 @@ Some of you will probably opt to choose another session driver because file storage is usually slower. This is only half true. A very basic test will probably trick you into believing that an SQL -database is faster, but in 99% of the cases, this is only true while you -only have a few current sessions. As the sessions count and server loads +database is faster, but in 99% of the cases, this is true only if you +have a few current sessions. As the sessions count and server loads increase - which is the time when it matters - the file system will consistently outperform almost all relational database setups. In addition, if performance is your only concern, you may want to look into using `tmpfs `_, -(warning: external resource), which can make your sessions blazing fast. + which can make your sessions blazing fast. .. _sessions-databasehandler-driver: @@ -571,19 +569,15 @@ DatabaseHandler Driver .. important:: Only MySQL and PostgreSQL databases are officially supported, due to lack of advisory locking mechanisms on other platforms. Using sessions without locks can cause all sorts of - problems, especially with heavy usage of AJAX, and we will not - support such cases. Use the :ref:`session-close` method after you've - done processing session data if you're having performance - issues. + problems, especially with heavy usage of AJAX. Use the :ref:`session-close` method + after you've done processing session data if you're having performance issues. The 'DatabaseHandler' driver uses a relational database such as MySQL or PostgreSQL to store sessions. This is a popular choice among many users, because it allows the developer easy access to the session data within an application - it is just another table in your database. -However, there are some conditions that must be met: - - - You can NOT use a persistent connection. +However, there is a restriction: You can NOT use a persistent connection. Configure DatabaseHandler ------------------------- @@ -602,7 +596,7 @@ you would do this: Creating Database Table ^^^^^^^^^^^^^^^^^^^^^^^ -And then of course, create the database table ... +And then of course, create the database table. For MySQL:: @@ -691,7 +685,7 @@ The downside is that it is not as ubiquitous as relational databases and requires the `phpredis `_ PHP extension to be installed on your system, and that one doesn't come bundled with PHP. -Chances are, you're only be using the RedisHandler driver only if you're already +Chances are, you're using the RedisHandler driver only if you're already both familiar with Redis and using it for other purposes. Configure RedisHandler @@ -700,9 +694,9 @@ Configure RedisHandler Just as with the 'FileHandler' and 'DatabaseHandler' drivers, you must also configure the storage location for your sessions via the ``$savePath`` setting. -The format here is a bit different and complicated at the same time. It is +The format here is a bit different and complicated. It is best explained by the *phpredis* extension's README file, so we'll simply -link you to it: +give a link to it: https://github.com/phpredis/phpredis From 222f4fc4165cb8c0239edf85ccf8700c4f73f02f Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 9 May 2024 18:32:53 +0200 Subject: [PATCH 146/220] docs: Fixed unexpected indentation error for pull request in libreries/sessions.rst Fixed unexpected indentation error for pull request in libreries/sessions.rst --- user_guide_src/source/libraries/sessions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index a0a5cd77cd93..03c2bbe81fc2 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -559,7 +559,7 @@ consistently outperform almost all relational database setups. In addition, if performance is your only concern, you may want to look into using `tmpfs `_, - which can make your sessions blazing fast. +which can make your sessions blazing fast. .. _sessions-databasehandler-driver: From efa40e78ae89fa98098095e645b637aabca97687 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 10 May 2024 07:50:22 +0900 Subject: [PATCH 147/220] docs: fix outdated description Atrribute is not written at doc block. --- tests/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/README.md b/tests/README.md index fdcef8a6d57f..c0c58040917b 100644 --- a/tests/README.md +++ b/tests/README.md @@ -62,8 +62,8 @@ exclude `@DatabaseLive` group. This will make the tests run quite a bit faster. ## Groups Each test class that we are running should belong to at least one -[Group](https://docs.phpunit.de/en/10.5/attributes.html#group) attribute that is -written at class-level doc block. +[Group](https://docs.phpunit.de/en/10.5/attributes.html#group) attribute to the +test class. The available groups to use are: From 2a51e70d0749bf17ecd9b34a1855ceff2ed7d73f Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 10 May 2024 10:58:49 +0900 Subject: [PATCH 148/220] docs: update notes for @runInSeparateProcess --- user_guide_src/source/testing/overview.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/testing/overview.rst b/user_guide_src/source/testing/overview.rst index 9bec721428d9..4052269c4ee4 100644 --- a/user_guide_src/source/testing/overview.rst +++ b/user_guide_src/source/testing/overview.rst @@ -164,8 +164,12 @@ Ensure that a header or cookie was actually emitted: .. literalinclude:: overview/009.php -.. note:: the test case with this should be `run as a separate process - in PHPunit `_. +.. note:: The test case with this should be run as a separate process + (with `@runInSeparateProcess annotation`_ or `RunInSeparateProcess attribute`_) + in PHPUnit. + +.. _@runInSeparateProcess annotation: https://docs.phpunit.de/en/10.5/annotations.html#runinseparateprocess +.. _RunInSeparateProcess attribute: https://docs.phpunit.de/en/10.5/attributes.html#runinseparateprocess assertHeaderNotEmitted($header, $ignoreCase = false) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -174,8 +178,9 @@ Ensure that a header or cookie was not emitted: .. literalinclude:: overview/010.php -.. note:: the test case with this should be `run as a separate process - in PHPunit `_. +.. note:: The test case with this should be run as a separate process + (with `@runInSeparateProcess annotation`_ or `RunInSeparateProcess attribute`_) + in PHPUnit. assertCloseEnough($expected, $actual, $message = '', $tolerance = 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 0002c6b842d5022a2af6b1e351d5d5616a0a8af4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 10 May 2024 11:04:00 +0900 Subject: [PATCH 149/220] docs: update PHP 8.1 EOL dates --- README.md | 8 ++++---- admin/framework/README.md | 8 ++++---- admin/starter/README.md | 8 ++++---- user_guide_src/source/intro/requirements.rst | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6fbe0b4fa16c..77419c2a2348 100644 --- a/README.md +++ b/README.md @@ -93,10 +93,10 @@ PHP version 8.1 or higher is required, with the following extensions installed: - [mbstring](http://php.net/manual/en/mbstring.installation.php) > [!WARNING] -> The end of life date for PHP 7.4 was November 28, 2022. -> The end of life date for PHP 8.0 was November 26, 2023. -> If you are still using PHP 7.4 or 8.0, you should upgrade immediately. -> The end of life date for PHP 8.1 will be November 25, 2024. +> - The end of life date for PHP 7.4 was November 28, 2022. +> - The end of life date for PHP 8.0 was November 26, 2023. +> - If you are still using PHP 7.4 or 8.0, you should upgrade immediately. +> - The end of life date for PHP 8.1 will be December 31, 2025. Additionally, make sure that the following extensions are enabled in your PHP: diff --git a/admin/framework/README.md b/admin/framework/README.md index 32668f5af19e..a23783ac316a 100644 --- a/admin/framework/README.md +++ b/admin/framework/README.md @@ -48,10 +48,10 @@ PHP version 8.1 or higher is required, with the following extensions installed: - [mbstring](http://php.net/manual/en/mbstring.installation.php) > [!WARNING] -> The end of life date for PHP 7.4 was November 28, 2022. -> The end of life date for PHP 8.0 was November 26, 2023. -> If you are still using PHP 7.4 or 8.0, you should upgrade immediately. -> The end of life date for PHP 8.1 will be November 25, 2024. +> - The end of life date for PHP 7.4 was November 28, 2022. +> - The end of life date for PHP 8.0 was November 26, 2023. +> - If you are still using PHP 7.4 or 8.0, you should upgrade immediately. +> - The end of life date for PHP 8.1 will be December 31, 2025. Additionally, make sure that the following extensions are enabled in your PHP: diff --git a/admin/starter/README.md b/admin/starter/README.md index 43eb3718978e..d14b4c9c804c 100644 --- a/admin/starter/README.md +++ b/admin/starter/README.md @@ -56,10 +56,10 @@ PHP version 8.1 or higher is required, with the following extensions installed: - [mbstring](http://php.net/manual/en/mbstring.installation.php) > [!WARNING] -> The end of life date for PHP 7.4 was November 28, 2022. -> The end of life date for PHP 8.0 was November 26, 2023. -> If you are still using PHP 7.4 or 8.0, you should upgrade immediately. -> The end of life date for PHP 8.1 will be November 25, 2024. +> - The end of life date for PHP 7.4 was November 28, 2022. +> - The end of life date for PHP 8.0 was November 26, 2023. +> - If you are still using PHP 7.4 or 8.0, you should upgrade immediately. +> - The end of life date for PHP 8.1 will be December 31, 2025. Additionally, make sure that the following extensions are enabled in your PHP: diff --git a/user_guide_src/source/intro/requirements.rst b/user_guide_src/source/intro/requirements.rst index fcc14266ab76..db01ef5fb002 100644 --- a/user_guide_src/source/intro/requirements.rst +++ b/user_guide_src/source/intro/requirements.rst @@ -20,7 +20,7 @@ PHP and Required Extensions - The end of life date for PHP 7.4 was November 28, 2022. - The end of life date for PHP 8.0 was November 26, 2023. - If you are still using PHP 7.4 or 8.0, you should upgrade immediately. - - The end of life date for PHP 8.1 will be November 25, 2024. + - The end of life date for PHP 8.1 will be December 31, 2025. *********************** Optional PHP Extensions From dbf17264f2d8997cee129ba15378d88df19396d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 15:50:20 +0000 Subject: [PATCH 150/220] chore(deps-dev): update rector/rector requirement from 1.0.4 to 1.0.5 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.4...1.0.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bed54690aa96..1fd90b6ac762 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "phpunit/phpcov": "^9.0.2", "phpunit/phpunit": "^10.5.16", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "1.0.4", + "rector/rector": "1.0.5", "vimeo/psalm": "^5.0" }, "replace": { From 89d8d5d023cad036168088535753bb2bfba31e1e Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 10 May 2024 20:25:08 +0200 Subject: [PATCH 151/220] docs: Some small typos and modifications in libraries/time.rst Some small typos and modifications in libraries/time.rst --- user_guide_src/source/libraries/time.rst | 58 ++++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/user_guide_src/source/libraries/time.rst b/user_guide_src/source/libraries/time.rst index d94a8cd58e62..f4924d600442 100644 --- a/user_guide_src/source/libraries/time.rst +++ b/user_guide_src/source/libraries/time.rst @@ -2,7 +2,7 @@ Times and Dates ############### -CodeIgniter provides a fully-localized, immutable, date/time class that is built on PHP's DateTimeImmutable object, but uses the Intl +CodeIgniter provides a fully-localized, immutable, date/time class that is built on PHP's DateTimeImmutable class, but uses the Intl extension's features to convert times across timezones and display the output correctly for different locales. This class is the ``Time`` class and lives in the ``CodeIgniter\I18n`` namespace. @@ -34,9 +34,9 @@ This can be any string that PHP's `DateTimeImmutable`_ constructor can parse. Se .. literalinclude:: time/001.php -You can pass in strings representing the timezone and the locale in the second and parameters, respectively. Timezones -can be any supported by PHP's `DateTimeZone `__ class. The locale can be -any supported by PHP's `Locale `__ class. If no locale or timezone is +You can pass in strings representing the timezone and the locale in the second and the third parameters, respectively. The timezone +can be any one supported by PHP's `DateTimeZone `__ class. The locale can be +any one supported by PHP's `Locale `__ class. If no locale or timezone is provided, the application defaults will be used. .. literalinclude:: time/002.php @@ -45,8 +45,8 @@ now() ===== The Time class has several helper methods to instantiate the class. The first of these is the ``now()`` method -that returns a new instance set to the current time. You can pass in strings representing the timezone and the locale -in the second and parameters, respectively. If no locale or timezone is provided, the application defaults will be used. +that returns a new instance set to the current time. You can pass in strings representing the timezone and locale +in the second and third parameters, respectively. If no locale or timezone is provided, the application defaults will be used. .. literalinclude:: time/003.php @@ -86,7 +86,7 @@ createFromDate() ================ Given separate inputs for **year**, **month**, and **day**, will return a new instance. If any of these parameters -are not provided, it will use the current value to fill it in. Accepts strings for the timezone and locale in the +are not provided, it will use the current year, month and day. Accepts strings for the timezone and locale in the fourth and fifth parameters: .. literalinclude:: time/008.php @@ -94,7 +94,7 @@ fourth and fifth parameters: createFromTime() ================ -Like ``createFromDate()`` except it is only concerned with the **hours**, **minutes**, and **seconds**. Uses the +Like ``createFromDate()``, except it is only concerned with the **hours**, **minutes**, and **seconds**. Uses the current day for the date portion of the Time instance. Accepts strings for the timezone and locale in the fourth and fifth parameters: @@ -104,7 +104,7 @@ create() ======== A combination of the previous two methods, takes **year**, **month**, **day**, **hour**, **minutes**, and **seconds** -as separate parameters. Any value not provided will use the current date and time to determine. Accepts strings for the +as separate parameters. Any value not provided will use the current date and time. Accepts strings for the timezone and locale in the fourth and fifth parameters: .. literalinclude:: time/010.php @@ -178,21 +178,21 @@ This will return a localized version of string formatted as (``Y-m-d H:i:s``): toDateString() ============== -Displays just the localized version of date portion of the Time: +Displays just the localized date portion of the Time: .. literalinclude:: time/017.php toTimeString() ============== -Displays just the localized version of time portion of the value: +Displays just the localized time portion of the value: .. literalinclude:: time/018.php humanize() ========== -This methods returns a string that displays the difference between the current date/time and the instance in a +This method returns a string that displays the difference between the current date/time and the instance in a human readable format that is geared towards being easily understood. It can create strings like '3 hours ago', 'in 1 month', etc: @@ -203,17 +203,17 @@ The exact time displayed is determined in the following manner: =============================== ================================= Time difference Result =============================== ================================= -$time > 1 year && < 2 years in 1 year / 1 year ago -$time > 1 month && < 1 year in 6 months / 6 months ago -$time > 7 days && < 1 month in 3 weeks / 3 weeks ago -$time > today && < 7 days in 4 days / 4 days ago -$time == tomorrow / yesterday Tomorrow / Yesterday -$time > 59 minutes && < 1 day in 2 hours / 2 hours ago -$time > now && < 1 hour in 35 minutes / 35 minutes ago +1 year < $time < 2 years in 1 year / 1 year ago +1 month < $time < 1 year in 6 months / 6 months ago +7 days < $time < 1 month in 3 weeks / 3 weeks ago +today < $time < 7 days in 4 days / 4 days ago +$time == yesterday / tomorrow Yesterday / Tomorrow +59 minutes < $time < 1 day in 2 hours / 2 hours ago +now < $time < 1 hour in 35 minutes / 35 minutes ago $time == now Now =============================== ================================= -The exact language used is controlled through the language file, **Time.php**. +The result strings are coming from the language file, **app/Language/{locale}/Time.php**. ****************************** Working with Individual Values @@ -240,7 +240,7 @@ In addition to these, a number of methods exist to provide additional informatio getAge() -------- -Returns the age, in years, of between the Time's instance and the current time. Perfect for checking +Returns the age, in years, between the Time instance and the current time. Perfect for checking the age of someone based on their birthday: .. literalinclude:: time/022.php @@ -402,7 +402,7 @@ humanize() Much like Time's ``humanize()`` method, this returns a string that displays the difference between the times in a human readable format that is geared towards being easily understood. It can create strings like '3 hours ago', -'in 1 month', etc. The biggest differences are in how very recent dates are handled: +'in 1 month', etc. The biggest difference is in how very recent dates are handled: .. literalinclude:: time/041.php @@ -411,13 +411,13 @@ The exact time displayed is determined in the following manner: =============================== ================================= Time difference Result =============================== ================================= -$time > 1 year && < 2 years in 1 year / 1 year ago -$time > 1 month && < 1 year in 6 months / 6 months ago -$time > 7 days && < 1 month in 3 weeks / 3 weeks ago -$time > today && < 7 days in 4 days / 4 days ago -$time > 1 hour && < 1 day in 8 hours / 8 hours ago -$time > 1 minute && < 1 hour in 35 minutes / 35 minutes ago +1 year < $time < 2 years in 1 year / 1 year ago +1 month < $time < 1 year in 6 months / 6 months ago +7 days < $time < 1 month in 3 weeks / 3 weeks ago +today < $time < 7 days in 4 days / 4 days ago +1 hour < $time < 1 day in 8 hours / 8 hours ago +1 minute < $time < 1 hour in 35 minutes / 35 minutes ago $time < 1 minute Now =============================== ================================= -The exact language used is controlled through the language file, **Time.php**. +The result strings are coming from the language file, **app/Language/{locale}/Time.php**. From 036724c722be4259122aaf6b7754ba9dad3185cf Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 May 2024 17:34:12 +0900 Subject: [PATCH 152/220] docs: remove unneeded note Even if you rename the Controllers directory, you still are able to use auto routing with proper $defaultNamespace setting. --- user_guide_src/source/concepts/structure.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide_src/source/concepts/structure.rst b/user_guide_src/source/concepts/structure.rst index 5e2084556380..83f4d348ae76 100644 --- a/user_guide_src/source/concepts/structure.rst +++ b/user_guide_src/source/concepts/structure.rst @@ -41,8 +41,6 @@ of this directory to suit your application's needs. For example, you might decid pattern and Entity Models to work with your data. In this case, you could rename the ``Models`` directory to ``Repositories``, and add a new ``Entities`` directory. -.. note:: If you rename the ``Controllers`` directory, though, you will not be able to use the automatic method of - routing to controllers, and will need to define all of your routes in the routes file. All files in this directory live under the ``App`` namespace, though you are free to change that in **app/Config/Constants.php**. From 560f9bf55f2241a4ef5513062e54d002de6fdcbf Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 May 2024 17:36:32 +0900 Subject: [PATCH 153/220] docs: change text decration and add empty lines --- user_guide_src/source/concepts/structure.rst | 34 +++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/user_guide_src/source/concepts/structure.rst b/user_guide_src/source/concepts/structure.rst index 83f4d348ae76..cf0e49722280 100644 --- a/user_guide_src/source/concepts/structure.rst +++ b/user_guide_src/source/concepts/structure.rst @@ -12,15 +12,23 @@ can change to meet the needs of your application. Default Directories ******************* -A fresh install has five directories: ``app/``, ``public/``, -``writable/``, ``tests/`` and ``vendor/`` or ``system/``. +A fresh install has five directories: + +- **app** +- **public** +- **writable** +- **tests** +- **vendor** or **system** + Each of these directories has a very specific part to play. app === -The ``app`` directory is where all of your application code lives. This comes with a default directory -structure that works well for many applications. The following folders make up the basic contents: +The **app** directory is where all of your application code lives. This comes with a default directory +structure that works well for many applications. + +The following folders make up the basic contents: .. code-block:: none @@ -36,11 +44,12 @@ structure that works well for many applications. The following folders make up t ThirdParty/ ThirdParty libraries that can be used in application Views/ Views make up the HTML that is displayed to the client -Because the ``app`` directory is already namespaced, you should feel free to modify the structure -of this directory to suit your application's needs. For example, you might decide to start using the Repository -pattern and Entity Models to work with your data. In this case, you could rename the ``Models`` directory to -``Repositories``, and add a new ``Entities`` directory. +Because the **app** directory is already namespaced, you should feel free to modify the structure +of this directory to suit your application's needs. +For example, you might decide to start using the Repository +pattern and Entities to work with your data. In this case, you could rename the **Models** directory to +**Repositories**, and add a new **Entities** directory. All files in this directory live under the ``App`` namespace, though you are free to change that in **app/Config/Constants.php**. @@ -48,7 +57,8 @@ All files in this directory live under the ``App`` namespace, though you are fre system ====== -.. note:: If you install CodeIgniter with Composer, the ``system`` is located in ``vendor/codeigniter4/framework/system``. +.. note:: If you install CodeIgniter with Composer, the **system** is located in + **vendor/codeigniter4/framework/system**. This directory stores the files that make up the framework, itself. While you have a lot of flexibility in how you use the application directory, the files in the system directory should never be modified. Instead, you should @@ -74,14 +84,16 @@ writable ======== This directory holds any directories that might need to be written to in the course of an application's life. -This includes directories for storing cache files, logs, and any uploads a user might send. You should add any other +This includes directories for storing cache files, logs, and any uploads a user might send. + +You should add any other directories that your application will need to write to here. This allows you to keep your other primary directories non-writable as an added security measure. tests ===== -This directory is set up to hold your test files. The ``_support`` directory holds various mock classes and other +This directory is set up to hold your test files. The **_support** directory holds various mock classes and other utilities that you can use while writing your tests. This directory does not need to be transferred to your production servers. From cff8db38fb3c03dabfa68b5ce9ec0620ed26d155 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 May 2024 17:42:06 +0900 Subject: [PATCH 154/220] docs: break long lines --- user_guide_src/source/concepts/structure.rst | 49 +++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/user_guide_src/source/concepts/structure.rst b/user_guide_src/source/concepts/structure.rst index cf0e49722280..5c374a548200 100644 --- a/user_guide_src/source/concepts/structure.rst +++ b/user_guide_src/source/concepts/structure.rst @@ -2,8 +2,9 @@ Application Structure ##################### -To get the most out of CodeIgniter, you need to understand how the application is structured, by default, and what you -can change to meet the needs of your application. +To get the most out of CodeIgniter, you need to understand how the application +is structured, by default, and what you can change to meet the needs of your +application. .. contents:: :local: @@ -25,8 +26,8 @@ Each of these directories has a very specific part to play. app === -The **app** directory is where all of your application code lives. This comes with a default directory -structure that works well for many applications. +The **app** directory is where all of your application code lives. This comes +with a default directory structure that works well for many applications. The following folders make up the basic contents: @@ -44,15 +45,15 @@ The following folders make up the basic contents: ThirdParty/ ThirdParty libraries that can be used in application Views/ Views make up the HTML that is displayed to the client -Because the **app** directory is already namespaced, you should feel free to modify the structure -of this directory to suit your application's needs. +Because the **app** directory is already namespaced, you should feel free to +modify the structure of this directory to suit your application's needs. For example, you might decide to start using the Repository -pattern and Entities to work with your data. In this case, you could rename the **Models** directory to -**Repositories**, and add a new **Entities** directory. +pattern and Entities to work with your data. In this case, you could rename the +**Models** directory to **Repositories**, and add a new **Entities** directory. -All files in this directory live under the ``App`` namespace, though you are free to change that in -**app/Config/Constants.php**. +All files in this directory live under the ``App`` namespace, though you are free +to change that in **app/Config/Constants.php**. system ====== @@ -60,9 +61,10 @@ system .. note:: If you install CodeIgniter with Composer, the **system** is located in **vendor/codeigniter4/framework/system**. -This directory stores the files that make up the framework, itself. While you have a lot of flexibility in how you -use the application directory, the files in the system directory should never be modified. Instead, you should -extend the classes, or create new classes, to provide the desired functionality. +This directory stores the files that make up the framework, itself. While you +have a lot of flexibility in how you use the application directory, the files in +the system directory should never be modified. Instead, you should extend the +classes, or create new classes, to provide the desired functionality. All files in this directory live under the ``CodeIgniter`` namespace. @@ -74,8 +76,7 @@ public The **public** folder holds the browser-accessible portion of your web application, preventing direct access to your source code. It contains the main **.htaccess** file, **index.php**, and any application -assets that you add, like CSS, javascript, or -images. +assets that you add, like CSS, javascript, or images. This folder is meant to be the "web root" of your site, and your web server would be configured to point to it. @@ -83,19 +84,21 @@ would be configured to point to it. writable ======== -This directory holds any directories that might need to be written to in the course of an application's life. -This includes directories for storing cache files, logs, and any uploads a user might send. +This directory holds any directories that might need to be written to in the +course of an application's life. This includes directories for storing cache +files, logs, and any uploads a user might send. -You should add any other -directories that your application will need to write to here. This allows you to keep your other primary directories -non-writable as an added security measure. +You should add any other directories that your application will need to write to +here. This allows you to keep your other primary directories non-writable as an +added security measure. tests ===== -This directory is set up to hold your test files. The **_support** directory holds various mock classes and other -utilities that you can use while writing your tests. This directory does not need to be transferred to your -production servers. +This directory is set up to hold your test files. The **_support** directory +holds various mock classes and other utilities that you can use while writing +your tests. This directory does not need to be transferred to your production +servers. Modifying Directory Locations ***************************** From ee5b08789f9036db588e7cf25c722781fa834e9d Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 May 2024 17:42:57 +0900 Subject: [PATCH 155/220] docs: add empty lines --- user_guide_src/source/concepts/structure.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/concepts/structure.rst b/user_guide_src/source/concepts/structure.rst index 5c374a548200..9b00fc57e2d5 100644 --- a/user_guide_src/source/concepts/structure.rst +++ b/user_guide_src/source/concepts/structure.rst @@ -75,6 +75,7 @@ public The **public** folder holds the browser-accessible portion of your web application, preventing direct access to your source code. + It contains the main **.htaccess** file, **index.php**, and any application assets that you add, like CSS, javascript, or images. @@ -97,8 +98,9 @@ tests This directory is set up to hold your test files. The **_support** directory holds various mock classes and other utilities that you can use while writing -your tests. This directory does not need to be transferred to your production -servers. +your tests. + +This directory does not need to be transferred to your production servers. Modifying Directory Locations ***************************** From dc9120d9c5538ca7caec3a03e97e84af2afceb65 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 May 2024 17:48:45 +0900 Subject: [PATCH 156/220] docs: remove outdated important note Since v4.5.0, you can define App and Config in composer.json. --- user_guide_src/source/general/managing_apps.rst | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/user_guide_src/source/general/managing_apps.rst b/user_guide_src/source/general/managing_apps.rst index ff664668bf8b..de6b63f7f0f6 100644 --- a/user_guide_src/source/general/managing_apps.rst +++ b/user_guide_src/source/general/managing_apps.rst @@ -8,21 +8,6 @@ directory. It is possible, however, to have multiple sets of applications that share a single CodeIgniter installation, or even to rename or relocate your application directory. -.. important:: When you installed CodeIgniter v4.1.9 or before, and if there are ``App\\`` and ``Config\\`` namespaces in your ``/composer.json``'s ``autoload.psr-4`` like the following, you need to remove these lines, and run ``composer dump-autoload``. - - .. code-block:: text - - { - ... - "autoload": { - "psr-4": { - "App\\": "app", <-- Remove this line - "Config\\": "app/Config" <-- Remove this line - } - }, - ... - } - .. contents:: :local: :depth: 2 From d8cdb4ca1b601cec36a21e6ed512cd8117016b4e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 May 2024 17:55:33 +0900 Subject: [PATCH 157/220] docs: remove unneeded / before filename --- user_guide_src/source/general/managing_apps.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/managing_apps.rst b/user_guide_src/source/general/managing_apps.rst index de6b63f7f0f6..6c990cfc28cb 100644 --- a/user_guide_src/source/general/managing_apps.rst +++ b/user_guide_src/source/general/managing_apps.rst @@ -27,11 +27,11 @@ your main **app/Config/Paths.php** and set a *full server path* in the You will need to modify two additional files in your project root, so that they can find the **Paths** configuration file: -- **/spark** runs command line apps. +- **spark** runs command line apps. .. literalinclude:: managing_apps/002.php -- **/public/index.php** is the front controller for your webapp. +- **public/index.php** is the front controller for your webapp. .. literalinclude:: managing_apps/003.php From 6a72da86d6db0cb8253092022fcfbc641110b788 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 11 May 2024 17:56:02 +0900 Subject: [PATCH 158/220] dpcs: remove ` Date: Sat, 11 May 2024 18:00:43 +0900 Subject: [PATCH 159/220] docs: fix text decoration --- user_guide_src/source/concepts/autoloader.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index c7590bde3a2a..2829e1240929 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -62,7 +62,7 @@ The key of each row is the namespace itself. This does not need a trailing back The value is the location to the directory the classes can be found in. By default, the namespace ``App`` is located in the **app** directory, and the -namespace ``Config`` is located in the ``app/Config`` directory. +namespace ``Config`` is located in the **app/Config** directory. If you create class files in the locations and according to `PSR-4`_, the autoloader will autoload them. From 83b1628a661d9715577951b8a74f58ce265b4620 Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 11 May 2024 20:36:58 +0200 Subject: [PATCH 160/220] docs: Small typos in libraries/uploaded_files.rst Small typos in libraries/uploaded_files.rst --- .../source/libraries/uploaded_files.rst | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index ef1bc6b592f6..89dfdf039586 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -30,7 +30,7 @@ Uploading a file involves the following general process: uploaded based on the preferences you set. - Once uploaded, the user will be shown a success message. -To demonstrate this process here is brief tutorial. Afterward you'll +To demonstrate this process here is a brief tutorial. Afterward you'll find reference information. Creating the Upload Form @@ -83,9 +83,9 @@ this code and save it to your **app/Controllers** directory: .. literalinclude:: uploaded_files/002.php -Since the value of a file upload HTML field doesn't exist, and is stored in the +Since HTML file element has no value attribute, and the upload file is stored in the ``$_FILES`` global, only :ref:`rules-for-file-uploads` can be used to validate -upload file with :doc:`validation`. +the upload file with :doc:`validation`. The rule ``required`` cannot be used either, so if the file is required, use the rule ``uploaded`` instead. @@ -250,7 +250,7 @@ In controller: Working with the File ********************* -Once you've retrieved the UploadedFile instance, you can retrieve information about the file in safe ways, as well as +Once you've retrieved the UploadedFile instance, you can get information about the file in safe ways, as well as move the file to a new location. .. _verify-a-file: @@ -315,7 +315,7 @@ Returns the original file extension, based on the file name that was uploaded: getClientMimeType() ------------------- -Returns the mime type (mime type) of the file as provided by the client. This is NOT a trusted value. For a trusted +Returns the mime type of the file as provided by the client. This is NOT a trusted value. For a trusted version, use ``getMimeType()`` instead: .. literalinclude:: uploaded_files/015.php @@ -365,7 +365,7 @@ as the third parameter: Check if the File Moved ----------------------- -Once the file has been removed the temporary file is deleted. You can check if a file has been moved already with +Once the file has been moved the temporary file is deleted. You can check if a file has been moved already with the ``hasMoved()`` method, which returns a boolean: .. literalinclude:: uploaded_files/018.php @@ -373,7 +373,7 @@ the ``hasMoved()`` method, which returns a boolean: When Moving Fails ----------------- -Moving an uploaded file can fail, with an HTTPException, under several circumstances: +Moving an uploaded file can fail, with an ``HTTPException``, under several circumstances: - the file has already been moved - the file did not upload successfully @@ -398,8 +398,4 @@ passing it as the second parameter: .. literalinclude:: uploaded_files/020.php -Moving an uploaded file can fail, with an ``HTTPException``, under several circumstances: - -- the file has already been moved -- the file did not upload successfully -- the file move operation fails (e.g., improper permissions) +Storing an uploaded file can fail, with an ``HTTPException``, under same circumstances like moving file. From cbc33f4f3c646e4d54be0dcccb36a657d817705b Mon Sep 17 00:00:00 2001 From: obozdag Date: Sun, 12 May 2024 20:06:51 +0200 Subject: [PATCH 161/220] docs: Some typos and modifications in libraries/uri.rst Some typos and small modifications in libraries/uri.rst --- user_guide_src/source/libraries/uri.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/libraries/uri.rst b/user_guide_src/source/libraries/uri.rst index 3ce031bf64bf..d0e05d247971 100644 --- a/user_guide_src/source/libraries/uri.rst +++ b/user_guide_src/source/libraries/uri.rst @@ -39,8 +39,8 @@ Since v4.4.0, if you don't pass a URL, it returns the current URI: The Current URI --------------- -Many times, all you really want is an object representing the current URL of this request. -You can use the :php:func:`current_url()` function available in the :doc:`../helpers/url_helper`: +When you need an object representing the current URL of the request, +you can use the :php:func:`current_url()` function available in the :doc:`../helpers/url_helper`: .. literalinclude:: uri/004.php :lines: 2- @@ -141,12 +141,12 @@ When using the ``setPort()`` method, the port will be checked that it is within Path ---- -The path are all of the segments within the site itself. As expected, the ``getPath()`` and ``setPath()`` methods +The path is all of the segments within the site itself. As expected, the ``getPath()`` and ``setPath()`` methods can be used to manipulate it: .. literalinclude:: uri/016.php -.. note:: When setting the path this way, or any other way the class allows, it is sanitized to encode any dangerous +.. note:: When setting the path it is sanitized to encode any dangerous characters, and remove dot segments for safety. .. note:: Since v4.4.0, the ``SiteURI::getRoutePath()`` method, @@ -166,7 +166,7 @@ be set as a string currently. .. literalinclude:: uri/017.php -The ``setQuery()`` method overwrite any existing query variables. +The ``setQuery()`` method overwrites existing query variables. .. note:: Query values cannot contain fragments. An InvalidArgumentException will be thrown if it does. @@ -177,7 +177,7 @@ You can set query values using an array: .. literalinclude:: uri/018.php -The ``setQueryArray()`` method overwrite any existing query variables. +The ``setQueryArray()`` method overwrites existing query variables. Adding Query Value ^^^^^^^^^^^^^^^^^^ @@ -196,11 +196,12 @@ You can filter the query values returned by passing an options array to the ``ge .. literalinclude:: uri/020.php -This only changes the values returned during this one call. If you need to modify the URI's query values more permanently, +This only changes the values returned during this one call. Changing Query Values ^^^^^^^^^^^^^^^^^^^^^ +If you need to modify the URI's query values more permanently, you can use the ``stripQuery()`` and ``keepQuery()`` methods to change the actual object's query variable collection: .. literalinclude:: uri/021.php From b632fd243946821eea7dcdc40a69414752ec4b3f Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 14 May 2024 01:01:39 +0800 Subject: [PATCH 162/220] Bump to phpstan v1.11 --- composer.json | 4 ++-- phpstan.neon.dist | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 1fd90b6ac762..8cb3583805ce 100644 --- a/composer.json +++ b/composer.json @@ -27,8 +27,8 @@ "nexusphp/cs-config": "^3.6", "nexusphp/tachycardia": "^2.0", "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10.2", - "phpstan/phpstan-strict-rules": "^1.5", + "phpstan/phpstan": "^1.11", + "phpstan/phpstan-strict-rules": "^1.6", "phpunit/phpcov": "^9.0.2", "phpunit/phpunit": "^10.5.16", "predis/predis": "^1.1 || ^2.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 7dd53849a9a8..eccd0f88db75 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -31,7 +31,9 @@ parameters: - tests/system/View/Views/* scanDirectories: - system/Helpers - checkGenericClassInNonGenericObjectType: false + ignoreErrors: + - + identifier: missingType.generics checkMissingCallableSignature: true treatPhpDocTypesAsCertain: false strictRules: From 61c457789d7e0acbac5d9c4f68b346a797b105ab Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 14 May 2024 10:13:54 +0900 Subject: [PATCH 163/220] chore: improve userguide deploy script --- admin/userguide/.github/scripts/deploy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/userguide/.github/scripts/deploy b/admin/userguide/.github/scripts/deploy index 0347c004dfff..ba1ce42d6a84 100755 --- a/admin/userguide/.github/scripts/deploy +++ b/admin/userguide/.github/scripts/deploy @@ -2,7 +2,8 @@ # Deploys the User Guide to the production # website. Triggered by updates to the GitHub -# repo's master branch. +# codeigniter4/userguide repo's master branch. +# See https://github.com/codeigniter4/userguide/blob/master/.github/workflows/deploy.yml REPO=/opt/userguide SITE=/home/public_html/userguides/userguide4 @@ -11,5 +12,7 @@ cd "$REPO" git switch master git pull -rm -rf "$SITE" -cp -R "$REPO/docs" "$SITE" +cp -R "$REPO/docs" "$SITE.new" +mv "$SITE" "$SITE.old" +mv "$SITE.new" "$SITE" +rm -rf "$SITE.old" From 9390da10042a4b49e09ede3905c3cf51c8965b45 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 15 May 2024 12:00:11 +0900 Subject: [PATCH 164/220] docs: use list for readability --- contributing/pull_request.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 66bdd9151ccd..06ae3aed3e9d 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -200,10 +200,10 @@ working on your contribution. ### Branching -All bug fixes should be sent to the __"develop"__ branch, this is where the next -bug fix version will be developed. +- All bug fix PRs should be sent to the __"develop"__ branch, this is where the + next bug fix version will be developed. +- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.6"__ -PRs with any enhancement should be sent to next minor version branch, e.g. __"4.6"__ The __"master"__ branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g. an emergency security patch) can be applied to the From 8dc546cdeccc094233081cbda7c4bde70e955515 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 15 May 2024 12:00:44 +0900 Subject: [PATCH 165/220] docs: add note --- contributing/pull_request.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 06ae3aed3e9d..9e473e515b1b 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -204,6 +204,9 @@ working on your contribution. next bug fix version will be developed. - PRs with any enhancement should be sent to next minor version branch, e.g. __"4.6"__ +> [!NOTE] +> If you sent your PR to the wrong branch, see +> [Contribution Workflow](./workflow.md#if-you-sent-to-the-wrong-branch). The __"master"__ branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g. an emergency security patch) can be applied to the From 78731c5df22565218c9910ec81a68d73db0cac75 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 15 May 2024 12:01:08 +0900 Subject: [PATCH 166/220] docs: update sample branch name to `4.6` --- contributing/workflow.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/contributing/workflow.md b/contributing/workflow.md index d893c18f0fb0..30dfc80492af 100644 --- a/contributing/workflow.md +++ b/contributing/workflow.md @@ -18,7 +18,7 @@ values for when you try these: - All bug fix PRs should be sent to the __"develop"__ branch, this is where the next bug fix version will be developed. -- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.5"__ +- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.6"__ The "master" branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g: an emergency security @@ -114,7 +114,7 @@ is optional, and implies a sort of namespacing if used. - All bug fix PRs should be sent to the __"develop"__ branch, this is where the next bug fix version will be developed. -- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.5"__ +- PRs with any enhancement should be sent to next minor version branch, e.g. __"4.6"__ For instance, if you send a PR to __"develop"__ branch, make sure you are in the *develop* branch, and create a new bugfix branch, based on *develop*, for a new @@ -126,11 +126,11 @@ feature you are creating: ``` If you send a PR with an enhancement, make sure you are in the *next minor version* -branch, and create a new feature branch, based on, e.g., __"4.5"__, for a new +branch, and create a new feature branch, based on, e.g., __"4.6"__, for a new feature you are creating: ```console -> git switch 4.5 +> git switch 4.6 > git switch -c new/mind-reader ``` @@ -283,7 +283,7 @@ switching to the branch you wish to contribute, and then clicking on "New pull request". Make sure the pull request is for the shared __"develop"__ or next minor version -branch, e.g. __"4.5"__, or it may be rejected. +branch, e.g. __"4.6"__, or it may be rejected. Make sure that the PR title is helpful for the maintainers and other developers. Add any comments appropriate, for instance asking for @@ -324,7 +324,7 @@ And if your PRs have the breaking changes, label the following label: If you are asked for changes in the review, commit the fix in your branch and push it to GitHub again. -If the __"develop"__ or next minor version branch, e.g. __"4.5"__, progresses +If the __"develop"__ or next minor version branch, e.g. __"4.6"__, progresses and conflicts arise that prevent merging, or if you are asked to *rebase*, do the following: @@ -364,7 +364,7 @@ And finally push your local branch to your GitHub repository: If you have sent a PR to the wrong branch, you need to create a new PR branch. -When you have the PR branch `feat-abc` and you should have sent the PR to __"4.5"__, +When you have the PR branch `feat-abc` and you should have sent the PR to __"4.6"__, but you created the PR branch from `develop` and sent a PR. Copy the IDs of any commits you made that you want to keep: @@ -373,13 +373,13 @@ Copy the IDs of any commits you made that you want to keep: > git log ``` -Update your __"4.5"__ branch: +Update your __"4.6"__ branch: ```console > git fetch upstream -> git switch 4.5 -> git merge upstream/4.5 -> git push origin 4.5 +> git switch 4.6 +> git merge upstream/4.6 +> git push origin 4.6 ``` (Optional) Create a new branch as a backup, just in case: @@ -388,10 +388,10 @@ Update your __"4.5"__ branch: > git branch feat-abc.bk feat-abc ``` -Rebase your PR branch from `develop` onto __"4.5"__: +Rebase your PR branch from `develop` onto __"4.6"__: ```console -> git rebase --onto 4.5 develop feat-abc +> git rebase --onto 4.6 develop feat-abc ``` Force push. @@ -400,7 +400,7 @@ Force push. > git push --force-with-lease origin feat-abc ``` -On the GitHub PR page, change the base branch to the correct branch __"4.5"__. +On the GitHub PR page, change the base branch to the correct branch __"4.6"__. ## Cleanup From 3f5aecc84be5c946fa092c94d0cd11015df4c1fc Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 15 May 2024 12:07:08 +0900 Subject: [PATCH 167/220] docs: add note --- contributing/pull_request.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index 9e473e515b1b..05e060f797ec 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -238,6 +238,10 @@ This is *not* just a "signed-off-by" commit, but instead, a digitally signed one See [Contribution signing](./signing.md) for details. +> [!NOTE] +> If you forgot GPG-signing your commits, see +> [Contribution Workflow](./workflow.md#gpg-signing-old-commits). + ### Static Analysis on PHP code We cannot, at all times, guarantee that all PHP code submitted on pull requests From bce69e8924c504bbe1d23802cb43293da45dc0b8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 16 May 2024 11:07:10 +0900 Subject: [PATCH 168/220] docs: update outdated note --- user_guide_src/source/concepts/factories.rst | 2 ++ user_guide_src/source/general/modules.rst | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/concepts/factories.rst b/user_guide_src/source/concepts/factories.rst index 10975798490b..f98fd1726e38 100644 --- a/user_guide_src/source/concepts/factories.rst +++ b/user_guide_src/source/concepts/factories.rst @@ -86,6 +86,8 @@ The following code loads **app/Libraries/Sub/SubLib.php** if it exists: .. literalinclude:: factories/013.php :lines: 2- +.. _factories-passing-fully-qualified-classname: + Passing Fully Qualified Classname --------------------------------- diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 4e5c72a9fa9b..715cdd5386e4 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -272,9 +272,11 @@ Model files are automatically discovered whenever using the :php:func:`model()` .. note:: We don't recommend you use the same short classname in modules. -.. note:: ``model()`` finds the file in **app/Models/** when there is a class with the same shortname, - even if you specify a fully qualified class name like ``model(\Acme\Blog\Model\PostModel::class)``. - This is because ``model()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`factories-loading-class` for more information. +.. note:: Prior to v4.4.0, ``model()`` finds the file in **app/Models/** when + there is a class with the same shortname, even if you specify a fully qualified + class name like ``model(\Acme\Blog\Model\PostModel::class)``. + See the Note in :ref:`factories-passing-fully-qualified-classname` for more + information. Views ===== From 382e32abb1e3910f2d64891777bf7c921fc1aaf5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 16 May 2024 11:12:12 +0900 Subject: [PATCH 169/220] docs: improve link --- user_guide_src/source/general/modules.rst | 2 +- user_guide_src/source/outgoing/views.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 715cdd5386e4..67967f5ed1d8 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -281,6 +281,6 @@ Model files are automatically discovered whenever using the :php:func:`model()` Views ===== -Views can be loaded using the class namespace as described in the :doc:`views ` documentation: +Views can be loaded using the class namespace as described in the :ref:`views ` documentation: .. literalinclude:: modules/012.php diff --git a/user_guide_src/source/outgoing/views.rst b/user_guide_src/source/outgoing/views.rst index 611631ea6d5a..c08a3e61f97f 100644 --- a/user_guide_src/source/outgoing/views.rst +++ b/user_guide_src/source/outgoing/views.rst @@ -86,6 +86,8 @@ When doing so you will need to include the directory name loading the view. Exam .. literalinclude:: views/004.php :lines: 2- +.. _namespaced-views: + Namespaced Views ================ From 1af5192f42290c7c3564511beed79e71bf134209 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 16 May 2024 11:12:28 +0900 Subject: [PATCH 170/220] docs: make function linkable --- user_guide_src/source/general/modules.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 67967f5ed1d8..a077b8f5523d 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -251,7 +251,8 @@ You can specify namespaces. See :ref:`helpers-loading-from-specified-namespace` Language Files ============== -Language files are located automatically from defined namespaces when using the ``lang()`` method, as long as the +Language files are located automatically from defined namespaces when using the +:php:func:`lang()` function, as long as the file follows the same directory structures as the main application directory. Libraries From a909c07f18359efc9eedb965760190d7e8b6a17a Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 17 May 2024 21:39:38 +0900 Subject: [PATCH 171/220] chore: improve deploy script --- admin/userguide/.github/scripts/{deploy => deploy.sh} | 9 +++++++-- admin/userguide/.github/workflows/deploy.yml | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) rename admin/userguide/.github/scripts/{deploy => deploy.sh} (66%) diff --git a/admin/userguide/.github/scripts/deploy b/admin/userguide/.github/scripts/deploy.sh similarity index 66% rename from admin/userguide/.github/scripts/deploy rename to admin/userguide/.github/scripts/deploy.sh index ba1ce42d6a84..43e0675db0e6 100755 --- a/admin/userguide/.github/scripts/deploy +++ b/admin/userguide/.github/scripts/deploy.sh @@ -5,8 +5,13 @@ # codeigniter4/userguide repo's master branch. # See https://github.com/codeigniter4/userguide/blob/master/.github/workflows/deploy.yml -REPO=/opt/userguide -SITE=/home/public_html/userguides/userguide4 +REPO="/opt/userguide" +SITE="/home/public_html/userguides/userguide4" + +if [ "$(id -u)" = "0" ]; then + echo "Cannot be run as root. Please run as the user for deployment." + exit 1 +fi cd "$REPO" git switch master diff --git a/admin/userguide/.github/workflows/deploy.yml b/admin/userguide/.github/workflows/deploy.yml index ac8027fc7410..d244eb415978 100644 --- a/admin/userguide/.github/workflows/deploy.yml +++ b/admin/userguide/.github/workflows/deploy.yml @@ -4,7 +4,7 @@ name: Deploy Production on: push: - branches: + branches: - master jobs: @@ -19,4 +19,4 @@ jobs: username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} - script: /opt/userguide/.github/scripts/deploy + script: /opt/userguide/.github/scripts/deploy.sh From 4b6bcfa9d4786a9f9f0c3b424b7c9ffe0bdda9ef Mon Sep 17 00:00:00 2001 From: obozdag Date: Sun, 19 May 2024 20:56:18 +0200 Subject: [PATCH 172/220] docs: Rollback misleading changes in libraries/uploaded_files.rst Rollback misleading changes in libraries/uploaded_files.rst --- user_guide_src/source/libraries/uploaded_files.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index 89dfdf039586..c6cd88d46016 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -83,7 +83,7 @@ this code and save it to your **app/Controllers** directory: .. literalinclude:: uploaded_files/002.php -Since HTML file element has no value attribute, and the upload file is stored in the +Since the value of a file upload HTML field doesn't exist, and is stored in the ``$_FILES`` global, only :ref:`rules-for-file-uploads` can be used to validate the upload file with :doc:`validation`. @@ -398,4 +398,8 @@ passing it as the second parameter: .. literalinclude:: uploaded_files/020.php -Storing an uploaded file can fail, with an ``HTTPException``, under same circumstances like moving file. +Moving an uploaded file can fail, with an ``HTTPException``, under several circumstances: + +- the file has already been moved +- the file did not upload successfully +- the file move operation fails (e.g., improper permissions) From 4a0efa5efd50a8be42d8e6856c1b3918a2a341ba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 15:21:00 +0000 Subject: [PATCH 173/220] chore(deps-dev): update rector/rector requirement from 1.0.5 to 1.1.0 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.5...1.1.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8cb3583805ce..afaf2e9cb60e 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "phpunit/phpcov": "^9.0.2", "phpunit/phpunit": "^10.5.16", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "1.0.5", + "rector/rector": "1.1.0", "vimeo/psalm": "^5.0" }, "replace": { From 627a28a663297ac992b069851e3156bf510e1b85 Mon Sep 17 00:00:00 2001 From: obozdag Date: Tue, 21 May 2024 08:45:18 +0200 Subject: [PATCH 174/220] docs: Prevent text-wrap in user guide Prevent text-wrap in user guide. For example $this- >validateData() should stay unwrapped ($this->validateData()). --- user_guide_src/source/_static/css/citheme.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/_static/css/citheme.css b/user_guide_src/source/_static/css/citheme.css index 3410fbc5cbb2..b3264e096336 100644 --- a/user_guide_src/source/_static/css/citheme.css +++ b/user_guide_src/source/_static/css/citheme.css @@ -245,6 +245,10 @@ html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not( background-color: #fffff0; } +span.std { + text-wrap: nowrap; +} + /* Messages ----------------------------------------------------------------- */ .rst-content .success { From 02ada60fb3ade14bace81ab5a9614d69207f996a Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 2 May 2024 15:28:51 +0700 Subject: [PATCH 175/220] docs: fix PHPDocs View --- phpstan-baseline.php | 182 +----------------------------- system/View/Parser.php | 30 ++++- system/View/RendererInterface.php | 19 ++-- system/View/Table.php | 29 ++--- system/View/View.php | 32 +++--- 5 files changed, 68 insertions(+), 224 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index c9b399ed3a8e..3c1ceaa90b39 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -9006,171 +9006,21 @@ 'count' => 1, 'path' => __DIR__ . '/system/View/Parser.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:applyFilters\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:objectToArray\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:objectToArray\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parse\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parsePair\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parsePair\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:parseSingle\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:prepareReplacement\\(\\) has parameter \\$matches with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:replaceSingle\\(\\) has parameter \\$pattern with no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/View/Parser.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\Parser\\:\\:\\$dataContexts type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\Parser\\:\\:\\$noparseBlocks type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Parser.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/RendererInterface.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/RendererInterface.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\RendererInterface\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/RendererInterface.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_defaultTemplate\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_prepArgs\\(\\) has parameter \\$args with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_prepArgs\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_setFromArray\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:generate\\(\\) has parameter \\$tableData with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:setTemplate\\(\\) has parameter \\$template with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; $ignoreErrors[] = [ 'message' => '#^Only booleans are allowed in an if condition, string\\|null given\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/View/Table.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$footing type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$function type has no signature specified for callable\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/View/Table.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$heading type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$rows type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$template type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Table.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9186,26 +9036,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/View/View.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:render\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:renderString\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:setData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$data type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$performanceData type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -9221,11 +9051,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/View/View.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$tempData type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; $ignoreErrors[] = [ 'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#', 'count' => 2, @@ -15992,15 +15817,10 @@ 'path' => __DIR__ . '/tests/system/View/TableTest.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$array of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects array, string given\\.$#', + 'message' => '#^Parameter \\#1 \\$array of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects array\\, string given\\.$#', 'count' => 1, 'path' => __DIR__ . '/tests/system/View/TableTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$template of method CodeIgniter\\\\View\\\\Table\\:\\:setTemplate\\(\\) expects array, string given\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/tests/system/View/TableTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Parameter \\#2 \\$columnLimit of method CodeIgniter\\\\View\\\\Table\\:\\:makeColumns\\(\\) expects int, string given\\.$#', 'count' => 1, diff --git a/system/View/Parser.php b/system/View/Parser.php index 085252102e6e..bbeb00f757c0 100644 --- a/system/View/Parser.php +++ b/system/View/Parser.php @@ -56,7 +56,7 @@ class Parser extends View /** * Stores extracted noparse blocks. * - * @var array + * @var list */ protected $noparseBlocks = []; @@ -72,7 +72,7 @@ class Parser extends View * Stores the context for each data element * when set by `setData` so the context is respected. * - * @var array + * @var array */ protected $dataContexts = []; @@ -99,6 +99,10 @@ public function __construct( * * Parses pseudo-variables contained in the specified template view, * replacing them with any data that has already been set. + * + * @param array|null $options Reserved for 3rd-party uses since + * it might be needed to pass additional info + * to other template engines. */ public function render(string $view, ?array $options = null, ?bool $saveData = null): string { @@ -159,6 +163,10 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n * * Parses pseudo-variables contained in the specified string, * replacing them with any data that has already been set. + * + * @param array|null $options Reserved for 3rd-party uses since + * it might be needed to pass additional info + * to other template engines. */ public function renderString(string $template, ?array $options = null, ?bool $saveData = null): string { @@ -190,6 +198,7 @@ public function renderString(string $template, ?array $options = null, ?bool $sa * so that the variable is correctly handled within the * parsing itself, and contexts (including raw) are respected. * + * @param array $data * @param non-empty-string|null $context The context to escape it for. * If 'raw', no escaping will happen. * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context @@ -222,7 +231,8 @@ public function setData(array $data = [], ?string $context = null): RendererInte * Parses pseudo-variables contained in the specified template, * replacing them with the data in the second param * - * @param array $options Future options + * @param array $data + * @param array $options Future options */ protected function parse(string $template, array $data = [], ?array $options = null): string { @@ -266,6 +276,8 @@ protected function parse(string $template, array $data = [], ?array $options = n /** * Parse a single key/value, extracting it + * + * @return array */ protected function parseSingle(string $key, string $val): array { @@ -280,6 +292,10 @@ protected function parseSingle(string $key, string $val): array * Parse a tag pair * * Parses tag pairs: {some_tag} string... {/some_tag} + * + * @param array $data + * + * @return array */ protected function parsePair(string $variable, array $data, string $template): array { @@ -533,6 +549,8 @@ protected function replaceSingle($pattern, $content, $template, bool $escape = f /** * Callback used during parse() to apply any filters to the value. + * + * @param list $matches */ protected function prepareReplacement(array $matches, string $replace, bool $escape = true): string { @@ -586,6 +604,8 @@ public function shouldAddEscaping(string $key) /** * Given a set of filters, will apply each of the filters in turn * to $replace, and return the modified string. + * + * @param list $filters */ protected function applyFilters(string $replace, array $filters): string { @@ -708,9 +728,9 @@ public function removePlugin(string $alias) * Converts an object to an array, respecting any * toArray() methods on an object. * - * @param array|bool|float|int|object|string|null $value + * @param array|bool|float|int|object|string|null $value * - * @return array|bool|float|int|string|null + * @return array|bool|float|int|string|null */ protected function objectToArray($value) { diff --git a/system/View/RendererInterface.php b/system/View/RendererInterface.php index 62d3d7825060..5fdf8794f12d 100644 --- a/system/View/RendererInterface.php +++ b/system/View/RendererInterface.php @@ -24,10 +24,10 @@ interface RendererInterface * Builds the output based upon a file name and any * data that has already been set. * - * @param array|null $options Reserved for 3rd-party uses since - * it might be needed to pass additional info - * to other template engines. - * @param bool $saveData Whether to save data for subsequent calls + * @param array|null $options Reserved for 3rd-party uses since + * it might be needed to pass additional info + * to other template engines. + * @param bool $saveData Whether to save data for subsequent calls */ public function render(string $view, ?array $options = null, bool $saveData = false): string; @@ -35,17 +35,18 @@ public function render(string $view, ?array $options = null, bool $saveData = fa * Builds the output based upon a string and any * data that has already been set. * - * @param string $view The view contents - * @param array|null $options Reserved for 3rd-party uses since - * it might be needed to pass additional info - * to other template engines. - * @param bool $saveData Whether to save data for subsequent calls + * @param string $view The view contents + * @param array|null $options Reserved for 3rd-party uses since + * it might be needed to pass additional info + * to other template engines. + * @param bool $saveData Whether to save data for subsequent calls */ public function renderString(string $view, ?array $options = null, bool $saveData = false): string; /** * Sets several pieces of view data at once. * + * @param array $data * @param non-empty-string|null $context The context to escape it for. * If 'raw', no escaping will happen. * @phpstan-param null|'html'|'js'|'css'|'url'|'attr'|'raw' $context diff --git a/system/View/Table.php b/system/View/Table.php index 85770e31915d..60ccc509f9ae 100644 --- a/system/View/Table.php +++ b/system/View/Table.php @@ -27,21 +27,21 @@ class Table /** * Data for table rows * - * @var list|list> + * @var list>|list>> */ public $rows = []; /** * Data for table heading * - * @var array + * @var array */ public $heading = []; /** * Data for table footing * - * @var array + * @var array */ public $footing = []; @@ -62,7 +62,7 @@ class Table /** * Table layout template * - * @var array + * @var array */ public $template; @@ -95,7 +95,7 @@ class Table /** * Set the template from the table config file if it exists * - * @param array $config (default: array()) + * @param array $config (default: array()) */ public function __construct($config = []) { @@ -108,7 +108,8 @@ public function __construct($config = []) /** * Set the template * - * @param array $template + * @param array $template + * @phpstan-param array|string $template * * @return bool */ @@ -157,10 +158,10 @@ public function setFooting() * columns. This allows a single array with many elements to be * displayed in a table that has a fixed column count. * - * @param array $array - * @param int $columnLimit + * @param list $array + * @param int $columnLimit * - * @return array|false + * @return array|false */ public function makeColumns($array = [], $columnLimit = 0) { @@ -260,7 +261,9 @@ public function setSyncRowsWithHeading(bool $orderByKey) * * Ensures a standard associative array format for all cell data * - * @return array|list + * @param array $args + * + * @return array>|list> */ protected function _prepArgs(array $args) { @@ -297,7 +300,7 @@ public function setCaption($caption) /** * Generate the table * - * @param array|BaseResult|null $tableData + * @param array|BaseResult|null $tableData * * @return string */ @@ -472,7 +475,7 @@ protected function _setFromDBResult($object) /** * Set table data from an array * - * @param array $data + * @param array $data * * @return void */ @@ -510,7 +513,7 @@ protected function _compileTemplate() /** * Default Template * - * @return array + * @return array */ protected function _defaultTemplate() { diff --git a/system/View/View.php b/system/View/View.php index cda3d64f6088..8f630d7b90f3 100644 --- a/system/View/View.php +++ b/system/View/View.php @@ -34,14 +34,14 @@ class View implements RendererInterface /** * Saved Data. * - * @var array + * @var array */ protected $data = []; /** * Data for the variables that are available in the Views. * - * @var array|null + * @var array|null */ protected $tempData; @@ -165,13 +165,13 @@ public function __construct( * - cache Number of seconds to cache for * - cache_name Name to use for cache * - * @param string $view File name of the view source - * @param array|null $options Reserved for 3rd-party uses since - * it might be needed to pass additional info - * to other template engines. - * @param bool|null $saveData If true, saves data for subsequent calls, - * if false, cleans the data after displaying, - * if null, uses the config setting. + * @param string $view File name of the view source + * @param array|null $options Reserved for 3rd-party uses since + * it might be needed to pass additional info + * to other template engines. + * @param bool|null $saveData If true, saves data for subsequent calls, + * if false, cleans the data after displaying, + * if null, uses the config setting. */ public function render(string $view, ?array $options = null, ?bool $saveData = null): string { @@ -306,13 +306,13 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n * data that has already been set. * Cache does not apply, because there is no "key". * - * @param string $view The view contents - * @param array|null $options Reserved for 3rd-party uses since - * it might be needed to pass additional info - * to other template engines. - * @param bool|null $saveData If true, saves data for subsequent calls, - * if false, cleans the data after displaying, - * if null, uses the config setting. + * @param string $view The view contents + * @param array|null $options Reserved for 3rd-party uses since + * it might be needed to pass additional info + * to other template engines. + * @param bool|null $saveData If true, saves data for subsequent calls, + * if false, cleans the data after displaying, + * if null, uses the config setting. */ public function renderString(string $view, ?array $options = null, ?bool $saveData = null): string { From d88ad38c8dbf1b95422b64f2a174fcef200c4b1b Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 3 May 2024 08:08:37 +0700 Subject: [PATCH 176/220] docs: fix PHPDocs for View --- phpstan-baseline.php | 55 ----------------------------------------- system/View/Cell.php | 13 +++++----- system/View/Filters.php | 2 +- system/View/View.php | 13 +++++++--- 4 files changed, 17 insertions(+), 66 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 3c1ceaa90b39..995190b9d740 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -8936,21 +8936,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/View/Cell.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Cell.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Cell.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:render\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Cell.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:renderCell\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -8996,11 +8981,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/View/Cells/Cell.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\Filters\\:\\:default\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/Filters.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:addPlugin\\(\\) has parameter \\$callback with no signature specified for callable\\.$#', 'count' => 1, @@ -9021,36 +9001,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/View/Table.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getData\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:getPerformanceData\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:include\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$performanceData type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$renderVars type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$sections type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/View/View.php', -]; $ignoreErrors[] = [ 'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#', 'count' => 2, @@ -15691,11 +15641,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/system/Validation/ValidationTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$params of method CodeIgniter\\\\View\\\\Cell\\:\\:prepareParams\\(\\) expects array\\|string\\|null, float given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/View/CellTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\View\\\\DecoratorsTest\\:\\:\\$loader \\(CodeIgniter\\\\Autoloader\\\\FileLocator\\) does not accept CodeIgniter\\\\Autoloader\\\\FileLocatorInterface\\.$#', 'count' => 1, diff --git a/system/View/Cell.php b/system/View/Cell.php index cafe13d161e0..28b249a60e1c 100644 --- a/system/View/Cell.php +++ b/system/View/Cell.php @@ -68,10 +68,10 @@ public function __construct(CacheInterface $cache) /** * Render a cell, returning its body as a string. * - * @param string $library Cell class and method name. - * @param array|string|null $params Parameters to pass to the method. - * @param int $ttl Number of seconds to cache the cell. - * @param string|null $cacheName Cache item name. + * @param string $library Cell class and method name. + * @param array|string|null $params Parameters to pass to the method. + * @param int $ttl Number of seconds to cache the cell. + * @param string|null $cacheName Cache item name. * * @throws ReflectionException */ @@ -117,9 +117,10 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c * If a string, it should be in the format "key1=value key2=value". * It will be split and returned as an array. * - * @param array|string|null $params + * @param array|string|null $params + * @phpstan-param array|string|float|null $params * - * @return array + * @return array */ public function prepareParams($params) { diff --git a/system/View/Filters.php b/system/View/Filters.php index 56204c86c3d2..dde9ec6d663d 100644 --- a/system/View/Filters.php +++ b/system/View/Filters.php @@ -67,7 +67,7 @@ public static function date_modify($value, string $adjustment) /** * Returns the given default value if $value is empty or undefined. * - * @param array|bool|float|int|object|resource|string|null $value + * @param bool|float|int|list|object|resource|string|null $value */ public static function default($value, string $default): string { diff --git a/system/View/View.php b/system/View/View.php index 8f630d7b90f3..1aec11cab57b 100644 --- a/system/View/View.php +++ b/system/View/View.php @@ -55,7 +55,7 @@ class View implements RendererInterface /** * Data for rendering including Caching and Debug Toolbar data. * - * @var array + * @var array */ protected $renderVars = []; @@ -86,7 +86,7 @@ class View implements RendererInterface * Cache stats about our performance here, * when CI_DEBUG = true * - * @var array + * @var list */ protected $performanceData = []; @@ -120,7 +120,7 @@ class View implements RendererInterface /** * Holds the sections and their data. * - * @var array + * @var array> */ protected $sections = []; @@ -393,6 +393,8 @@ public function resetData(): RendererInterface /** * Returns the current data that will be displayed in the view. + * + * @return array */ public function getData(): array { @@ -477,7 +479,8 @@ public function renderSection(string $sectionName, bool $saveData = false) /** * Used within layout views to include additional views. * - * @param bool $saveData + * @param array|null $options + * @param bool $saveData */ public function include(string $view, ?array $options = null, $saveData = true): string { @@ -487,6 +490,8 @@ public function include(string $view, ?array $options = null, $saveData = true): /** * Returns the performance data that might have been collected * during the execution. Used primarily in the Debug Toolbar. + * + * @return list */ public function getPerformanceData(): array { From 93267dab39261b1f2ea0a46a1f86b3e49ba92979 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Wed, 22 May 2024 15:19:25 +0700 Subject: [PATCH 177/220] docs: fix PHPDocs in View --- system/View/View.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/View/View.php b/system/View/View.php index 1aec11cab57b..7b6bfea0bba5 100644 --- a/system/View/View.php +++ b/system/View/View.php @@ -86,7 +86,7 @@ class View implements RendererInterface * Cache stats about our performance here, * when CI_DEBUG = true * - * @var list + * @var list */ protected $performanceData = []; @@ -491,7 +491,7 @@ public function include(string $view, ?array $options = null, $saveData = true): * Returns the performance data that might have been collected * during the execution. Used primarily in the Debug Toolbar. * - * @return list + * @return list */ public function getPerformanceData(): array { From 550557e9b6ab092056f43ed21a76fe238d342795 Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 23 May 2024 15:13:37 +0200 Subject: [PATCH 178/220] docs: Small typos in libraries/validation.rst Small typos in libraries/validation.rst --- .../source/libraries/validation.rst | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 3b16ad588d87..899389d2d004 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -743,7 +743,7 @@ Configuration ============= Once you have your views created, you need to let the Validation library know about them. Open **app/Config/Validation.php**. -Inside, you'll find the ``$templates`` property where you can list as many custom views as you want, and provide an +Inside, you'll find the ``$templates`` property where you can list as many custom views as you want, and provide a short alias they can be referenced by. If we were to add our example file from above, it would look something like: .. literalinclude:: validation/032.php @@ -769,7 +769,7 @@ Creating Custom Rules Using Rule Classes ================== -Rules are stored within simple, namespaced classes. They can be stored any location you would like, as long as the +Rules are stored within simple, namespaced classes. They can be stored in any location you would like, as long as the autoloader can find it. These files are called RuleSets. Adding a RuleSet @@ -781,7 +781,7 @@ add the new file to the ``$ruleSets`` array: .. literalinclude:: validation/033.php You can add it as either a simple string with the fully qualified class name, or using the ``::class`` suffix as -shown above. The primary benefit here is that it provides some extra navigation capabilities in more advanced IDEs. +shown above. The primary benefit of using the ``::class`` suffix is that it provides some extra navigation capabilities in more advanced IDEs. Creating a Rule Class --------------------- @@ -921,8 +921,9 @@ decimal No Fails if field contains anything other than ``-`` sign for the number. differs Yes Fails if field does not differ from the one ``differs[field_name]`` in the parameter. -exact_length Yes Fails if field is not exactly the parameter ``exact_length[5]`` or ``exact_length[5,8,12]`` - value. One or more comma-separated values. +exact_length Yes Fails if field length is not exactly ``exact_length[5]`` or ``exact_length[5,8,12]`` + the parameter value. One or more + comma-separated values are possible. field_exists Yes Fails if field does not exist. (This rule was added in v4.5.0.) greater_than Yes Fails if field is less than or equal to ``greater_than[8]`` @@ -943,7 +944,7 @@ is_natural No Fails if field contains anything other than is_natural_no_zero No Fails if field contains anything other than a natural number, except zero: 1, 2, 3, etc. is_not_unique Yes Checks the database to see if the given value ``is_not_unique[table.field,where_field,where_value]`` - exist. Can ignore records by field/value to + exists. Can ignore records by field/value to filter (currently accept only one filter). is_unique Yes Checks if this field value exists in the ``is_unique[table.field,ignore_field,ignore_value]`` database. Optionally set a column and value @@ -975,8 +976,8 @@ required_without Yes The field is required when any of the other fields is `empty()`_ in the data. string No A generic alternative to the alpha* rules that confirms the element is a string -timezone No Fails if field does match a timezone per - `timezone_identifiers_list()`_ +timezone No Fails if field does not match a timezone + per `timezone_identifiers_list()`_ valid_base64 No Fails if field contains anything other than valid Base64 characters. valid_json No Fails if field does not contain a valid JSON @@ -1001,7 +1002,7 @@ valid_url_strict Yes Fails if field does not contain a valid URL. valid_date Yes Fails if field does not contain a valid date. ``valid_date[d/m/Y]`` Any string that `strtotime()`_ accepts is valid if you don't specify an optional - parameter to matches a date format. + parameter that matches a date format. **So it is usually necessary to specify the parameter.** valid_cc_number Yes Verifies that the credit card number matches ``valid_cc_number[amex]`` @@ -1069,9 +1070,9 @@ uploaded Yes Fails if the name of the parameter does not If you want the file upload to be optional (not required), do not define this rule. -max_size Yes Fails if the uploaded file named in the ``max_size[field_name,2048]`` - parameter is larger than the second - parameter in kilobytes (kb). Or if the file +max_size Yes Fails if the uploaded file is larger ``max_size[field_name,2048]`` + than the second parameter + in kilobytes (kb). Or if the file is larger than allowed maximum size declared in php.ini config file - ``upload_max_filesize`` directive. From d0baacf5623501b9a90fdf4b8a38dc8bca7c304d Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 23 May 2024 15:18:57 +0200 Subject: [PATCH 179/220] docs: Small typo in libraries/validation/037.php Small typo in libraries/validation/037.php --- user_guide_src/source/libraries/validation/037.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/validation/037.php b/user_guide_src/source/libraries/validation/037.php index 450c5de1a9cc..1a05b912d397 100644 --- a/user_guide_src/source/libraries/validation/037.php +++ b/user_guide_src/source/libraries/validation/037.php @@ -17,7 +17,7 @@ public function required_with($value, string $params, array $data): bool // Still here? Then we fail this test if // any of the fields are present in $data - // as $fields is the lis + // as $fields in the list $requiredFields = []; foreach ($params as $field) { From e126b2facc8369404b6dcc5b5d6ed435869cc930 Mon Sep 17 00:00:00 2001 From: obozdag Date: Fri, 24 May 2024 04:25:08 +0200 Subject: [PATCH 180/220] docs: Change last sentence in humanize() in libraries/time.rst Change last sentence in humanize() in libraries/time.rst --- user_guide_src/source/libraries/time.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/time.rst b/user_guide_src/source/libraries/time.rst index f4924d600442..bbf6066f886c 100644 --- a/user_guide_src/source/libraries/time.rst +++ b/user_guide_src/source/libraries/time.rst @@ -213,7 +213,8 @@ now < $time < 1 hour in 35 minutes / 35 minutes ago $time == now Now =============================== ================================= -The result strings are coming from the language file, **app/Language/{locale}/Time.php**. +The result strings are coming from the language file, **system/Language/en/Time.php**. +If you want to overwrite them, create **app/Language/{locale}/Time.php**. ****************************** Working with Individual Values From 0a45ea8a35afdecc51020553faadec29310a7ec1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 May 2024 09:33:37 +0900 Subject: [PATCH 181/220] test: add test for Postgre error message --- .../Database/Live/Postgre/ConnectTest.php | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/system/Database/Live/Postgre/ConnectTest.php diff --git a/tests/system/Database/Live/Postgre/ConnectTest.php b/tests/system/Database/Live/Postgre/ConnectTest.php new file mode 100644 index 000000000000..29de0976eb21 --- /dev/null +++ b/tests/system/Database/Live/Postgre/ConnectTest.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace CodeIgniter\Database\Live\Postgre; + +use CodeIgniter\Database\Exceptions\DatabaseException; +use CodeIgniter\Test\CIUnitTestCase; +use Config\Database; +use PHPUnit\Framework\Attributes\Group; + +/** + * @internal + */ +#[Group('DatabaseLive')] +final class ConnectTest extends CIUnitTestCase +{ + protected function setUp(): void + { + parent::setUp(); + + $this->db = Database::connect($this->DBGroup); + + if ($this->db->DBDriver !== 'Postgre') { + $this->markTestSkipped('This test is only for Postgre.'); + } + } + + public function testShowErrorMessageWhenSettingInvalidCharset(): void + { + $this->expectException(DatabaseException::class); + $this->expectExceptionMessage( + 'Unable to connect to the database. +Main connection [Postgre]: ERROR: invalid value for parameter "client_encoding": "utf8mb4"' + ); + + $config = config('Database'); + $group = $config->tests; + // Sets invalid charset. + $group['charset'] = 'utf8mb4'; + $db = Database::connect($group); + + // Actually connect to DB. + $db->initialize(); + } +} From 35dc6429c364cb3c9c8a294de97eecbd0e0433a6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 May 2024 09:15:53 +0900 Subject: [PATCH 182/220] fix: missing Postgre error message --- system/Database/BaseConnection.php | 1 + system/Database/Postgre/Connection.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 77c9bd39ef3e..6325fd691093 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -420,6 +420,7 @@ public function initialize() // Connect to the database and set the connection ID $this->connID = $this->connect($this->pConnect); } catch (Throwable $e) { + $this->connID = false; $connectionErrors[] = sprintf('Main connection [%s]: %s', $this->DBDriver, $e->getMessage()); log_message('error', 'Error connecting to the database: ' . $e); } diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 126aa98bb1c2..b1b41d411b7e 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -80,7 +80,9 @@ public function connect(bool $persistent = false) if ($this->connID !== false) { if ($persistent === true && pg_connection_status($this->connID) === PGSQL_CONNECTION_BAD && pg_ping($this->connID) === false ) { - return false; + $error = pg_last_error($this->connID); + + throw new DatabaseException($error); } if (! empty($this->schema)) { @@ -88,7 +90,9 @@ public function connect(bool $persistent = false) } if ($this->setClientEncoding($this->charset) === false) { - return false; + $error = pg_last_error($this->connID); + + throw new DatabaseException($error); } } From 8b3e4e377c2a7cd995781468b27882adbe73d6fe Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 25 May 2024 09:20:20 +0900 Subject: [PATCH 183/220] style: break long lines --- system/Database/BaseConnection.php | 13 +++++++++++-- system/Database/Postgre/Connection.php | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 6325fd691093..57c37d8a0a6c 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -421,7 +421,11 @@ public function initialize() $this->connID = $this->connect($this->pConnect); } catch (Throwable $e) { $this->connID = false; - $connectionErrors[] = sprintf('Main connection [%s]: %s', $this->DBDriver, $e->getMessage()); + $connectionErrors[] = sprintf( + 'Main connection [%s]: %s', + $this->DBDriver, + $e->getMessage() + ); log_message('error', 'Error connecting to the database: ' . $e); } @@ -442,7 +446,12 @@ public function initialize() // Try to connect $this->connID = $this->connect($this->pConnect); } catch (Throwable $e) { - $connectionErrors[] = sprintf('Failover #%d [%s]: %s', ++$index, $this->DBDriver, $e->getMessage()); + $connectionErrors[] = sprintf( + 'Failover #%d [%s]: %s', + ++$index, + $this->DBDriver, + $e->getMessage() + ); log_message('error', 'Error connecting to the database: ' . $e); } diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index b1b41d411b7e..c22dc8605f56 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -78,7 +78,10 @@ public function connect(bool $persistent = false) $this->connID = $persistent === true ? pg_pconnect($this->DSN) : pg_connect($this->DSN); if ($this->connID !== false) { - if ($persistent === true && pg_connection_status($this->connID) === PGSQL_CONNECTION_BAD && pg_ping($this->connID) === false + if ( + $persistent === true + && pg_connection_status($this->connID) === PGSQL_CONNECTION_BAD + && pg_ping($this->connID) === false ) { $error = pg_last_error($this->connID); From 2e480d56a41a4ecea8dad0534c0a16e61d475c4a Mon Sep 17 00:00:00 2001 From: obozdag Date: Sat, 25 May 2024 04:48:12 +0200 Subject: [PATCH 184/220] docs: Update libraries/time.rst Co-authored-by: kenjis --- user_guide_src/source/libraries/time.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/time.rst b/user_guide_src/source/libraries/time.rst index bbf6066f886c..b18e56350403 100644 --- a/user_guide_src/source/libraries/time.rst +++ b/user_guide_src/source/libraries/time.rst @@ -421,4 +421,5 @@ today < $time < 7 days in 4 days / 4 days ago $time < 1 minute Now =============================== ================================= -The result strings are coming from the language file, **app/Language/{locale}/Time.php**. +The result strings are coming from the language file, **system/Language/en/Time.php**. +If you want to overwrite them, create **app/Language/{locale}/Time.php**. From 4f819cbb7cde0952bd400d6f78d0a9a61556e2bd Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 May 2024 08:40:20 +0900 Subject: [PATCH 185/220] docs: simplify explanation --- user_guide_src/source/libraries/uploaded_files.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index c6cd88d46016..7cc3084d306f 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -83,12 +83,10 @@ this code and save it to your **app/Controllers** directory: .. literalinclude:: uploaded_files/002.php -Since the value of a file upload HTML field doesn't exist, and is stored in the -``$_FILES`` global, only :ref:`rules-for-file-uploads` can be used to validate -the upload file with :doc:`validation`. +Only the :ref:`rules-for-file-uploads` can be used to validate uploaded files. -The rule ``required`` cannot be used either, so if the file is required, use -the rule ``uploaded`` instead. +Therefore, the rule ``required`` cannot be used either, so if the file is required, +use the rule ``uploaded`` instead. Note that an empty array (``[]``) is passed as the first argument to ``$this->validateData()``. It is because the file validation rules get the data From 8af1608752ffd6305e16137f480ee3e2f10fa630 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 27 May 2024 10:24:32 +0900 Subject: [PATCH 186/220] docs: make description more detailed --- user_guide_src/source/models/model.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index edc4139a4d42..bf91f0a98ce3 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -659,9 +659,14 @@ prior to saving to the database with the ``insert()``, ``update()``, or ``save() .. important:: When you update data, by default, the validation in the model class only validates provided fields. This is to avoid validation errors when updating only some fields. - But this means ``required*`` rules do not work as expected when updating. - If you want to check required fields, you can change the behavior by configuration. - See :ref:`clean-validation-rules` for details. + However, this means that not all validation rules you set will be checked + during updates. Thus, incomplete data may pass the validation. + + For example, ``required*`` rules or ``is_unique`` rule that require the + values of other fields may not work as expected. + + To avoid such glitches, this behavior can be changed by configuration. See + :ref:`clean-validation-rules` for details. Setting Validation Rules ------------------------ From e19fc097b912afc4c389c4ba31b0a7ee74bd2fff Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 27 May 2024 10:25:14 +0900 Subject: [PATCH 187/220] docs: add link to section --- user_guide_src/source/models/model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index bf91f0a98ce3..c77e68cb81b8 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -38,7 +38,7 @@ CodeIgniter does provide a model class that has a few nice features, including: - automatic database connection - basic CRUD methods -- in-model validation +- :ref:`in-model validation ` - :ref:`automatic pagination ` - and more From 6b0dfb19f4e7cb7e63d6540e0094eadc786528b5 Mon Sep 17 00:00:00 2001 From: obozdag Date: Mon, 27 May 2024 05:20:31 +0200 Subject: [PATCH 188/220] docs: Rollback the backuphandler explanation in libraries/caching.rst Rollback the backuphandler explanation in libraries/caching.rst --- user_guide_src/source/libraries/caching.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index 647055749923..169fc681f6e6 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -42,7 +42,8 @@ $backupHandler ============== In the case that the first choice ``$handler`` is not available, this is the next cache handler to load. -The default backup handler is **dummy**. +This is commonly the ``File`` handler since the file system is always available, but may not fit +more complex, multi-server setups. $prefix ======= From 798d0554046e81ef300f5dbfb53d1097b90a1941 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 28 May 2024 21:37:32 +0900 Subject: [PATCH 189/220] style: remove unneeded x permissions --- admin/starter/tests/.htaccess | 0 admin/starter/tests/index.html | 0 app/Config/DocTypes.php | 0 system/Database/SQLSRV/Builder.php | 0 system/Database/SQLSRV/Connection.php | 0 system/Database/SQLSRV/Forge.php | 0 system/Database/SQLSRV/PreparedQuery.php | 0 system/Database/SQLSRV/Result.php | 0 system/Database/SQLSRV/Utils.php | 0 system/HTTP/IncomingRequest.php | 0 system/Helpers/cookie_helper.php | 0 system/Helpers/html_helper.php | 0 system/Helpers/inflector_helper.php | 0 system/Helpers/text_helper.php | 0 system/Test/Mock/MockResponse.php | 0 tests/system/Helpers/CookieHelperTest.php | 0 tests/system/Helpers/HTMLHelperTest.php | 0 tests/system/Helpers/InflectorHelperTest.php | 0 tests/system/Helpers/NumberHelperTest.php | 0 tests/system/Helpers/TextHelperTest.php | 0 user_guide_src/source/database/query_builder.rst | 0 user_guide_src/source/general/common_functions.rst | 0 user_guide_src/source/helpers/cookie_helper.rst | 0 user_guide_src/source/helpers/html_helper.rst | 0 user_guide_src/source/helpers/inflector_helper.rst | 0 user_guide_src/source/helpers/text_helper.rst | 0 writable/.htaccess | 0 writable/cache/index.html | 0 writable/debugbar/index.html | 0 writable/index.html | 0 writable/logs/index.html | 0 writable/session/index.html | 0 writable/uploads/index.html | 0 33 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 admin/starter/tests/.htaccess mode change 100755 => 100644 admin/starter/tests/index.html mode change 100755 => 100644 app/Config/DocTypes.php mode change 100755 => 100644 system/Database/SQLSRV/Builder.php mode change 100755 => 100644 system/Database/SQLSRV/Connection.php mode change 100755 => 100644 system/Database/SQLSRV/Forge.php mode change 100755 => 100644 system/Database/SQLSRV/PreparedQuery.php mode change 100755 => 100644 system/Database/SQLSRV/Result.php mode change 100755 => 100644 system/Database/SQLSRV/Utils.php mode change 100755 => 100644 system/HTTP/IncomingRequest.php mode change 100755 => 100644 system/Helpers/cookie_helper.php mode change 100755 => 100644 system/Helpers/html_helper.php mode change 100755 => 100644 system/Helpers/inflector_helper.php mode change 100755 => 100644 system/Helpers/text_helper.php mode change 100755 => 100644 system/Test/Mock/MockResponse.php mode change 100755 => 100644 tests/system/Helpers/CookieHelperTest.php mode change 100755 => 100644 tests/system/Helpers/HTMLHelperTest.php mode change 100755 => 100644 tests/system/Helpers/InflectorHelperTest.php mode change 100755 => 100644 tests/system/Helpers/NumberHelperTest.php mode change 100755 => 100644 tests/system/Helpers/TextHelperTest.php mode change 100755 => 100644 user_guide_src/source/database/query_builder.rst mode change 100755 => 100644 user_guide_src/source/general/common_functions.rst mode change 100755 => 100644 user_guide_src/source/helpers/cookie_helper.rst mode change 100755 => 100644 user_guide_src/source/helpers/html_helper.rst mode change 100755 => 100644 user_guide_src/source/helpers/inflector_helper.rst mode change 100755 => 100644 user_guide_src/source/helpers/text_helper.rst mode change 100755 => 100644 writable/.htaccess mode change 100755 => 100644 writable/cache/index.html mode change 100755 => 100644 writable/debugbar/index.html mode change 100755 => 100644 writable/index.html mode change 100755 => 100644 writable/logs/index.html mode change 100755 => 100644 writable/session/index.html mode change 100755 => 100644 writable/uploads/index.html diff --git a/admin/starter/tests/.htaccess b/admin/starter/tests/.htaccess old mode 100755 new mode 100644 diff --git a/admin/starter/tests/index.html b/admin/starter/tests/index.html old mode 100755 new mode 100644 diff --git a/app/Config/DocTypes.php b/app/Config/DocTypes.php old mode 100755 new mode 100644 diff --git a/system/Database/SQLSRV/Builder.php b/system/Database/SQLSRV/Builder.php old mode 100755 new mode 100644 diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php old mode 100755 new mode 100644 diff --git a/system/Database/SQLSRV/Forge.php b/system/Database/SQLSRV/Forge.php old mode 100755 new mode 100644 diff --git a/system/Database/SQLSRV/PreparedQuery.php b/system/Database/SQLSRV/PreparedQuery.php old mode 100755 new mode 100644 diff --git a/system/Database/SQLSRV/Result.php b/system/Database/SQLSRV/Result.php old mode 100755 new mode 100644 diff --git a/system/Database/SQLSRV/Utils.php b/system/Database/SQLSRV/Utils.php old mode 100755 new mode 100644 diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php old mode 100755 new mode 100644 diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php old mode 100755 new mode 100644 diff --git a/system/Helpers/html_helper.php b/system/Helpers/html_helper.php old mode 100755 new mode 100644 diff --git a/system/Helpers/inflector_helper.php b/system/Helpers/inflector_helper.php old mode 100755 new mode 100644 diff --git a/system/Helpers/text_helper.php b/system/Helpers/text_helper.php old mode 100755 new mode 100644 diff --git a/system/Test/Mock/MockResponse.php b/system/Test/Mock/MockResponse.php old mode 100755 new mode 100644 diff --git a/tests/system/Helpers/CookieHelperTest.php b/tests/system/Helpers/CookieHelperTest.php old mode 100755 new mode 100644 diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php old mode 100755 new mode 100644 diff --git a/tests/system/Helpers/InflectorHelperTest.php b/tests/system/Helpers/InflectorHelperTest.php old mode 100755 new mode 100644 diff --git a/tests/system/Helpers/NumberHelperTest.php b/tests/system/Helpers/NumberHelperTest.php old mode 100755 new mode 100644 diff --git a/tests/system/Helpers/TextHelperTest.php b/tests/system/Helpers/TextHelperTest.php old mode 100755 new mode 100644 diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst old mode 100755 new mode 100644 diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst old mode 100755 new mode 100644 diff --git a/user_guide_src/source/helpers/cookie_helper.rst b/user_guide_src/source/helpers/cookie_helper.rst old mode 100755 new mode 100644 diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst old mode 100755 new mode 100644 diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst old mode 100755 new mode 100644 diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst old mode 100755 new mode 100644 diff --git a/writable/.htaccess b/writable/.htaccess old mode 100755 new mode 100644 diff --git a/writable/cache/index.html b/writable/cache/index.html old mode 100755 new mode 100644 diff --git a/writable/debugbar/index.html b/writable/debugbar/index.html old mode 100755 new mode 100644 diff --git a/writable/index.html b/writable/index.html old mode 100755 new mode 100644 diff --git a/writable/logs/index.html b/writable/logs/index.html old mode 100755 new mode 100644 diff --git a/writable/session/index.html b/writable/session/index.html old mode 100755 new mode 100644 diff --git a/writable/uploads/index.html b/writable/uploads/index.html old mode 100755 new mode 100644 From 3e90a29e6fd97942874e6c3901abb2bce8bfdab2 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 29 May 2024 17:39:03 +0700 Subject: [PATCH 190/220] chore: remove JsonThrowOnErrorRector and FinalizePublicClassConstantRector from skip() config as no longer part of sets --- rector.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/rector.php b/rector.php index b9d51f872fdc..596eb7a3da65 100644 --- a/rector.php +++ b/rector.php @@ -44,11 +44,9 @@ use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Php70\Rector\FuncCall\RandomFunctionRector; -use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; use Rector\Php80\Rector\Class_\AnnotationToAttributeRector; use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; use Rector\Php80\Rector\FunctionLike\MixedTypeRector; -use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector; use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector; @@ -107,7 +105,6 @@ __DIR__ . '/tests/_support/Commands/Foobar.php', __DIR__ . '/tests/_support/View', - JsonThrowOnErrorRector::class, YieldDataProviderRector::class, RemoveUnusedPromotedPropertyRector::class => [ @@ -174,16 +171,6 @@ ], MixedTypeRector::class, - // PHP 8.1 features but cause breaking changes - FinalizePublicClassConstantRector::class => [ - __DIR__ . '/system/Cache/Handlers/BaseHandler.php', - __DIR__ . '/system/Cache/Handlers/FileHandler.php', - __DIR__ . '/system/CodeIgniter.php', - __DIR__ . '/system/Events/Events.php', - __DIR__ . '/system/Log/Handlers/ChromeLoggerHandler.php', - __DIR__ . '/system/Log/Handlers/ErrorlogHandler.php', - __DIR__ . '/system/Security/Security.php', - ], ReturnNeverTypeRector::class => [ __DIR__ . '/system/Cache/Handlers/BaseHandler.php', __DIR__ . '/system/Cache/Handlers/MemcachedHandler.php', From e0d2cff888575d70a2a5d4e4633df250f6be6a86 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 30 May 2024 11:30:49 +0900 Subject: [PATCH 191/220] chore: add file permission check workflow --- .github/workflows/test-file-permissions.yml | 24 ++++++ utils/check_permission_x.php | 95 +++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 .github/workflows/test-file-permissions.yml create mode 100644 utils/check_permission_x.php diff --git a/.github/workflows/test-file-permissions.yml b/.github/workflows/test-file-permissions.yml new file mode 100644 index 000000000000..e6ad5949d8b4 --- /dev/null +++ b/.github/workflows/test-file-permissions.yml @@ -0,0 +1,24 @@ +name: Check File Permissions + +on: + pull_request: + push: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + permission-check: + name: Check File Permission + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Detect unnecessary execution permissions + run: php utils/check_permission_x.php diff --git a/utils/check_permission_x.php b/utils/check_permission_x.php new file mode 100644 index 000000000000..219ec5cc64e4 --- /dev/null +++ b/utils/check_permission_x.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Utils; + +require __DIR__ . '/../system/Test/bootstrap.php'; + +use CodeIgniter\CLI\CLI; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use RuntimeException; + +function findExecutableFiles($dir) +{ + $execFileList = [ + 'admin/release-userguide', + 'admin/release-deploy', + 'admin/apibot', + 'admin/alldocs', + 'admin/release', + 'admin/docbot', + 'admin/release-notes.bb', + 'admin/release-revert', + 'admin/starter/builds', + 'user_guide_src/add-edit-this-page', + ]; + + $executableFiles = []; + + // Check if the directory exists + if (! is_dir($dir)) { + throw new RuntimeException('No such directory: ' . $dir); + } + + // Create a Recursive Directory Iterator + $iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($dir) + ); + + // Iterate over each item in the directory + foreach ($iterator as $fileinfo) { + // Check if the item is a file and is executable + if ($fileinfo->isFile() && is_executable($fileinfo->getPathname())) { + $filePath = $fileinfo->getPathname(); + + // Check allow list + if (in_array($filePath, $execFileList, true)) { + continue; + } + + if (str_ends_with($filePath, '.sh')) { + continue; + } + + $executableFiles[] = $filePath; + } + } + + return $executableFiles; +} + +// Main +chdir(__DIR__ . '/../'); + +$dirs = ['admin', 'app', 'system', 'tests', 'user_guide_src', 'utils', 'writable']; + +$executableFiles = []; + +foreach ($dirs as $dir) { + $executableFiles = array_merge($executableFiles, findExecutableFiles($dir)); +} + +if ($executableFiles !== []) { + CLI::write('Files with unnecessary execution permissions were detected:', 'light_gray', 'red'); + + foreach ($executableFiles as $file) { + CLI::write('- ' . $file); + } + + exit(1); +} + +CLI::write('No files with unnecessary execution permissions were detected.', 'black', 'green'); + +exit(0); From ab796767a89167d15e04ec06cf3796aeda42e392 Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 30 May 2024 08:19:11 +0200 Subject: [PATCH 192/220] docs: Prevent text-wrap for span.pre in user guide citheme.css Add span.pre to span.std to prevent text-wrap in user guide citheme.css --- user_guide_src/source/_static/css/citheme.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/_static/css/citheme.css b/user_guide_src/source/_static/css/citheme.css index b3264e096336..fae4909dd62c 100644 --- a/user_guide_src/source/_static/css/citheme.css +++ b/user_guide_src/source/_static/css/citheme.css @@ -245,7 +245,8 @@ html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not( background-color: #fffff0; } -span.std { +span.std, +span.pre { text-wrap: nowrap; } From 4a65e2a818859c2de275004ad9d1b5ffbe5858bd Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 30 May 2024 21:42:02 +0900 Subject: [PATCH 193/220] docs: add note for View Cells typed properties --- user_guide_src/source/outgoing/view_cells.rst | 4 ++++ user_guide_src/source/outgoing/view_cells/023.php | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 user_guide_src/source/outgoing/view_cells/023.php diff --git a/user_guide_src/source/outgoing/view_cells.rst b/user_guide_src/source/outgoing/view_cells.rst index f940bc99ea17..e01bdcd53343 100644 --- a/user_guide_src/source/outgoing/view_cells.rst +++ b/user_guide_src/source/outgoing/view_cells.rst @@ -101,6 +101,10 @@ Implementing the AlertMessage from above as a Controlled Cell would look like th .. literalinclude:: view_cells/010.php +.. note:: If you use typed properties, you must set the initial values: + + .. literalinclude:: view_cells/023.php + .. _generating-cell-via-command: Generating Cell via Command diff --git a/user_guide_src/source/outgoing/view_cells/023.php b/user_guide_src/source/outgoing/view_cells/023.php new file mode 100644 index 000000000000..c892fcd683a7 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/023.php @@ -0,0 +1,13 @@ + Date: Thu, 30 May 2024 22:48:09 +0700 Subject: [PATCH 194/220] chore: remove unused path parameter on PhpStreamWrapper::stream_open() --- system/Test/PhpStreamWrapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Test/PhpStreamWrapper.php b/system/Test/PhpStreamWrapper.php index 980d5424ab62..a6be8dd1329c 100644 --- a/system/Test/PhpStreamWrapper.php +++ b/system/Test/PhpStreamWrapper.php @@ -46,7 +46,7 @@ public static function restore() stream_wrapper_restore('php'); } - public function stream_open(string $path): bool + public function stream_open(): bool { return true; } From 2ba2c45139c643bce4072e0d3f92bb5e445f42fc Mon Sep 17 00:00:00 2001 From: obozdag Date: Thu, 30 May 2024 22:34:39 +0200 Subject: [PATCH 195/220] docs: Small typo in testing/overview.rst Small typo in testing/overview.rst --- user_guide_src/source/testing/overview.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/testing/overview.rst b/user_guide_src/source/testing/overview.rst index 4052269c4ee4..8a94d6bc382c 100644 --- a/user_guide_src/source/testing/overview.rst +++ b/user_guide_src/source/testing/overview.rst @@ -76,14 +76,14 @@ There are no rules for how test files must be placed. However, we recommend that you establish placement rules in advance so that you can quickly understand where the test files are located. -In this document, we will place the test files corresponding to the classes in -the **app** directory in the **tests/app** directory. To test a new library, +In this document, the test files corresponding to the classes in the **app** directory +will be placed in the **tests/app** directory. To test a new library, **app/Libraries/Foo.php**, you would create a new file at **tests/app/Libraries/FooTest.php**: .. literalinclude:: overview/001.php -To test one of your models, **app/Models/UserMode.php**, you might end up with +To test one of your models, **app/Models/UserModel.php**, you might end up with something like this in **tests/app/Models/UserModelTest.php**: .. literalinclude:: overview/002.php @@ -121,7 +121,7 @@ parent as well so extended test cases do not interfere with staging: Traits ------ -A common way to enhance your tests is by using traits to consolidate staging across different +A common way to enhance your tests is using traits to consolidate staging across different test cases. ``CIUnitTestCase`` will detect any class traits and look for staging methods to run named for the trait itself (i.e. `setUp{NameOfTrait}()` and `tearDown{NameOfTrait}()`). From 10a07398a4ff2ad943473f5f081ac6d3759b53a6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 2 Jun 2024 18:05:40 +0900 Subject: [PATCH 196/220] test: add test cases --- tests/system/Helpers/NumberHelperTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/system/Helpers/NumberHelperTest.php b/tests/system/Helpers/NumberHelperTest.php index 9b3afa61992f..7e5fe2a358c4 100644 --- a/tests/system/Helpers/NumberHelperTest.php +++ b/tests/system/Helpers/NumberHelperTest.php @@ -38,6 +38,11 @@ public function testRomanNumber(): void $this->assertSame('X', number_to_roman(10)); } + public function testRomanNumberString(): void + { + $this->assertSame('XCVI', number_to_roman('96')); + } + public function testRomanNumberRange(): void { $this->assertNull(number_to_roman(-1)); @@ -70,6 +75,11 @@ public function testNumberToSize(): void $this->assertSame('456 Bytes', number_to_size(456, 1, 'en_US')); } + public function testNumberToSizeString(): void + { + $this->assertSame('456 Bytes', number_to_size('456', 1, 'en_US')); + } + public function testKbFormat(): void { $this->assertSame('4.5 KB', number_to_size(4567, 1, 'en_US')); @@ -109,6 +119,11 @@ public function testThousands(): void $this->assertSame('1,000 thousand', number_to_amount('999999', 0, 'en_US')); } + public function testThousandsInt(): void + { + $this->assertSame('123 thousand', number_to_amount(123000, 0, 'en_US')); + } + public function testMillions(): void { $this->assertSame('123.4 million', number_to_amount('123,400,000', 1, 'en_US')); From 3d6436ed4666732f0008da27cf3ffd943720150d Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 2 Jun 2024 18:06:41 +0900 Subject: [PATCH 197/220] fix: TypeError in number_to_amount() TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given --- system/Helpers/number_helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 96468ddcdea3..0999d200f99b 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -82,8 +82,9 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null) // Strip any formatting & ensure numeric input try { // @phpstan-ignore-next-line - $num = 0 + str_replace(',', '', $num); + $num = 0 + str_replace(',', '', (string) $num); } catch (ErrorException) { + // Catch "Warning: A non-numeric value encountered" return false; } From ca09944c251e0a398c1348ba9f23fe5b64248e96 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 31 May 2024 14:28:22 +0700 Subject: [PATCH 198/220] docs: replace Service class to service() --- user_guide_src/source/concepts/services.rst | 8 +++++--- user_guide_src/source/concepts/services/002.php | 3 +++ user_guide_src/source/concepts/services/012.php | 2 +- user_guide_src/source/concepts/services/013.php | 2 +- user_guide_src/source/concepts/services/014.php | 2 +- user_guide_src/source/concepts/services/015.php | 4 ++-- user_guide_src/source/extending/basecontroller/003.php | 2 +- user_guide_src/source/general/common_functions.rst | 4 ++-- user_guide_src/source/general/errors/018.php | 2 +- .../source/incoming/content_negotiation/001.php | 2 +- user_guide_src/source/incoming/incomingrequest/002.php | 2 +- user_guide_src/source/incoming/incomingrequest/003.php | 2 +- user_guide_src/source/libraries/caching.rst | 2 +- user_guide_src/source/libraries/caching/002.php | 2 +- user_guide_src/source/libraries/cookies/002.php | 2 +- user_guide_src/source/libraries/cookies/003.php | 2 +- user_guide_src/source/libraries/cookies/007.php | 4 +--- user_guide_src/source/libraries/cookies/009.php | 3 +-- user_guide_src/source/libraries/cookies/010.php | 2 +- user_guide_src/source/libraries/cookies/013.php | 4 +--- user_guide_src/source/libraries/cookies/014.php | 1 - user_guide_src/source/libraries/cookies/015.php | 6 ++---- user_guide_src/source/libraries/cookies/017.php | 3 +-- user_guide_src/source/libraries/curlrequest.rst | 2 +- user_guide_src/source/libraries/curlrequest/002.php | 3 +++ user_guide_src/source/libraries/curlrequest/003.php | 2 +- user_guide_src/source/libraries/curlrequest/004.php | 6 ++++-- user_guide_src/source/libraries/curlrequest/005.php | 2 +- user_guide_src/source/libraries/curlrequest/008.php | 2 +- user_guide_src/source/libraries/email/001.php | 2 +- user_guide_src/source/libraries/encryption/001.php | 2 +- user_guide_src/source/libraries/encryption/003.php | 6 ++++-- user_guide_src/source/libraries/encryption/013.php | 5 ++--- user_guide_src/source/libraries/images.rst | 6 +++--- user_guide_src/source/libraries/images/001.php | 2 +- user_guide_src/source/libraries/images/002.php | 2 +- user_guide_src/source/libraries/images/007.php | 2 +- user_guide_src/source/libraries/images/008.php | 4 ++-- user_guide_src/source/libraries/images/009.php | 2 +- user_guide_src/source/libraries/images/010.php | 2 +- user_guide_src/source/libraries/images/011.php | 4 ++-- user_guide_src/source/libraries/images/012.php | 2 +- user_guide_src/source/libraries/images/013.php | 2 +- user_guide_src/source/libraries/images/014.php | 2 +- user_guide_src/source/libraries/pagination/001.php | 2 +- user_guide_src/source/libraries/pagination/002.php | 4 +++- user_guide_src/source/libraries/pagination/003.php | 4 +++- user_guide_src/source/libraries/pagination/004.php | 7 +++++-- user_guide_src/source/libraries/pagination/005.php | 4 +++- user_guide_src/source/libraries/pagination/018.php | 4 +++- user_guide_src/source/libraries/security/001.php | 2 +- user_guide_src/source/libraries/sessions/001.php | 2 +- user_guide_src/source/libraries/throttler/001.php | 2 +- user_guide_src/source/libraries/throttler/002.php | 5 ++--- user_guide_src/source/libraries/typography/001.php | 2 +- user_guide_src/source/libraries/validation/004.php | 2 +- user_guide_src/source/libraries/validation/008.php | 4 ++-- user_guide_src/source/libraries/validation/044.php | 2 +- user_guide_src/source/libraries/validation/046.php | 6 +++--- user_guide_src/source/outgoing/view_parser/001.php | 2 +- user_guide_src/source/outgoing/view_renderer/001.php | 2 +- user_guide_src/source/testing/benchmark/001.php | 2 +- 62 files changed, 99 insertions(+), 87 deletions(-) diff --git a/user_guide_src/source/concepts/services.rst b/user_guide_src/source/concepts/services.rst index a3dc9fabb74d..24ee8ec5be65 100644 --- a/user_guide_src/source/concepts/services.rst +++ b/user_guide_src/source/concepts/services.rst @@ -37,7 +37,7 @@ come in handy. Instead of creating the instance ourself, we let a central class create an instance of the class for us. This class is kept very simple. It only contains a method for each class that we want to use as a service. The method typically returns a **shared instance** of that class, passing any dependencies -it might have into it. Then, we would replace our timer creation code with code that calls this new class: +it might have into it. Then, we would replace our timer creation code with code that calls this global function or Service class: .. literalinclude:: services/002.php @@ -55,7 +55,7 @@ As many CodeIgniter classes are provided as services, you can get them like the .. literalinclude:: services/013.php -The ``$typography`` is an instance of the Typography class, and if you call ``\Config\Services::typography()`` again, you will get the exactly same instance. +The ``$timer`` is an instance of the Timer class, and if you call ``service('timer')`` again, you will get the exactly same instance. The Services typically return a **shared instance** of the class. The following code creates a ``CURLRequest`` instance at the first call. And the second call returns the exactly same instance. @@ -66,7 +66,7 @@ Therefore, the parameter ``$options2`` for the ``$client2`` does not work. It is Getting a New Instance ====================== -If you want to get a new instance of the Typography class, you need to pass ``false`` to the argument ``$getShared``: +If you want to get a new instance of the Timer class, you need to pass ``false`` to the argument ``$getShared``: .. literalinclude:: services/014.php @@ -85,6 +85,8 @@ always return the same instance: .. literalinclude:: services/003.php +.. note:: Since `v4.5.0`, the global function ``service()`` is recommended due to performance improvements on without parameter + If the creation method requires additional parameters, they can be passed after the service name: .. literalinclude:: services/004.php diff --git a/user_guide_src/source/concepts/services/002.php b/user_guide_src/source/concepts/services/002.php index cb292ecaeb42..cedf5d19ed65 100644 --- a/user_guide_src/source/concepts/services/002.php +++ b/user_guide_src/source/concepts/services/002.php @@ -1,3 +1,6 @@ 'http://example.com/api/v1/', 'timeout' => 3, ]; -$client1 = \Config\Services::curlrequest($options1); +$client1 = service('curlrequest', $options1); $options2 = [ 'baseURI' => 'http://another.example.com/api/v2/', 'timeout' => 10, ]; -$client2 = \Config\Services::curlrequest($options2); +$client2 = service('curlrequest', $options2); // $options2 does not work. // $client2 is the exactly same instance as $client1. diff --git a/user_guide_src/source/extending/basecontroller/003.php b/user_guide_src/source/extending/basecontroller/003.php index 2f6fcb9d08cb..b7bcab22545d 100644 --- a/user_guide_src/source/extending/basecontroller/003.php +++ b/user_guide_src/source/extending/basecontroller/003.php @@ -18,6 +18,6 @@ public function initController(/* ... */) // Do Not Edit This Line parent::initController($request, $response, $logger); - $this->session = \Config\Services::session(); + $this->session = service('session'); } } diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 61b92a99df92..d0a23758e348 100644 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -372,7 +372,7 @@ Miscellaneous Functions :returns: The shared Request object. :rtype: IncomingRequest|CLIRequest - This function is a wrapper for ``Services::request()``. + This function is a wrapper for ``Services::request()`` and ``service('request')``. .. php:function:: response() @@ -381,7 +381,7 @@ Miscellaneous Functions :returns: The shared Response object. :rtype: Response - This function is a wrapper for ``Services::response()``. + This function is a wrapper for ``Services::response()`` and ``service('response')``. .. php:function:: route_to($method[, ...$params]) diff --git a/user_guide_src/source/general/errors/018.php b/user_guide_src/source/general/errors/018.php index 3cba09951d8b..9546e4a606ae 100644 --- a/user_guide_src/source/general/errors/018.php +++ b/user_guide_src/source/general/errors/018.php @@ -1,6 +1,6 @@ redirect('https://example.com/path') ->setHeader('Some', 'header') ->setCookie('and', 'cookie'); diff --git a/user_guide_src/source/incoming/content_negotiation/001.php b/user_guide_src/source/incoming/content_negotiation/001.php index 3c55e788eff9..fbd07a975ee3 100644 --- a/user_guide_src/source/incoming/content_negotiation/001.php +++ b/user_guide_src/source/incoming/content_negotiation/001.php @@ -1,3 +1,3 @@ get('foo'); diff --git a/user_guide_src/source/libraries/cookies/002.php b/user_guide_src/source/libraries/cookies/002.php index 8c2fb03fea9d..ecbe37ed088b 100644 --- a/user_guide_src/source/libraries/cookies/002.php +++ b/user_guide_src/source/libraries/cookies/002.php @@ -4,7 +4,7 @@ use Config\Cookie as CookieConfig; // pass in a Config\Cookie instance before constructing a Cookie class -Cookie::setDefaults(new CookieConfig()); +Cookie::setDefaults(config(CookieConfig::class)); $cookie = new Cookie('login_token'); // pass in an array of defaults diff --git a/user_guide_src/source/libraries/cookies/003.php b/user_guide_src/source/libraries/cookies/003.php index f878ff8592d1..6e9094fe7b77 100644 --- a/user_guide_src/source/libraries/cookies/003.php +++ b/user_guide_src/source/libraries/cookies/003.php @@ -3,7 +3,7 @@ use CodeIgniter\Cookie\Cookie; use Config\Cookie as CookieConfig; -$oldDefaults = Cookie::setDefaults(new CookieConfig()); +$oldDefaults = Cookie::setDefaults(config(CookieConfig::class)); $cookie = new Cookie('my_token', 'muffins'); // return the old defaults diff --git a/user_guide_src/source/libraries/cookies/007.php b/user_guide_src/source/libraries/cookies/007.php index ff79582a5d07..ea4dcc97876f 100644 --- a/user_guide_src/source/libraries/cookies/007.php +++ b/user_guide_src/source/libraries/cookies/007.php @@ -1,5 +1,3 @@ getCookieStore(); +$cookieStore = service('response')->getCookieStore(); diff --git a/user_guide_src/source/libraries/cookies/009.php b/user_guide_src/source/libraries/cookies/009.php index 6db5a50bfc1e..3e73bb0cafaf 100644 --- a/user_guide_src/source/libraries/cookies/009.php +++ b/user_guide_src/source/libraries/cookies/009.php @@ -2,7 +2,6 @@ use CodeIgniter\Cookie\Cookie; use CodeIgniter\Cookie\CookieStore; -use Config\Services; // check if cookie is in the current cookie collection $store = new CookieStore([ @@ -13,7 +12,7 @@ // check if cookie is in the current Response's cookie collection cookies()->has('login_token'); -Services::response()->hasCookie('remember_token'); +service('response')->hasCookie('remember_token'); // using the cookie helper to check the current Response // not available to v4.1.1 and lower diff --git a/user_guide_src/source/libraries/cookies/010.php b/user_guide_src/source/libraries/cookies/010.php index 8211a4a2b23e..b2a18323cdac 100644 --- a/user_guide_src/source/libraries/cookies/010.php +++ b/user_guide_src/source/libraries/cookies/010.php @@ -13,7 +13,7 @@ // getting cookie in the current Response's cookie collection cookies()->get('login_token'); -Services::response()->getCookie('remember_token'); +service('response')->getCookie('remember_token'); // using the cookie helper to get cookie from the Response's cookie collection helper('cookie'); diff --git a/user_guide_src/source/libraries/cookies/013.php b/user_guide_src/source/libraries/cookies/013.php index 6dcb79807380..80052c7c9218 100644 --- a/user_guide_src/source/libraries/cookies/013.php +++ b/user_guide_src/source/libraries/cookies/013.php @@ -1,11 +1,9 @@ get(); // array of Cookie objects // alternatively, you can use the display method cookies()->display(); // or even from the Response -Services::response()->getCookies(); +service('response')->getCookies(); diff --git a/user_guide_src/source/libraries/cookies/014.php b/user_guide_src/source/libraries/cookies/014.php index 0e6ae6772146..9be64c5cf651 100644 --- a/user_guide_src/source/libraries/cookies/014.php +++ b/user_guide_src/source/libraries/cookies/014.php @@ -2,7 +2,6 @@ use CodeIgniter\Cookie\Cookie; use CodeIgniter\Cookie\CookieStore; -use Config\Services; $store = new CookieStore([ new Cookie('login_token'), diff --git a/user_guide_src/source/libraries/cookies/015.php b/user_guide_src/source/libraries/cookies/015.php index 040a2f8a9882..696e9c7c73d3 100644 --- a/user_guide_src/source/libraries/cookies/015.php +++ b/user_guide_src/source/libraries/cookies/015.php @@ -1,9 +1,7 @@ setCookie('admin_token', 'yes'); -Services::response()->deleteCookie('login_token'); +service('response')->setCookie('admin_token', 'yes'); +service('response')->deleteCookie('login_token'); // using the cookie helper helper('cookie'); diff --git a/user_guide_src/source/libraries/cookies/017.php b/user_guide_src/source/libraries/cookies/017.php index eadbc8083e98..4cc1fe4a67a6 100644 --- a/user_guide_src/source/libraries/cookies/017.php +++ b/user_guide_src/source/libraries/cookies/017.php @@ -1,9 +1,8 @@ `. -To load with the Services class call the ``curlrequest()`` method: +To load with the Services class call the ``curlrequest()`` method or global function ``service()``: .. literalinclude:: curlrequest/002.php diff --git a/user_guide_src/source/libraries/curlrequest/002.php b/user_guide_src/source/libraries/curlrequest/002.php index 5d84bfe442b5..ae7264ffdcdb 100644 --- a/user_guide_src/source/libraries/curlrequest/002.php +++ b/user_guide_src/source/libraries/curlrequest/002.php @@ -1,3 +1,6 @@ 'http://example.com/api/v1/', 'timeout' => 3, ]; -$client = \Config\Services::curlrequest($options); +$client = service('curlrequest', $options); diff --git a/user_guide_src/source/libraries/curlrequest/004.php b/user_guide_src/source/libraries/curlrequest/004.php index 4d6a14fadbb0..654d72d2687f 100644 --- a/user_guide_src/source/libraries/curlrequest/004.php +++ b/user_guide_src/source/libraries/curlrequest/004.php @@ -1,8 +1,10 @@ request('GET', 'https://api.github.com/user', [ 'auth' => ['user', 'pass'], diff --git a/user_guide_src/source/libraries/curlrequest/008.php b/user_guide_src/source/libraries/curlrequest/008.php index 611909c2df7d..2f14c6974cd0 100644 --- a/user_guide_src/source/libraries/curlrequest/008.php +++ b/user_guide_src/source/libraries/curlrequest/008.php @@ -1,6 +1,6 @@ 'https://example.com/api/v1/', ]); diff --git a/user_guide_src/source/libraries/email/001.php b/user_guide_src/source/libraries/email/001.php index 914193c15203..f7873714bab5 100644 --- a/user_guide_src/source/libraries/email/001.php +++ b/user_guide_src/source/libraries/email/001.php @@ -1,6 +1,6 @@ setFrom('your@example.com', 'Your Name'); $email->setTo('someone@example.com'); diff --git a/user_guide_src/source/libraries/encryption/001.php b/user_guide_src/source/libraries/encryption/001.php index 8f840be59245..1481d20c2758 100644 --- a/user_guide_src/source/libraries/encryption/001.php +++ b/user_guide_src/source/libraries/encryption/001.php @@ -1,3 +1,3 @@ key = 'aBigsecret_ofAtleast32Characters'; $config->driver = 'OpenSSL'; -$encrypter = \Config\Services::encrypter($config); +$encrypter = service('encrypter', $config); diff --git a/user_guide_src/source/libraries/encryption/013.php b/user_guide_src/source/libraries/encryption/013.php index c49d282f42da..06eb6b0de807 100644 --- a/user_guide_src/source/libraries/encryption/013.php +++ b/user_guide_src/source/libraries/encryption/013.php @@ -1,9 +1,8 @@ driver = 'OpenSSL'; // Your CI3's 'encryption_key' @@ -15,4 +14,4 @@ $config->encryptKeyInfo = 'encryption'; $config->authKeyInfo = 'authentication'; -$encrypter = Services::encrypter($config, false); +$encrypter = service('encrypter', $config); diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index 08efccfe92f9..cfb7dce8f628 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -22,12 +22,12 @@ Initializing the Class ********************** Like most other classes in CodeIgniter, the image class is initialized -in your controller by calling the Services class: +in your controller by calling the global function service: .. literalinclude:: images/001.php -You can pass the alias for the image library you wish to use into the -Service function: +You can pass the alias for the image library you wish to use into the global +function service: .. literalinclude:: images/002.php diff --git a/user_guide_src/source/libraries/images/001.php b/user_guide_src/source/libraries/images/001.php index 780bb37b3a4d..3001f4561029 100644 --- a/user_guide_src/source/libraries/images/001.php +++ b/user_guide_src/source/libraries/images/001.php @@ -1,3 +1,3 @@ withFile('/path/to/image/mypic.jpg') diff --git a/user_guide_src/source/libraries/images/008.php b/user_guide_src/source/libraries/images/008.php index 01406733d31b..a7963d420573 100644 --- a/user_guide_src/source/libraries/images/008.php +++ b/user_guide_src/source/libraries/images/008.php @@ -1,6 +1,6 @@ withFile('/path/to/image/mypic.jpg') ->getFile() ->getProperties(true); @@ -8,7 +8,7 @@ $xOffset = ($info['width'] / 2) - 25; $yOffset = ($info['height'] / 2) - 25; -\Config\Services::image('imagick') +service('image', 'imagick') ->withFile('/path/to/image/mypic.jpg') ->crop(50, 50, $xOffset, $yOffset) ->save('/path/to/new/image.jpg'); diff --git a/user_guide_src/source/libraries/images/009.php b/user_guide_src/source/libraries/images/009.php index 6314181ef435..e24cfcc40a4a 100644 --- a/user_guide_src/source/libraries/images/009.php +++ b/user_guide_src/source/libraries/images/009.php @@ -1,6 +1,6 @@ withFile('/path/to/image/mypic.jpg') ->convert(IMAGETYPE_PNG) ->save('/path/to/new/image.png'); diff --git a/user_guide_src/source/libraries/images/010.php b/user_guide_src/source/libraries/images/010.php index b70b179815cd..696eab880516 100644 --- a/user_guide_src/source/libraries/images/010.php +++ b/user_guide_src/source/libraries/images/010.php @@ -1,6 +1,6 @@ withFile('/path/to/image/mypic.jpg') ->fit(100, 150, 'left') ->save('/path/to/new/image.jpg'); diff --git a/user_guide_src/source/libraries/images/011.php b/user_guide_src/source/libraries/images/011.php index f18fb55545a1..e816af48c647 100644 --- a/user_guide_src/source/libraries/images/011.php +++ b/user_guide_src/source/libraries/images/011.php @@ -1,11 +1,11 @@ withFile('/path/to/image/mypic.png') ->flatten() ->save('/path/to/new/image.jpg'); -\Config\Services::image('imagick') +service('image', 'imagick') ->withFile('/path/to/image/mypic.png') ->flatten(25, 25, 112) ->save('/path/to/new/image.jpg'); diff --git a/user_guide_src/source/libraries/images/012.php b/user_guide_src/source/libraries/images/012.php index 581a984238bd..eb99b11ae3b1 100644 --- a/user_guide_src/source/libraries/images/012.php +++ b/user_guide_src/source/libraries/images/012.php @@ -1,6 +1,6 @@ withFile('/path/to/image/mypic.jpg') ->flip('horizontal') ->save('/path/to/new/image.jpg'); diff --git a/user_guide_src/source/libraries/images/013.php b/user_guide_src/source/libraries/images/013.php index c51a7126be8d..7c1780565a5d 100644 --- a/user_guide_src/source/libraries/images/013.php +++ b/user_guide_src/source/libraries/images/013.php @@ -1,6 +1,6 @@ withFile('/path/to/image/mypic.jpg') ->resize(200, 100, true, 'height') ->save('/path/to/new/image.jpg'); diff --git a/user_guide_src/source/libraries/images/014.php b/user_guide_src/source/libraries/images/014.php index 32943ed142c6..cfe551a4c411 100644 --- a/user_guide_src/source/libraries/images/014.php +++ b/user_guide_src/source/libraries/images/014.php @@ -1,6 +1,6 @@ withFile('/path/to/image/mypic.jpg') ->text('Copyright 2017 My Photo Co', [ 'color' => '#fff', diff --git a/user_guide_src/source/libraries/pagination/001.php b/user_guide_src/source/libraries/pagination/001.php index ec86f0e73490..4b67fd5511de 100644 --- a/user_guide_src/source/libraries/pagination/001.php +++ b/user_guide_src/source/libraries/pagination/001.php @@ -1,3 +1,3 @@ $model->paginate(10), diff --git a/user_guide_src/source/libraries/pagination/003.php b/user_guide_src/source/libraries/pagination/003.php index 6ea631c7a9bc..262385ea0eb8 100644 --- a/user_guide_src/source/libraries/pagination/003.php +++ b/user_guide_src/source/libraries/pagination/003.php @@ -1,7 +1,9 @@ $model->where('ban', 1)->paginate(10), diff --git a/user_guide_src/source/libraries/pagination/004.php b/user_guide_src/source/libraries/pagination/004.php index a8ef4d296125..b7af3ec83d2a 100644 --- a/user_guide_src/source/libraries/pagination/004.php +++ b/user_guide_src/source/libraries/pagination/004.php @@ -2,12 +2,15 @@ namespace App\Controllers; +use App\Models\PageModel; +use App\Models\UserModel; + class UserController extends BaseController { public function index() { - $userModel = new \App\Models\UserModel(); - $pageModel = new \App\Models\PageModel(); + $userModel = model(UserModel::class); + $pageModel = model(PageModel::class); $data = [ 'users' => $userModel->paginate(10, 'group1'), diff --git a/user_guide_src/source/libraries/pagination/005.php b/user_guide_src/source/libraries/pagination/005.php index dec2c3161e76..2dc3405b8a62 100644 --- a/user_guide_src/source/libraries/pagination/005.php +++ b/user_guide_src/source/libraries/pagination/005.php @@ -1,6 +1,8 @@ paginate(10, 'group1', $page); diff --git a/user_guide_src/source/libraries/pagination/018.php b/user_guide_src/source/libraries/pagination/018.php index 002d034a643c..afabd1c8c998 100644 --- a/user_guide_src/source/libraries/pagination/018.php +++ b/user_guide_src/source/libraries/pagination/018.php @@ -1,7 +1,9 @@ $model->banned()->paginate(10), diff --git a/user_guide_src/source/libraries/security/001.php b/user_guide_src/source/libraries/security/001.php index fe504ef35a8e..f81de1a9432c 100644 --- a/user_guide_src/source/libraries/security/001.php +++ b/user_guide_src/source/libraries/security/001.php @@ -1,3 +1,3 @@ check($name, 60, MINUTE); diff --git a/user_guide_src/source/libraries/throttler/002.php b/user_guide_src/source/libraries/throttler/002.php index 440ad582245b..9e3fec98c963 100644 --- a/user_guide_src/source/libraries/throttler/002.php +++ b/user_guide_src/source/libraries/throttler/002.php @@ -5,7 +5,6 @@ use CodeIgniter\Filters\FilterInterface; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; -use Config\Services; class Throttle implements FilterInterface { @@ -19,12 +18,12 @@ class Throttle implements FilterInterface */ public function before(RequestInterface $request, $arguments = null) { - $throttler = Services::throttler(); + $throttler = service('throttler'); // Restrict an IP address to no more than 1 request // per second across the entire site. if ($throttler->check(md5($request->getIPAddress()), 60, MINUTE) === false) { - return Services::response()->setStatusCode(429); + return service('response')->setStatusCode(429); } } diff --git a/user_guide_src/source/libraries/typography/001.php b/user_guide_src/source/libraries/typography/001.php index 0c82ed0e95fa..9685611c7691 100644 --- a/user_guide_src/source/libraries/typography/001.php +++ b/user_guide_src/source/libraries/typography/001.php @@ -1,3 +1,3 @@ withRequest($request)->run()) { // If you use the input data, you should get it from the getValidated() method. diff --git a/user_guide_src/source/libraries/validation/044.php b/user_guide_src/source/libraries/validation/044.php index 7f3a0e0e0902..df2598d1906c 100644 --- a/user_guide_src/source/libraries/validation/044.php +++ b/user_guide_src/source/libraries/validation/044.php @@ -1,6 +1,6 @@ setRules([ 'username' => 'required', 'password' => 'required|min_length[10]', diff --git a/user_guide_src/source/libraries/validation/046.php b/user_guide_src/source/libraries/validation/046.php index f37def009eba..34dea12ceeef 100644 --- a/user_guide_src/source/libraries/validation/046.php +++ b/user_guide_src/source/libraries/validation/046.php @@ -2,8 +2,6 @@ namespace App\Controllers; -use Config\Services; - class Form extends BaseController { // Define a custom validation rule. @@ -16,7 +14,9 @@ public function process() { // ... - $validation = Services::validation(); + $data = []; + + $validation = service('validation'); $validation->setRules( [ 'foo' => [ diff --git a/user_guide_src/source/outgoing/view_parser/001.php b/user_guide_src/source/outgoing/view_parser/001.php index 56f7f51e4a07..e9f733df13e4 100644 --- a/user_guide_src/source/outgoing/view_parser/001.php +++ b/user_guide_src/source/outgoing/view_parser/001.php @@ -1,3 +1,3 @@ start('render view'); From a1690e8656e9fabfa171e32946d06e64ae1290b5 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 31 May 2024 14:58:16 +0700 Subject: [PATCH 199/220] docs: typo Services --- user_guide_src/source/concepts/services.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/services.rst b/user_guide_src/source/concepts/services.rst index 24ee8ec5be65..39620f44bca6 100644 --- a/user_guide_src/source/concepts/services.rst +++ b/user_guide_src/source/concepts/services.rst @@ -37,7 +37,7 @@ come in handy. Instead of creating the instance ourself, we let a central class create an instance of the class for us. This class is kept very simple. It only contains a method for each class that we want to use as a service. The method typically returns a **shared instance** of that class, passing any dependencies -it might have into it. Then, we would replace our timer creation code with code that calls this global function or Service class: +it might have into it. Then, we would replace our timer creation code with code that calls this global function or Services class: .. literalinclude:: services/002.php From 6be5e3cbdba02661c87f312363f96f38f7a39a18 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Fri, 31 May 2024 15:54:06 +0700 Subject: [PATCH 200/220] Update user_guide_src/source/libraries/images.rst Co-authored-by: kenjis --- user_guide_src/source/libraries/images.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index cfb7dce8f628..232174765c91 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -27,7 +27,7 @@ in your controller by calling the global function service: .. literalinclude:: images/001.php You can pass the alias for the image library you wish to use into the global -function service: +function ``service()``: .. literalinclude:: images/002.php From c3323b441838cc0a5327806fc2842a070599b03f Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Fri, 31 May 2024 15:54:24 +0700 Subject: [PATCH 201/220] Update user_guide_src/source/libraries/images.rst Co-authored-by: kenjis --- user_guide_src/source/libraries/images.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/images.rst b/user_guide_src/source/libraries/images.rst index 232174765c91..a439c3321a0b 100644 --- a/user_guide_src/source/libraries/images.rst +++ b/user_guide_src/source/libraries/images.rst @@ -22,7 +22,7 @@ Initializing the Class ********************** Like most other classes in CodeIgniter, the image class is initialized -in your controller by calling the global function service: +in your controller by calling the global function ``service()``: .. literalinclude:: images/001.php From ef9c3e5a56d54dec355a7ced58bd19551d32f25d Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Fri, 31 May 2024 15:54:36 +0700 Subject: [PATCH 202/220] Update user_guide_src/source/libraries/caching.rst Co-authored-by: kenjis --- user_guide_src/source/libraries/caching.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index 5e1fa7368811..f4adc04a93df 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -19,7 +19,7 @@ The following example shows a common usage pattern within your controllers. .. literalinclude:: caching/001.php -You can grab an instance of the cache engine directly through the global function service: +You can grab an instance of the cache engine directly through the global function ``service()``: .. literalinclude:: caching/002.php From 107c99baede6e640586a1283d81cce3e641b4c27 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Fri, 31 May 2024 15:54:44 +0700 Subject: [PATCH 203/220] Update user_guide_src/source/concepts/services.rst Co-authored-by: kenjis --- user_guide_src/source/concepts/services.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/services.rst b/user_guide_src/source/concepts/services.rst index 39620f44bca6..92eec136e1c8 100644 --- a/user_guide_src/source/concepts/services.rst +++ b/user_guide_src/source/concepts/services.rst @@ -85,7 +85,7 @@ always return the same instance: .. literalinclude:: services/003.php -.. note:: Since `v4.5.0`, the global function ``service()`` is recommended due to performance improvements on without parameter +.. note:: Since v4.5.0, when you don't pass parameters to the service, the global function ``service()`` is recommended due to performance improvements. If the creation method requires additional parameters, they can be passed after the service name: From 2b0bbf55c60578b92b883b18729f563695838bd4 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Fri, 31 May 2024 15:56:11 +0700 Subject: [PATCH 204/220] docs: no use config() --- user_guide_src/source/libraries/encryption/013.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/encryption/013.php b/user_guide_src/source/libraries/encryption/013.php index 06eb6b0de807..f7ef52060b6b 100644 --- a/user_guide_src/source/libraries/encryption/013.php +++ b/user_guide_src/source/libraries/encryption/013.php @@ -2,7 +2,7 @@ use Config\Encryption; -$config = config(Encryption::class); +$config = new Encryption(); $config->driver = 'OpenSSL'; // Your CI3's 'encryption_key' From 1c27fd410916eaf84e35dfb236be1a8ac0718976 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Sun, 2 Jun 2024 21:39:38 +0700 Subject: [PATCH 205/220] docs: remove variable --- user_guide_src/source/libraries/validation/046.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide_src/source/libraries/validation/046.php b/user_guide_src/source/libraries/validation/046.php index 34dea12ceeef..d9c244cdf31e 100644 --- a/user_guide_src/source/libraries/validation/046.php +++ b/user_guide_src/source/libraries/validation/046.php @@ -14,8 +14,6 @@ public function process() { // ... - $data = []; - $validation = service('validation'); $validation->setRules( [ From fb816b15352fb2d8bd3be82948523d6b65f785d0 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jun 2024 17:34:43 +0900 Subject: [PATCH 206/220] test: add tests for Model::find() with casts --- .../system/Models/DataConverterModelTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/system/Models/DataConverterModelTest.php b/tests/system/Models/DataConverterModelTest.php index 4dd6da072f5e..f243871526f3 100644 --- a/tests/system/Models/DataConverterModelTest.php +++ b/tests/system/Models/DataConverterModelTest.php @@ -100,6 +100,28 @@ public function testFindAsEntity(): void $this->assertInstanceOf(Time::class, $user->created_at); } + public function testFindArrayAsEntity(): void + { + $id = $this->prepareOneRecord(); + + $users = $this->model->asObject(User::class)->find([$id, 999]); + + $this->assertCount(1, $users); + $this->assertIsInt($users[0]->id); + $this->assertInstanceOf(Time::class, $users[0]->created_at); + } + + public function testFindNullAsEntity(): void + { + $this->prepareOneRecord(); + + $users = $this->model->asObject(User::class)->find(); + + $this->assertCount(1, $users); + $this->assertIsInt($users[0]->id); + $this->assertInstanceOf(Time::class, $users[0]->created_at); + } + public function testFindAllAsArray(): void { $this->prepareTwoRecords(); From 977059bbc8f3614ee77e7f4c20e742a1c6e7a6cf Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jun 2024 17:19:24 +0900 Subject: [PATCH 207/220] fix: Model::find() returns incorrect data with casting --- system/Model.php | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/system/Model.php b/system/Model.php index 03ca7525ec76..d5df3f861b97 100644 --- a/system/Model.php +++ b/system/Model.php @@ -174,7 +174,7 @@ public function setTable(string $table) } /** - * Fetches the row of database from $this->table with a primary key + * Fetches the row(s) of database from $this->table with a primary key * matching $id. * This method works only with dbCalls. * @@ -198,8 +198,11 @@ protected function doFind(bool $singleton, $id = null) $builder->where($this->table . '.' . $this->deletedField, null); } + $row = null; + $rows = []; + if (is_array($id)) { - $row = $builder->whereIn($this->table . '.' . $this->primaryKey, $id) + $rows = $builder->whereIn($this->table . '.' . $this->primaryKey, $id) ->get() ->getResult($this->tempReturnType); } elseif ($singleton) { @@ -207,16 +210,32 @@ protected function doFind(bool $singleton, $id = null) ->get() ->getFirstRow($this->tempReturnType); } else { - $row = $builder->get()->getResult($this->tempReturnType); + $rows = $builder->get()->getResult($this->tempReturnType); } - if ($useCast && $row !== null) { - $row = $this->convertToReturnType($row, $returnType); - + if ($useCast) { $this->tempReturnType = $returnType; + + if ($singleton) { + if ($row === null) { + return null; + } + + return $this->convertToReturnType($row, $returnType); + } + + foreach ($rows as $i => $row) { + $rows[$i] = $this->convertToReturnType($row, $returnType); + } + + return $rows; } - return $row; + if ($singleton) { + return $row; + } + + return $rows; } /** @@ -230,15 +249,7 @@ protected function doFind(bool $singleton, $id = null) */ protected function doFindColumn(string $columnName) { - $results = $this->select($columnName)->asArray()->find(); - - if ($this->useCasts()) { - foreach ($results as $i => $row) { - $results[$i] = $this->converter->fromDataSource($row); - } - } - - return $results; + return $this->select($columnName)->asArray()->find(); } /** From 579a4730b811b8bb9c9338922cec0e88978401a6 Mon Sep 17 00:00:00 2001 From: obozdag Date: Wed, 5 Jun 2024 11:26:28 +0200 Subject: [PATCH 208/220] docs: Change HTML 'tag's to 'element's in helpers/form_helper.rst Change HTML 'tag's to 'element's in helpers/form_helper.rst --- user_guide_src/source/helpers/form_helper.rst | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 68c7090408df..206aa216b6c5 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -145,7 +145,7 @@ The following functions are available: :param string $name: Field name :param string $value: Field value - :returns: An HTML hidden input field tag + :returns: An HTML hidden input element :rtype: string Lets you generate hidden input fields. You can either submit a @@ -171,7 +171,7 @@ The following functions are available: :param string $value: Field value :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string :param string $type: The type of input field. i.e., 'text', 'email', 'number', etc. - :returns: An HTML text input field tag + :returns: An HTML text input element :rtype: string Lets you generate a standard text input field. You can minimally pass @@ -206,7 +206,7 @@ The following functions are available: :param array $data: Field attributes data :param string $value: Field value :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML password input field tag + :returns: An HTML password input element :rtype: string This function is identical in all respects to the :php:func:`form_input()` @@ -217,7 +217,7 @@ The following functions are available: :param array $data: Field attributes data :param string $value: Field value :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML file upload input field tag + :returns: An HTML file upload input element :rtype: string This function is identical in all respects to the :php:func:`form_input()` @@ -229,7 +229,7 @@ The following functions are available: :param array $data: Field attributes data :param string $value: Field value :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML textarea tag + :returns: An HTML textarea element :rtype: string This function is identical in all respects to the :php:func:`form_input()` @@ -244,7 +244,7 @@ The following functions are available: :param array $options: An associative array of options to be listed :param array $selected: List of fields to mark with the *selected* attribute :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML dropdown select field tag + :returns: An HTML select (dropdown) element :rtype: string Lets you create a standard drop-down field. The first parameter will @@ -278,7 +278,7 @@ The following functions are available: :param array $options: An associative array of options to be listed :param array $selected: List of fields to mark with the *selected* attribute :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML dropdown multiselect field tag + :returns: An HTML multiselect (dropdown) element :rtype: string Lets you create a standard multiselect field. The first parameter will @@ -326,7 +326,7 @@ The following functions are available: :param string $value: Field value :param bool $checked: Whether to mark the checkbox as being *checked* :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML checkbox input tag + :returns: An HTML checkbox input element :rtype: string Lets you generate a checkbox field. Simple example: @@ -357,7 +357,7 @@ The following functions are available: :param string $value: Field value :param bool $checked: Whether to mark the radio button as being *checked* :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML radio input tag + :returns: An HTML radio input element :rtype: string This function is identical in all respects to the :php:func:`form_checkbox()` @@ -368,7 +368,7 @@ The following functions are available: :param string $label_text: Text to put in the