ldc-arcadia-api/tests/Architecture/PresentationTest.php

41 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Architecture;
use Presentation\Api\V1\Contracts\ApiResponse;
describe('Presentation Architecture Rules', function (): void {
arch('Presentation layer does not depend on Infra or App')
->expect('Presentation')
->not->toUse([
'Infra',
'Infrastructure',
'App',
]);
arch('Presentation Controllers are invokable single action controllers')
->expect('Presentation\Api\V1\Http\Controllers')
->toBeInvokable();
arch('Presentation Responses implement Presentation\Api\V1\Contracts\ApiResponse')
->expect('Presentation\Api\V1\Http\Responses')
->toImplement(ApiResponse::class);
arch('Presentation FormRequests extend Illuminate\Foundation\Http\FormRequest')
->expect('Presentation\Api\V1\Http\Requests')
->toExtend('Illuminate\Foundation\Http\FormRequest');
arch('Presentation FormRequests do not contain toInput method')
->expect('Presentation\Api\V1\Http\Requests')
->not->toHaveMethod('toInput');
arch('Presentation FormRequests do not contain authorize method (auth is handled in middleware filters)')
->expect('Presentation\Api\V1\Http\Requests')
->not->toHaveMethod('authorize');
arch('Presentation layer uses strict types')
->expect('Presentation')
->toUseStrictTypes();
});