Skip to content

Commit d9f9b35

Browse files
Merge pull request #8 from shahghasiadil/feature/laravel-data
pest php testing
2 parents 47d05d9 + 493ed11 commit d9f9b35

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

phpunit.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<testsuite name="Feature">
1212
<directory>tests/Feature</directory>
1313
</testsuite>
14+
<testsuite name="Architecture">
15+
<directory>tests/Architecture</directory>
16+
</testsuite>
1417
</testsuites>
1518
<source>
1619
<include>

tests/Architecture/GlobalsTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
arch('globals')
6+
->expect(['dd', 'dump', 'ray'])
7+
->not->toBeUsed();
8+
9+
arch('app')
10+
->expect(['Shared', 'Domain','Infrastructure','Application','Presentation'])
11+
->toUseStrictTypes();
12+
13+
arch('Domain can be accessed by Infrastructure and Application Layers')
14+
->expect('Domain')
15+
->toOnlyBeUsedIn(['Infrastructure', 'Application']);
16+
17+
arch('Infrastructure should only accessed by Application Layer directly')
18+
->expect('Infrastructure')
19+
->toOnlyBeUsedIn(['Application']);
20+
21+
arch('Application should only accessed by Presentation, Infrastructure and Domain Layer')
22+
->expect('Application')
23+
->toOnlyBeUsedIn(['Presentation', 'Infrastructure', 'Domain']);
24+
25+
arch('Presentation should not be used in Domain, Application, Shared, Infrastructure Layer')
26+
->expect('Presentation')
27+
->not->toBeUsedIn(['Domain','Application', 'Shared', 'Infrastructure']);
28+
29+
arch('Shared resources should be accessible by all layers')
30+
->expect('Shared')
31+
->toOnlyBeUsedIn(['Domain', 'Application', 'Infrastructure', 'Presentation']);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
arch('shared interfaces/contracts test')
6+
->expect('Shared\Contracts')
7+
->toBeInterfaces();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
arch('shared enums test')
6+
->expect('Shared\Enums')
7+
->toBeStringBackedEnums();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
arch('shared traits')
6+
->expect('Shared\Traits')
7+
->toBeTraits();

0 commit comments

Comments
 (0)