Update arch tests

This commit is contained in:
philipp lang 2024-10-25 00:39:03 +02:00
parent dc15bda5c7
commit 0da1e1ca42
4 changed files with 87 additions and 2 deletions

View File

@ -86,7 +86,8 @@
"mockery/mockery": "^1.4.4", "mockery/mockery": "^1.4.4",
"orchestra/testbench": "^9.0", "orchestra/testbench": "^9.0",
"pestphp/pest": "^3.0", "pestphp/pest": "^3.0",
"phpstan/phpstan-mockery": "^1.1" "phpstan/phpstan-mockery": "^1.1",
"qossmic/deptrac": "^2.0"
}, },
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,
@ -121,6 +122,10 @@
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,
"scripts": { "scripts": {
"archtest": [
"./vendor/bin/deptrac analyze",
"./vendor/bin/pest tests/Arch.php"
],
"post-autoload-dump": [ "post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi" "@php artisan package:discover --ansi"

47
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "67ae3a3987355f098ee6f850c6f8e846", "content-hash": "3ffa3d4a189ba5d296ca71166298a74f",
"packages": [ "packages": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
@ -15743,6 +15743,51 @@
}, },
"time": "2024-09-11T15:47:29+00:00" "time": "2024-09-11T15:47:29+00:00"
}, },
{
"name": "qossmic/deptrac",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/qossmic/deptrac.git",
"reference": "f646695c1468051138e1347d89590f9084fa6256"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/qossmic/deptrac/zipball/f646695c1468051138e1347d89590f9084fa6256",
"reference": "f646695c1468051138e1347d89590f9084fa6256",
"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.",
"support": {
"issues": "https://github.com/qossmic/deptrac/issues",
"source": "https://github.com/qossmic/deptrac/tree/2.0.1"
},
"time": "2024-06-17T10:43:11+00:00"
},
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "1.2.5", "version": "1.2.5",

30
deptrac.yaml Normal file
View File

@ -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

View File

@ -4,3 +4,8 @@ arch()
->expect('App') ->expect('App')
->not->toUse(['die', 'dd', 'dump']) ->not->toUse(['die', 'dd', 'dump'])
->not->toHaveFileSystemPermissions('0777'); ->not->toHaveFileSystemPermissions('0777');
arch()
->expect('Modules')
->not->toUse(['die', 'dd', 'dump'])
->not->toHaveFileSystemPermissions('0777');