Skip to content

Commit 4020606

Browse files
Merge pull request #60 from CodeWithDennis/add-more-tests
Add architecture tests for file naming conventions
2 parents 8450689 + db3b49d commit 4020606

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

tests/Feature/ArchTest.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
<?php
22

3-
arch('No debugging statements are left in our code.')
4-
->expect(['dd', 'dump', 'ray'])
5-
->not->toBeUsed();
3+
arch('All files in the casts directory extend `CastsAttributes`.')
4+
->expect('App\Casts')
5+
->toExtend('Illuminate\Contracts\Database\Eloquent\CastsAttributes');
6+
7+
arch('All files in the casts directory have suffix `Cast`.')
8+
->expect('App\Casts')
9+
->toHaveSuffix('Cast');
10+
11+
arch('All files in the observers directory have suffix `Observer`.')
12+
->expect('App\Observers')
13+
->toHaveSuffix('Observer');
14+
15+
arch('All files in the policies directory have suffix `Policy`.')
16+
->expect('App\Policies')
17+
->toHaveSuffix('Policy');
18+
19+
arch('All files in the services directory have suffix `Service`.')
20+
->expect('App\Services')
21+
->toHaveSuffix('Service');
22+
23+
arch('ensures `env()` is only used in config files')
24+
->expect('env')
25+
->not->toBeUsed()
26+
->ignoring('config');

0 commit comments

Comments
 (0)