diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 20e1dd1..28ff4ae 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 tests-mutation 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": { 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 + 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 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(); 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__); 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 { 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();