Skip to content

Commit

Permalink
Merge pull request #8 from shahghasiadil/feature/laravel-data
Browse files Browse the repository at this point in the history
pest php testing
  • Loading branch information
shahghasiadil authored Jun 12, 2024
2 parents 47d05d9 + 493ed11 commit d9f9b35
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
3 changes: 3 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
<testsuite name="Architecture">
<directory>tests/Architecture</directory>
</testsuite>
</testsuites>
<source>
<include>
Expand Down
31 changes: 31 additions & 0 deletions tests/Architecture/GlobalsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

arch('globals')
->expect(['dd', 'dump', 'ray'])
->not->toBeUsed();

arch('app')
->expect(['Shared', 'Domain','Infrastructure','Application','Presentation'])
->toUseStrictTypes();

arch('Domain can be accessed by Infrastructure and Application Layers')
->expect('Domain')
->toOnlyBeUsedIn(['Infrastructure', 'Application']);

arch('Infrastructure should only accessed by Application Layer directly')
->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']);

arch('Shared resources should be accessible by all layers')
->expect('Shared')
->toOnlyBeUsedIn(['Domain', 'Application', 'Infrastructure', 'Presentation']);
7 changes: 7 additions & 0 deletions tests/Architecture/Shared/ContractsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

arch('shared interfaces/contracts test')
->expect('Shared\Contracts')
->toBeInterfaces();
7 changes: 7 additions & 0 deletions tests/Architecture/Shared/EnumsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

arch('shared enums test')
->expect('Shared\Enums')
->toBeStringBackedEnums();
7 changes: 7 additions & 0 deletions tests/Architecture/Shared/TraitsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

arch('shared traits')
->expect('Shared\Traits')
->toBeTraits();

0 comments on commit d9f9b35

Please sign in to comment.