From 56090b0104012918a0ef2dea3ed1602a56fda8b3 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Fri, 25 Oct 2024 00:39:03 +0200 Subject: [PATCH] Update arch tests --- composer.json | 7 ++++++- composer.lock | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- deptrac.yaml | 30 ++++++++++++++++++++++++++++++ tests/Arch.php | 5 +++++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 deptrac.yaml diff --git a/composer.json b/composer.json index c86b8089..84ca3eba 100644 --- a/composer.json +++ b/composer.json @@ -86,7 +86,8 @@ "mockery/mockery": "^1.4.4", "orchestra/testbench": "^9.0", "pestphp/pest": "^3.0", - "phpstan/phpstan-mockery": "^2.0" + "phpstan/phpstan-mockery": "^2.0", + "qossmic/deptrac": "^2.0" }, "config": { "optimize-autoloader": true, @@ -121,6 +122,10 @@ "minimum-stability": "dev", "prefer-stable": true, "scripts": { + "archtest": [ + "./vendor/bin/deptrac analyze", + "./vendor/bin/pest tests/Arch.php" + ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" diff --git a/composer.lock b/composer.lock index 43351b1c..3f4b9a26 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7ea50eebeb73984c5cf66105fc42e50b", + "content-hash": "65ea356f4d9ce066e39c9914f823db01", "packages": [ { "name": "amphp/amp", @@ -15724,6 +15724,54 @@ }, "time": "2024-10-14T03:18:12+00:00" }, + { + "name": "qossmic/deptrac", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/qossmic/deptrac.git", + "reference": "a6dbfaf4f20f0ae98b766954f35b8c164c3063ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/qossmic/deptrac/zipball/a6dbfaf4f20f0ae98b766954f35b8c164c3063ed", + "reference": "a6dbfaf4f20f0ae98b766954f35b8c164c3063ed", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^8.1" + }, + "suggest": { + "ext-dom": "For using the JUnit output formatter" + }, + "bin": [ + "bin/deptrac", + "deptrac.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Qossmic\\Deptrac\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.", + "keywords": [ + "static analysis" + ], + "support": { + "source": "https://github.com/qossmic/deptrac/tree/2.0.4" + }, + "abandoned": "deptrac/deptrac", + "time": "2024-11-21T22:38:34+00:00" + }, { "name": "symfony/polyfill-php84", "version": "v1.31.0", diff --git a/deptrac.yaml b/deptrac.yaml new file mode 100644 index 00000000..0ce2e48d --- /dev/null +++ b/deptrac.yaml @@ -0,0 +1,30 @@ +deptrac: + paths: + - ./app + - ./modules + exclude_files: + - '#.*Test.php$#' + layers: + - name: AppFiles + collectors: + - type: bool + must: + - type: classLike + value: .* + - type: directory + value: app/.* + + - name: ModuleFiles + collectors: + - type: bool + must: + - type: classLike + value: .* + - type: directory + value: modules/.* + + ruleset: + ModuleFiles: + - AppFiles + AppFiles: + - ModuleFiles diff --git a/tests/Arch.php b/tests/Arch.php index 2d931c10..288e21cb 100644 --- a/tests/Arch.php +++ b/tests/Arch.php @@ -4,3 +4,8 @@ arch() ->expect('App') ->not->toUse(['die', 'dd', 'dump']) ->not->toHaveFileSystemPermissions('0777'); + +arch() + ->expect('Modules') + ->not->toUse(['die', 'dd', 'dump']) + ->not->toHaveFileSystemPermissions('0777');