58 lines
2 KiB
PHP
58 lines
2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Architecture;
|
|
|
|
use Presentation\Api\V1\Contracts\ApiResponse;
|
|
use Shared\DDD\Port\Directory;
|
|
use Shared\DDD\Port\Repository;
|
|
|
|
describe('Naming Conventions in Domain', function (): void {
|
|
arch('Port Directory interfaces have Directory suffix')
|
|
->expect('Domain\Ports\Directories')
|
|
->toHaveSuffix('Directory');
|
|
|
|
arch('Port Repository interfaces have Repository suffix')
|
|
->expect('Domain\Ports\Repositories')
|
|
->toHaveSuffix('Repository');
|
|
});
|
|
|
|
describe('Naming Conventions in Application', function (): void {
|
|
arch('Application usecases use strict types')
|
|
->expect('Application\Arcadia\Usecase')
|
|
->toUseStrictTypes();
|
|
});
|
|
|
|
describe('Naming Conventions in Presentation', function (): void {
|
|
arch('Controllers have Controller suffix')
|
|
->expect('Presentation\Api\V1\Http\Controllers')
|
|
->toHaveSuffix('Controller');
|
|
|
|
arch('Requests extending FormRequest must have Request suffix')
|
|
->expect('Presentation\Api\V1\Http\Requests')
|
|
->toExtend('Illuminate\Foundation\Http\FormRequest')
|
|
->toHaveSuffix('Request');
|
|
|
|
arch('Responses implementing ApiResponse must have Response suffix')
|
|
->expect('Presentation\Api\V1\Http\Responses')
|
|
->toImplement(ApiResponse::class)
|
|
->toHaveSuffix('Response');
|
|
});
|
|
|
|
describe('Naming Conventions in Infra', function (): void {
|
|
arch('Infra classes extending ServiceProvider must have Provider suffix')
|
|
->expect('Infra\Providers')
|
|
->toExtend('Illuminate\Support\ServiceProvider')
|
|
->toHaveSuffix('Provider');
|
|
|
|
arch('Infra directory adapters implementing Directory port must have Directory suffix')
|
|
->expect('Infra\Adapters\Directories')
|
|
->toImplement(Directory::class)
|
|
->toHaveSuffix('Directory');
|
|
|
|
arch('Infra repository adapters implementing Repository port must have Repository suffix')
|
|
->expect('Infra\Adapters\Repositories')
|
|
->toImplement(Repository::class)
|
|
->toHaveSuffix('Repository');
|
|
});
|