From 48e76d72e6d7e9852eff7684458b41e902682640 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:54:53 +0300 Subject: [PATCH 1/9] test: add arch tests --- tests/ArchlTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/ArchlTest.php diff --git a/tests/ArchlTest.php b/tests/ArchlTest.php new file mode 100644 index 0000000..cb57d0b --- /dev/null +++ b/tests/ArchlTest.php @@ -0,0 +1,19 @@ +expect(['dd', 'dump', 'die']) + ->not->toBeUsed(); + +test('Php code should follow basic standards') + ->preset() + ->php(); + +test('Code should pass basic security checks') + ->preset() + ->security(); + +test('Core architecture rules with exceptions') + ->preset() + ->strict(); From 4cab2a6ad16b3f030500ac5b47719d12931993d6 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:55:08 +0300 Subject: [PATCH 2/9] composer: require needed lib --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 67686b7..cc0ef02 100755 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "scripts": { "tests": "pest --stop-on-failure --colors", "tests-coverage": "pest --coverage --min=90", + "tests-mutation": "pest --mutate", "lint": [ "@phpstan", "@cs", @@ -41,7 +42,8 @@ "phpstan/phpstan": "^2.1", "rector/rector": "*", "squizlabs/php_codesniffer": "^3.13", - "slevomat/coding-standard": "^8.20" + "slevomat/coding-standard": "^8.20", + "orchestra/testbench": "^10.4" }, "config": { "allow-plugins": { From 69c009f712965972b6913c655ab4d88c7650033c Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:55:28 +0300 Subject: [PATCH 3/9] test: add mutate test --- tests/Unit/ExampleTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index faad3bf..5a498da 100755 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -5,9 +5,8 @@ namespace Tests\Unit; use DenisKorbakov\SkeletonPhpDocker\Example; -use Tests\TestCase; -uses(TestCase::class); +mutates(Example::class); test('foo', function (): void { $example = new Example(); From 8063c1c06f8a59ea1554773f3a1dd20a5a64efd9 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:55:37 +0300 Subject: [PATCH 4/9] build: add new command --- makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 2860f47..40d6645 100755 --- a/makefile +++ b/makefile @@ -27,4 +27,9 @@ test: # command for run tests coverage test-coverage: - docker exec -i scribe-plugin composer tests + docker exec -i scribe-plugin composer tests-coverage + +# command for run tests mutation +test-mutation: + docker exec -i scribe-plugin composer tests-mutation + From 1de5eacaf79e56dc9bbcc7f22971540cc68dd703 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:56:11 +0300 Subject: [PATCH 5/9] test: add include test cases for all test files --- tests/Pest.php | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/Pest.php diff --git a/tests/Pest.php b/tests/Pest.php new file mode 100644 index 0000000..77ac8a7 --- /dev/null +++ b/tests/Pest.php @@ -0,0 +1,7 @@ +in(__DIR__); From 1804880b501831fcfd7e7967c72f1e86ec6b9531 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:56:26 +0300 Subject: [PATCH 6/9] test: rename name tests --- phpunit.xml.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ee6eaa4..4ae3835 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,8 +5,8 @@ colors="true" > - - tests/Unit + + tests From 02193ae62a83ddcd51e3265c48e686c2a6ecbe40 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:56:47 +0300 Subject: [PATCH 7/9] test: update parent class by TestCase --- tests/TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index d42f312..971f894 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,7 +4,7 @@ namespace Tests; -use PHPUnit\Framework\TestCase as BaseTestCase; +use Orchestra\Testbench\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase { From f7edb395e463e228aedbcb01e8953ac9fbea5785 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:57:14 +0300 Subject: [PATCH 8/9] ci: add command for run mutation tests --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 20e1dd1..baf6dd8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,3 +32,6 @@ jobs: - name: Test coverage run: composer tests-coverage + + - name: Test coverage + run: composer test-mutation From 59bc87711c2c113122e8b59dc6d22886ff73cd7a Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 7 Aug 2025 20:58:49 +0300 Subject: [PATCH 9/9] ci: rename command --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index baf6dd8..28ff4ae 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,4 +34,4 @@ jobs: run: composer tests-coverage - name: Test coverage - run: composer test-mutation + run: composer tests-mutation