From c7b1b5a5745d460119b73de17062b37c7986ca70 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 13:56:22 +0430 Subject: [PATCH 01/34] feat: Enum arch test added --- tests/Feature/Arch/Shared/EnumsTest.php | 5 +++++ tests/Feature/Arch/Shared/TraitsTest.php | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/Feature/Arch/Shared/EnumsTest.php create mode 100644 tests/Feature/Arch/Shared/TraitsTest.php diff --git a/tests/Feature/Arch/Shared/EnumsTest.php b/tests/Feature/Arch/Shared/EnumsTest.php new file mode 100644 index 0000000..802a99f --- /dev/null +++ b/tests/Feature/Arch/Shared/EnumsTest.php @@ -0,0 +1,5 @@ +expect('src\Shared\Enums') + ->toBeEnums(); diff --git a/tests/Feature/Arch/Shared/TraitsTest.php b/tests/Feature/Arch/Shared/TraitsTest.php new file mode 100644 index 0000000..b46239f --- /dev/null +++ b/tests/Feature/Arch/Shared/TraitsTest.php @@ -0,0 +1,7 @@ +get('/'); + + $response->assertStatus(200); +}); From 31833f3cfb7c9c4befab47dc391aa47c6e7cb3c4 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 13:57:02 +0430 Subject: [PATCH 02/34] Ref: backedEnums testing added --- tests/Feature/Arch/Shared/EnumsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/Arch/Shared/EnumsTest.php b/tests/Feature/Arch/Shared/EnumsTest.php index 802a99f..628b358 100644 --- a/tests/Feature/Arch/Shared/EnumsTest.php +++ b/tests/Feature/Arch/Shared/EnumsTest.php @@ -2,4 +2,4 @@ arch('shared') ->expect('src\Shared\Enums') - ->toBeEnums(); + ->toBeIntBackedEnums();; From 508cbae3ae21728774e27e0fdafb754a0cdb3c69 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 13:58:55 +0430 Subject: [PATCH 03/34] feat: traits testing completed --- tests/Feature/Arch/Shared/TraitsTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/Feature/Arch/Shared/TraitsTest.php b/tests/Feature/Arch/Shared/TraitsTest.php index b46239f..2f426de 100644 --- a/tests/Feature/Arch/Shared/TraitsTest.php +++ b/tests/Feature/Arch/Shared/TraitsTest.php @@ -1,7 +1,5 @@ get('/'); - - $response->assertStatus(200); -}); +arch('shared traits') + ->expect('src\Shared\Traits') + ->toBeTraits(); From c323e9c10b74ba0133092e8c136fa006e28720f1 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 14:00:20 +0430 Subject: [PATCH 04/34] feat: test message organized --- tests/Feature/Arch/Shared/EnumsTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Feature/Arch/Shared/EnumsTest.php b/tests/Feature/Arch/Shared/EnumsTest.php index 628b358..43bbc98 100644 --- a/tests/Feature/Arch/Shared/EnumsTest.php +++ b/tests/Feature/Arch/Shared/EnumsTest.php @@ -1,5 +1,5 @@ expect('src\Shared\Enums') - ->toBeIntBackedEnums();; + ->toBeIntBackedEnums(); From fd0ae993967d06baa61572b05a4658dc410395f3 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 14:01:28 +0430 Subject: [PATCH 05/34] feat: global test created --- tests/Feature/Arch/GlobalsTest.php | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/Feature/Arch/GlobalsTest.php diff --git a/tests/Feature/Arch/GlobalsTest.php b/tests/Feature/Arch/GlobalsTest.php new file mode 100644 index 0000000..b46239f --- /dev/null +++ b/tests/Feature/Arch/GlobalsTest.php @@ -0,0 +1,7 @@ +get('/'); + + $response->assertStatus(200); +}); From 936b2b7efb3424dae1c7b817016a43d2019fd00e Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 14:02:14 +0430 Subject: [PATCH 06/34] feat: dd, dump testing added --- tests/Feature/Arch/GlobalsTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/Feature/Arch/GlobalsTest.php b/tests/Feature/Arch/GlobalsTest.php index b46239f..33a0e24 100644 --- a/tests/Feature/Arch/GlobalsTest.php +++ b/tests/Feature/Arch/GlobalsTest.php @@ -1,7 +1,5 @@ get('/'); - - $response->assertStatus(200); -}); +arch('globals') + ->expect(['dd', 'dump', 'ray']) + ->not->toBeUsed(); From 796c136327696794bebb5305e40269d6b8783575 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 14:03:06 +0430 Subject: [PATCH 07/34] feat: Contract test created --- tests/Feature/Arch/Shared/ContractsTest.php | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/Feature/Arch/Shared/ContractsTest.php diff --git a/tests/Feature/Arch/Shared/ContractsTest.php b/tests/Feature/Arch/Shared/ContractsTest.php new file mode 100644 index 0000000..b46239f --- /dev/null +++ b/tests/Feature/Arch/Shared/ContractsTest.php @@ -0,0 +1,7 @@ +get('/'); + + $response->assertStatus(200); +}); From 9a950c2b266a66aca982517dd21df2e2afe7837f Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 14:04:31 +0430 Subject: [PATCH 08/34] feat: contracts shared testing completed --- tests/Feature/Arch/Shared/ContractsTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/Feature/Arch/Shared/ContractsTest.php b/tests/Feature/Arch/Shared/ContractsTest.php index b46239f..e6a17ab 100644 --- a/tests/Feature/Arch/Shared/ContractsTest.php +++ b/tests/Feature/Arch/Shared/ContractsTest.php @@ -1,7 +1,5 @@ get('/'); - - $response->assertStatus(200); -}); +arch('shared interfaces/contracts test') + ->expect('src\Shared\Contracts') + ->toBeInterfaces(); From 154344e8c3946ca471e012a2bef59de373c10b84 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 14:10:56 +0430 Subject: [PATCH 09/34] ref: enums testing moved from int to string --- tests/Feature/Arch/Shared/EnumsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/Arch/Shared/EnumsTest.php b/tests/Feature/Arch/Shared/EnumsTest.php index 43bbc98..55651ca 100644 --- a/tests/Feature/Arch/Shared/EnumsTest.php +++ b/tests/Feature/Arch/Shared/EnumsTest.php @@ -2,4 +2,4 @@ arch('shared enums test') ->expect('src\Shared\Enums') - ->toBeIntBackedEnums(); + ->toBeStringBackedEnums(); From 800dff142b2a950d0cd3afe6d4abffd2d0fb5805 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 15:12:14 +0430 Subject: [PATCH 10/34] feat: strict mode for GlobalsTest --- tests/Feature/Arch/GlobalsTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Feature/Arch/GlobalsTest.php b/tests/Feature/Arch/GlobalsTest.php index 33a0e24..35a089b 100644 --- a/tests/Feature/Arch/GlobalsTest.php +++ b/tests/Feature/Arch/GlobalsTest.php @@ -1,5 +1,7 @@ expect(['dd', 'dump', 'ray']) ->not->toBeUsed(); From 37fa1b031243f2cca211afd564ec821fa96e2992 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 15:12:26 +0430 Subject: [PATCH 11/34] feat: strict mode for ContractTest --- tests/Feature/Arch/Shared/ContractsTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Feature/Arch/Shared/ContractsTest.php b/tests/Feature/Arch/Shared/ContractsTest.php index e6a17ab..ca05af0 100644 --- a/tests/Feature/Arch/Shared/ContractsTest.php +++ b/tests/Feature/Arch/Shared/ContractsTest.php @@ -1,5 +1,7 @@ expect('src\Shared\Contracts') ->toBeInterfaces(); From 1a2bcc3d38327c69f7157dfe66e813df83e2c0fd Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 15:12:38 +0430 Subject: [PATCH 12/34] feat: strict mode for EnumTest --- tests/Feature/Arch/Shared/EnumsTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Feature/Arch/Shared/EnumsTest.php b/tests/Feature/Arch/Shared/EnumsTest.php index 55651ca..cdbb32c 100644 --- a/tests/Feature/Arch/Shared/EnumsTest.php +++ b/tests/Feature/Arch/Shared/EnumsTest.php @@ -1,5 +1,7 @@ expect('src\Shared\Enums') ->toBeStringBackedEnums(); From 1d8a4f0cd0eb4a7c303662075076422a82a8cd2d Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 15:12:49 +0430 Subject: [PATCH 13/34] feat: strict mode for Traits --- tests/Feature/Arch/Shared/TraitsTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Feature/Arch/Shared/TraitsTest.php b/tests/Feature/Arch/Shared/TraitsTest.php index 2f426de..ae3984f 100644 --- a/tests/Feature/Arch/Shared/TraitsTest.php +++ b/tests/Feature/Arch/Shared/TraitsTest.php @@ -1,5 +1,7 @@ expect('src\Shared\Traits') ->toBeTraits(); From b4c569bea17ac6210efcd20fae2c91a45184ef0a Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 15:52:24 +0430 Subject: [PATCH 14/34] feat: strict typing test added --- tests/Feature/Arch/GlobalsTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Feature/Arch/GlobalsTest.php b/tests/Feature/Arch/GlobalsTest.php index 35a089b..8ece159 100644 --- a/tests/Feature/Arch/GlobalsTest.php +++ b/tests/Feature/Arch/GlobalsTest.php @@ -5,3 +5,7 @@ arch('globals') ->expect(['dd', 'dump', 'ray']) ->not->toBeUsed(); + +arch('strict typing in src dir') + ->expect('src') + ->toUseStrictTypes(); From 58da289e8280355b08bc1f9dd282f4d20186ab70 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:09:20 +0430 Subject: [PATCH 15/34] arch dir added --- phpunit.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index 61c031c..454d56f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -11,6 +11,9 @@ tests/Feature + + tests/Architecture + From 0748c676734bd93e9185e6b0be720db15bd86c10 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:09:45 +0430 Subject: [PATCH 16/34] Global test fixed --- tests/Architecture/GlobalsTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/Architecture/GlobalsTest.php diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php new file mode 100644 index 0000000..6d72bf3 --- /dev/null +++ b/tests/Architecture/GlobalsTest.php @@ -0,0 +1,9 @@ +expect(['dd', 'dump', 'ray']) + ->not->toBeUsed(); + + From 119256e40c98f1a70d01b639dbccd404f98d7af2 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:10:10 +0430 Subject: [PATCH 17/34] feat: Contract test moved to arch dir --- tests/Architecture/Shared/ContractsTest.php | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/Architecture/Shared/ContractsTest.php diff --git a/tests/Architecture/Shared/ContractsTest.php b/tests/Architecture/Shared/ContractsTest.php new file mode 100644 index 0000000..ca05af0 --- /dev/null +++ b/tests/Architecture/Shared/ContractsTest.php @@ -0,0 +1,7 @@ +expect('src\Shared\Contracts') + ->toBeInterfaces(); From 76fc1d24e350389d7c997fb7e3ef37909b66d945 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:10:26 +0430 Subject: [PATCH 18/34] feat: Enum test moved to arch dir --- tests/Architecture/Shared/EnumsTest.php | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/Architecture/Shared/EnumsTest.php diff --git a/tests/Architecture/Shared/EnumsTest.php b/tests/Architecture/Shared/EnumsTest.php new file mode 100644 index 0000000..6d571a3 --- /dev/null +++ b/tests/Architecture/Shared/EnumsTest.php @@ -0,0 +1,7 @@ +expect('Shared\Enums') + ->toBeStringBackedEnums(); From e26a8849948a12460b17217b5cd1e79bd72e8106 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:10:36 +0430 Subject: [PATCH 19/34] feat: Traits test moved to arch dir --- tests/Architecture/Shared/TraitsTest.php | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/Architecture/Shared/TraitsTest.php diff --git a/tests/Architecture/Shared/TraitsTest.php b/tests/Architecture/Shared/TraitsTest.php new file mode 100644 index 0000000..ae3984f --- /dev/null +++ b/tests/Architecture/Shared/TraitsTest.php @@ -0,0 +1,7 @@ +expect('src\Shared\Traits') + ->toBeTraits(); From 346e02017f3b9acb7884387c7666efd2909d24bf Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:10:49 +0430 Subject: [PATCH 20/34] feat: changes on testing --- tests/Feature/Arch/GlobalsTest.php | 11 ----------- tests/Feature/Arch/Shared/ContractsTest.php | 7 ------- tests/Feature/Arch/Shared/EnumsTest.php | 7 ------- tests/Feature/Arch/Shared/TraitsTest.php | 7 ------- 4 files changed, 32 deletions(-) delete mode 100644 tests/Feature/Arch/GlobalsTest.php delete mode 100644 tests/Feature/Arch/Shared/ContractsTest.php delete mode 100644 tests/Feature/Arch/Shared/EnumsTest.php delete mode 100644 tests/Feature/Arch/Shared/TraitsTest.php diff --git a/tests/Feature/Arch/GlobalsTest.php b/tests/Feature/Arch/GlobalsTest.php deleted file mode 100644 index 8ece159..0000000 --- a/tests/Feature/Arch/GlobalsTest.php +++ /dev/null @@ -1,11 +0,0 @@ -expect(['dd', 'dump', 'ray']) - ->not->toBeUsed(); - -arch('strict typing in src dir') - ->expect('src') - ->toUseStrictTypes(); diff --git a/tests/Feature/Arch/Shared/ContractsTest.php b/tests/Feature/Arch/Shared/ContractsTest.php deleted file mode 100644 index ca05af0..0000000 --- a/tests/Feature/Arch/Shared/ContractsTest.php +++ /dev/null @@ -1,7 +0,0 @@ -expect('src\Shared\Contracts') - ->toBeInterfaces(); diff --git a/tests/Feature/Arch/Shared/EnumsTest.php b/tests/Feature/Arch/Shared/EnumsTest.php deleted file mode 100644 index cdbb32c..0000000 --- a/tests/Feature/Arch/Shared/EnumsTest.php +++ /dev/null @@ -1,7 +0,0 @@ -expect('src\Shared\Enums') - ->toBeStringBackedEnums(); diff --git a/tests/Feature/Arch/Shared/TraitsTest.php b/tests/Feature/Arch/Shared/TraitsTest.php deleted file mode 100644 index ae3984f..0000000 --- a/tests/Feature/Arch/Shared/TraitsTest.php +++ /dev/null @@ -1,7 +0,0 @@ -expect('src\Shared\Traits') - ->toBeTraits(); From 595656aa13d42975322cfbb5335b59c1ea760ebe Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:29:37 +0430 Subject: [PATCH 21/34] fix: contract test fixed --- tests/Architecture/Shared/ContractsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Architecture/Shared/ContractsTest.php b/tests/Architecture/Shared/ContractsTest.php index ca05af0..a4fef86 100644 --- a/tests/Architecture/Shared/ContractsTest.php +++ b/tests/Architecture/Shared/ContractsTest.php @@ -3,5 +3,5 @@ declare(strict_types=1); arch('shared interfaces/contracts test') - ->expect('src\Shared\Contracts') + ->expect('Shared\Contracts') ->toBeInterfaces(); From e456ccbc40dd914281b832b480151fb32c4233cb Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:30:02 +0430 Subject: [PATCH 22/34] ref: global test refactored --- tests/Architecture/GlobalsTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 6d72bf3..6eb9b8b 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -6,4 +6,6 @@ ->expect(['dd', 'dump', 'ray']) ->not->toBeUsed(); - +arch('app') + ->expect(['Shared', 'Domain','Infrastructure','Application','Presentation']) + ->toUseStrictTypes(); From 6e3793ef0e3d4d502fbbcf74dacffc949ae237ab Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 19:30:16 +0430 Subject: [PATCH 23/34] fix: traits test fixed --- tests/Architecture/Shared/TraitsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Architecture/Shared/TraitsTest.php b/tests/Architecture/Shared/TraitsTest.php index ae3984f..932ea18 100644 --- a/tests/Architecture/Shared/TraitsTest.php +++ b/tests/Architecture/Shared/TraitsTest.php @@ -3,5 +3,5 @@ declare(strict_types=1); arch('shared traits') - ->expect('src\Shared\Traits') + ->expect('Shared\Traits') ->toBeTraits(); From 3202a44c735fb8dfcb8c09b3f7ede0a02010802f Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 21:46:10 +0430 Subject: [PATCH 24/34] Domain Layer Arch --- tests/Architecture/GlobalsTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 6eb9b8b..68a06ab 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -9,3 +9,8 @@ arch('app') ->expect(['Shared', 'Domain','Infrastructure','Application','Presentation']) ->toUseStrictTypes(); + +arch('Domain can be accessed by Infrastructure, Application Layers') + ->expect('Domain') + ->toOnlyBeUsedIn(['Infrastructure','Application']); + From 6b1e21042b639ec4a8a9e0bf2b1deab7823e0d54 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 21:54:01 +0430 Subject: [PATCH 25/34] feat: Domain Layer test created --- tests/Architecture/GlobalsTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 68a06ab..e077660 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -10,7 +10,9 @@ ->expect(['Shared', 'Domain','Infrastructure','Application','Presentation']) ->toUseStrictTypes(); -arch('Domain can be accessed by Infrastructure, Application Layers') +arch('Domain can be accessed by Infrastructure and Application Layers') ->expect('Domain') - ->toOnlyBeUsedIn(['Infrastructure','Application']); + ->toOnlyBeUsedIn(['Infrastructure', 'Application']); + + From cc5fc2f5b05c484e03f67307f0ca2b87b7651c65 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 21:58:40 +0430 Subject: [PATCH 26/34] feat: infras test --- tests/Architecture/GlobalsTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index e077660..3923287 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -14,5 +14,12 @@ ->expect('Domain') ->toOnlyBeUsedIn(['Infrastructure', 'Application']); +arch('Infrastructure should only access Domain and Shared Resources layers') + ->expect('Infrastructure') + ->toOnlyBeUsedIn(['Domain', 'Shared']); + +arch('Infrastructure should not access the Presentation Layer directly') + ->expect('Infrastructure') + ->not->toBeUsedIn(['Presentation']); From 8b69d6bf0a68b9c8dbd4de5887a8ecd285f3be81 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 21:59:38 +0430 Subject: [PATCH 27/34] feat: presentation layer test --- tests/Architecture/GlobalsTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 3923287..f02777d 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -22,4 +22,11 @@ ->expect('Infrastructure') ->not->toBeUsedIn(['Presentation']); +arch('Presentation should only access Application and Shared Resources layers') + ->expect('Presentation') + ->toOnlyBeUsedIn(['Application', 'Shared']); + +arch('Presentation should not access Domain Layer directly') + ->expect('Presentation') + ->not->toBeUsedIn(['Domain']); From 280a9b2ae3d58212648b369f08eaedfa87f64b1b Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 22:01:25 +0430 Subject: [PATCH 28/34] feat: arch test for shared resources --- tests/Architecture/GlobalsTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index f02777d..812441b 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -30,3 +30,6 @@ ->expect('Presentation') ->not->toBeUsedIn(['Domain']); +arch('Shared resources should be accessible by all layers') + ->expect('Shared') + ->toOnlyBeUsedIn(['Domain', 'Application', 'Infrastructure', 'Presentation']); From 268fbf4a87f6dff4c2877f0c3e4d6ce3983bfc14 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 22:16:40 +0430 Subject: [PATCH 29/34] ref: refactored test --- tests/Architecture/GlobalsTest.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 812441b..1e62774 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -14,22 +14,20 @@ ->expect('Domain') ->toOnlyBeUsedIn(['Infrastructure', 'Application']); -arch('Infrastructure should only access Domain and Shared Resources layers') - ->expect('Infrastructure') - ->toOnlyBeUsedIn(['Domain', 'Shared']); - arch('Infrastructure should not access the Presentation Layer directly') ->expect('Infrastructure') - ->not->toBeUsedIn(['Presentation']); + ->not->toBeUsedIn(['Presentation','Domain', 'Shared']); arch('Presentation should only access Application and Shared Resources layers') ->expect('Presentation') ->toOnlyBeUsedIn(['Application', 'Shared']); -arch('Presentation should not access Domain Layer directly') +arch('Presentation should not be used in Domain Layer') ->expect('Presentation') ->not->toBeUsedIn(['Domain']); arch('Shared resources should be accessible by all layers') ->expect('Shared') ->toOnlyBeUsedIn(['Domain', 'Application', 'Infrastructure', 'Presentation']); + + From 41d3c3fde13798bdefdad3835a4c55a6125292fd Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 22:19:29 +0430 Subject: [PATCH 30/34] ref: layer tests changed --- tests/Architecture/GlobalsTest.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 1e62774..98b5484 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -18,13 +18,9 @@ ->expect('Infrastructure') ->not->toBeUsedIn(['Presentation','Domain', 'Shared']); -arch('Presentation should only access Application and Shared Resources layers') - ->expect('Presentation') - ->toOnlyBeUsedIn(['Application', 'Shared']); - arch('Presentation should not be used in Domain Layer') ->expect('Presentation') - ->not->toBeUsedIn(['Domain']); + ->not->toBeUsedIn(['Domain','Application', 'Shared', 'Infrastructure']); arch('Shared resources should be accessible by all layers') ->expect('Shared') From d7a86cea45184e0ed75c0f5d296aa338756c8885 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 22:21:44 +0430 Subject: [PATCH 31/34] feat: new messages for infras test --- tests/Architecture/GlobalsTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 98b5484..ce03623 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -14,11 +14,11 @@ ->expect('Domain') ->toOnlyBeUsedIn(['Infrastructure', 'Application']); -arch('Infrastructure should not access the Presentation Layer directly') +arch('Infrastructure should not accessed by the Presentation , Domain and Shared Layer directly') ->expect('Infrastructure') ->not->toBeUsedIn(['Presentation','Domain', 'Shared']); -arch('Presentation should not be used in Domain Layer') +arch('Presentation should not be used in Domain, Application, Shared, Infrastructure Layer') ->expect('Presentation') ->not->toBeUsedIn(['Domain','Application', 'Shared', 'Infrastructure']); From b311c6e638c90ed024aa0b341c960c37c7278a3e Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 22:23:37 +0430 Subject: [PATCH 32/34] ref: tests are being refactored --- tests/Architecture/GlobalsTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index ce03623..81015a4 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -14,9 +14,9 @@ ->expect('Domain') ->toOnlyBeUsedIn(['Infrastructure', 'Application']); -arch('Infrastructure should not accessed by the Presentation , Domain and Shared Layer directly') +arch('Infrastructure should only accessed by Application Layer directly') ->expect('Infrastructure') - ->not->toBeUsedIn(['Presentation','Domain', 'Shared']); + ->toOnlyBeUsedIn(['Application']); arch('Presentation should not be used in Domain, Application, Shared, Infrastructure Layer') ->expect('Presentation') From 69d9414cd005d048e1e16254a221e0b87423b4fb Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 22:26:57 +0430 Subject: [PATCH 33/34] feat: Arch tests completed --- tests/Architecture/GlobalsTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 81015a4..7527472 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -18,6 +18,10 @@ ->expect('Infrastructure') ->toOnlyBeUsedIn(['Application']); +arch('Application should only accessed by Presentation, Infrastructure and Domain Layer') + ->expect('Application') + ->toOnlyBeUsedIn(['Presentation', 'Infrastructure', 'Domain']); + arch('Presentation should not be used in Domain, Application, Shared, Infrastructure Layer') ->expect('Presentation') ->not->toBeUsedIn(['Domain','Application', 'Shared', 'Infrastructure']); From 493ed1150d74c28fb0c84fbae4341467852d99a4 Mon Sep 17 00:00:00 2001 From: Shahghasi Date: Wed, 12 Jun 2024 22:27:22 +0430 Subject: [PATCH 34/34] lint: fixed linting --- tests/Architecture/GlobalsTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 7527472..978d53e 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -29,5 +29,3 @@ arch('Shared resources should be accessible by all layers') ->expect('Shared') ->toOnlyBeUsedIn(['Domain', 'Application', 'Infrastructure', 'Presentation']); - -