From 49624d0886c46431d8cd61bab62e81a1cadac011 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 15 Jul 2026 20:46:52 +0700 Subject: [PATCH 1/6] chore(test): add Pyrameter test-shape enforcement --- .gitattributes | 1 + composer.json | 1 + phpunit.xml.dist | 1 + pyrameter.php | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 pyrameter.php diff --git a/.gitattributes b/.gitattributes index 4e9eca84d..fb192d9bc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,6 +13,7 @@ /phpstan-baseline.php export-ignore /phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore +/pyrameter.php export-ignore /psalm_autoload.php export-ignore /psalm-baseline.xml export-ignore /psalm.xml export-ignore diff --git a/composer.json b/composer.json index b7821d496..4a5828468 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "codeigniter4/settings": "^2.1" }, "require-dev": { + "boundwize/pyrameter": "^0.5", "boundwize/structarmed": "0.15.2", "codeigniter/phpstan-codeigniter": "^2.0", "codeigniter4/devkit": "^1.3", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4d82a9068..e406d54f0 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -34,6 +34,7 @@ + diff --git a/pyrameter.php b/pyrameter.php new file mode 100644 index 000000000..4c04af314 --- /dev/null +++ b/pyrameter.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +use Boundwize\Pyrameter\Config\PyrameterConfig; +use Boundwize\Pyrameter\TestKind; +use CodeIgniter\Test\FeatureTestTrait; +use Tests\Support\DatabaseTestCase; + +return PyrameterConfig::defaults() + ->usesClass( + DatabaseTestCase::class, + TestKind::Integration, + unless: [FeatureTestTrait::class], + ) + ->usesClass( + FeatureTestTrait::class, + TestKind::Functional, + ) + ->targetShape( + unit: ['min' => 40], + functional: ['max' => 10], + integration: ['max' => 50], + e2e: ['max' => 0], + ) + ->failOnViolation(); From 2659cf2adde466067796954bb9edbbb92d7139c4 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 15 Jul 2026 20:53:51 +0700 Subject: [PATCH 2/6] chore: make use of --no-extensions on lang --- .github/workflows/phpunit-lang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit-lang.yml b/.github/workflows/phpunit-lang.yml index e512c33b5..91a78f54f 100644 --- a/.github/workflows/phpunit-lang.yml +++ b/.github/workflows/phpunit-lang.yml @@ -59,7 +59,7 @@ jobs: fi - name: Test with PHPUnit - run: vendor/bin/phpunit --no-coverage --testsuite lang + run: vendor/bin/phpunit --no-coverage --testsuite --no-extensions lang env: TERM: xterm-256color TACHYCARDIA_MONITOR_GA: enabled From da85f08284b93ea931ac06f4716f21cfbe7ca3e3 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 15 Jul 2026 20:55:07 +0700 Subject: [PATCH 3/6] chore: make use of --no-extensions on lang --- .github/workflows/phpunit-lang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit-lang.yml b/.github/workflows/phpunit-lang.yml index 91a78f54f..62c6b6ba3 100644 --- a/.github/workflows/phpunit-lang.yml +++ b/.github/workflows/phpunit-lang.yml @@ -59,7 +59,7 @@ jobs: fi - name: Test with PHPUnit - run: vendor/bin/phpunit --no-coverage --testsuite --no-extensions lang + run: vendor/bin/phpunit --no-coverage --no-extensions --testsuite lang env: TERM: xterm-256color TACHYCARDIA_MONITOR_GA: enabled From bb47997628dd3106369702365fcaea527118e70e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 15 Jul 2026 21:06:59 +0700 Subject: [PATCH 4/6] chore: bump to pyrameter 0.5 and make use of PYRAMETER_DISABLED=1 on specific lang test suite --- .github/workflows/phpunit-lang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit-lang.yml b/.github/workflows/phpunit-lang.yml index 62c6b6ba3..1ab177de0 100644 --- a/.github/workflows/phpunit-lang.yml +++ b/.github/workflows/phpunit-lang.yml @@ -59,7 +59,7 @@ jobs: fi - name: Test with PHPUnit - run: vendor/bin/phpunit --no-coverage --no-extensions --testsuite lang + run: PYRAMETER_DISABLED=1 vendor/bin/phpunit --no-coverage --testsuite lang env: TERM: xterm-256color TACHYCARDIA_MONITOR_GA: enabled From bd0bf1ce913bbfa3097695caf716a26046f85bf9 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 22 Jul 2026 20:52:17 +0700 Subject: [PATCH 5/6] update pyrameter setup config to mark AbstractFilterTestCase as functional --- pyrameter.php | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pyrameter.php b/pyrameter.php index 4c04af314..c4f5fbdcd 100644 --- a/pyrameter.php +++ b/pyrameter.php @@ -13,23 +13,38 @@ use Boundwize\Pyrameter\Config\PyrameterConfig; use Boundwize\Pyrameter\TestKind; +use CodeIgniter\Test\DatabaseTestTrait; use CodeIgniter\Test\FeatureTestTrait; +use Tests\Authentication\Filters\AbstractFilterTestCase; use Tests\Support\DatabaseTestCase; -return PyrameterConfig::defaults() +return PyrameterConfig::create() + ->usesClass( + DatabaseTestTrait::class, + TestKind::Integration, + unless: [FeatureTestTrait::class, AbstractFilterTestCase::class], + ) ->usesClass( DatabaseTestCase::class, TestKind::Integration, - unless: [FeatureTestTrait::class], + unless: [FeatureTestTrait::class, AbstractFilterTestCase::class], ) ->usesClass( FeatureTestTrait::class, TestKind::Functional, ) + ->usesClass( + AbstractFilterTestCase::class, + TestKind::Functional, + ) + ->usesFunction('copy', TestKind::Integration) + ->usesFunction('file_get_contents', TestKind::Integration) + ->usesFunction('getcwd', TestKind::Integration) + ->usesFunction('is_file', TestKind::Integration) + ->usesFunction('unlink', TestKind::Integration) ->targetShape( - unit: ['min' => 40], - functional: ['max' => 10], - integration: ['max' => 50], + unit: ['min' => 44], + functional: ['max' => 16], + integration: ['max' => 40], e2e: ['max' => 0], - ) - ->failOnViolation(); + ); From 4c0977e210071af7537144c27349d2ba5d387354 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 22 Jul 2026 22:54:26 +0700 Subject: [PATCH 6/6] set 40/20/50 for target and enable failOnViolation() --- pyrameter.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyrameter.php b/pyrameter.php index c4f5fbdcd..c285aa73b 100644 --- a/pyrameter.php +++ b/pyrameter.php @@ -43,8 +43,9 @@ ->usesFunction('is_file', TestKind::Integration) ->usesFunction('unlink', TestKind::Integration) ->targetShape( - unit: ['min' => 44], - functional: ['max' => 16], - integration: ['max' => 40], + unit: ['min' => 40], + functional: ['max' => 20], + integration: ['max' => 50], e2e: ['max' => 0], - ); + ) + ->failOnViolation();