Add Arch tests
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
1521aba1f8
commit
f858716e57
|
@ -10,6 +10,9 @@
|
|||
<testsuite name="Fileshare">
|
||||
<directory suffix="Test.php">./tests/Fileshare</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Arch">
|
||||
<file>tests/Arch.php</file>
|
||||
</testsuite>
|
||||
<testsuite name="NamiUnit">
|
||||
<directory suffix="Test.php">./packages/laravel-nami/tests/Unit</directory>
|
||||
</testsuite>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
arch()
|
||||
->expect('App')
|
||||
->not->toUse(['die', 'dd', 'dump']);
|
||||
|
||||
|
||||
arch()
|
||||
->expect(globArch('App\*\Models'))
|
||||
->toExtend('Illuminate\Database\Eloquent\Model')
|
||||
->toBeClasses();
|
||||
|
||||
arch('app')
|
||||
->expect('App')
|
||||
->not->toHaveFileSystemPermissions('0777');
|
|
@ -11,6 +11,8 @@
|
|||
|
|
||||
*/
|
||||
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
uses(
|
||||
Tests\TestCase::class,
|
||||
// Illuminate\Foundation\Testing\RefreshDatabase::class,
|
||||
|
@ -41,3 +43,12 @@ uses(
|
|||
| global functions to help you to reduce the number of lines of code in your test files.
|
||||
|
|
||||
*/
|
||||
|
||||
function globArch(string $pattern)
|
||||
{
|
||||
$files = iterator_to_array(Finder::create()->files()->in(str($pattern)->replaceStart('App', './app')->replace('\\', '/'))->name('*.php'));
|
||||
|
||||
return collect($files)->map(
|
||||
fn ($file) => str($file->getPathname())->replaceStart('./app', 'App')->replace('/', '\\')->replaceEnd('.php', '')->toString()
|
||||
)->values()->toArray();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue