Skip to content

Commit 692646f

Browse files
authored
Merge pull request #1358 from samsonasik/chore-add-pyrameter
chore: add Pyrameter test-shape enforcement
2 parents 78a9d04 + 883bb65 commit 692646f

5 files changed

Lines changed: 55 additions & 0 deletions

File tree

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/phpstan-baseline.php export-ignore
1414
/phpstan.neon.dist export-ignore
1515
/phpunit.xml.dist export-ignore
16+
/pyrameter.php export-ignore
1617
/psalm_autoload.php export-ignore
1718
/psalm-baseline.xml export-ignore
1819
/psalm.xml export-ignore

‎.github/workflows/phpunit-lang.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ jobs:
6363
env:
6464
TERM: xterm-256color
6565
TACHYCARDIA_MONITOR_GA: enabled
66+
PYRAMETER_DISABLED: 1

‎composer.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"codeigniter4/settings": "^2.1"
3030
},
3131
"require-dev": {
32+
"boundwize/pyrameter": "^0.5",
3233
"boundwize/structarmed": "0.15.2",
3334
"codeigniter/phpstan-codeigniter": "^2.0",
3435
"codeigniter4/devkit": "^1.3",

‎phpunit.xml.dist‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<parameter name="report-count" value="30"/>
3535
<parameter name="format" value="table"/>
3636
</bootstrap>
37+
<bootstrap class="Boundwize\Pyrameter\Extension"/>
3738
</extensions>
3839
<logging>
3940
<testdoxHtml outputFile="build/phpunit/testdox.html"/>

‎pyrameter.php‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter Shield.
7+
*
8+
* (c) CodeIgniter Foundation <admin@codeigniter.com>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
use Boundwize\Pyrameter\Config\PyrameterConfig;
15+
use Boundwize\Pyrameter\TestKind;
16+
use CodeIgniter\Test\DatabaseTestTrait;
17+
use CodeIgniter\Test\FeatureTestTrait;
18+
use Tests\Authentication\Filters\AbstractFilterTestCase;
19+
use Tests\Support\DatabaseTestCase;
20+
21+
return PyrameterConfig::create()
22+
->usesClass(
23+
DatabaseTestTrait::class,
24+
TestKind::Integration,
25+
unless: [FeatureTestTrait::class, AbstractFilterTestCase::class],
26+
)
27+
->usesClass(
28+
DatabaseTestCase::class,
29+
TestKind::Integration,
30+
unless: [FeatureTestTrait::class, AbstractFilterTestCase::class],
31+
)
32+
->usesClass(
33+
FeatureTestTrait::class,
34+
TestKind::Functional,
35+
)
36+
->usesClass(
37+
AbstractFilterTestCase::class,
38+
TestKind::Functional,
39+
)
40+
->usesFunction('copy', TestKind::Integration)
41+
->usesFunction('file_get_contents', TestKind::Integration)
42+
->usesFunction('getcwd', TestKind::Integration)
43+
->usesFunction('is_file', TestKind::Integration)
44+
->usesFunction('unlink', TestKind::Integration)
45+
->targetShape(
46+
unit: ['min' => 40],
47+
functional: ['max' => 20],
48+
integration: ['max' => 50],
49+
e2e: ['max' => 0],
50+
)
51+
->failOnViolation();

0 commit comments

Comments
 (0)