55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Shared\DDD\UseCases\Input;
|
|
use Shared\DDD\UseCases\Output;
|
|
use Shared\DDD\UseCases\UseCase;
|
|
|
|
describe('application layer architecture rules', function (): void {
|
|
arch('use cases implement UseCase and are final')
|
|
->expect('Application\\UseCases')
|
|
->classes()
|
|
->implementing(UseCase::class)
|
|
->toBeFinal();
|
|
|
|
arch('use cases implement UseCase and are readonly')
|
|
->expect('Application\\UseCases')
|
|
->classes()
|
|
->implementing(UseCase::class)
|
|
->toBeReadonly();
|
|
|
|
arch('use case inputs implement Input interface and are final')
|
|
->expect('Application\\UseCases')
|
|
->classes()
|
|
->implementing(Input::class)
|
|
->toBeFinal();
|
|
|
|
arch('use case inputs implement Input interface and are readonly')
|
|
->expect('Application\\UseCases')
|
|
->classes()
|
|
->implementing(Input::class)
|
|
->toBeReadonly();
|
|
|
|
arch('use case outputs implement Output interface and are final')
|
|
->expect('Application\\UseCases')
|
|
->classes()
|
|
->implementing(Output::class)
|
|
->toBeFinal();
|
|
|
|
arch('use case outputs implement Output interface and are readonly')
|
|
->expect('Application\\UseCases')
|
|
->classes()
|
|
->implementing(Output::class)
|
|
->toBeReadonly();
|
|
|
|
arch('application exceptions extend Exception and are final')
|
|
->expect('Application')
|
|
->classes()
|
|
->extending(\Exception::class)
|
|
->toBeFinal();
|
|
|
|
arch('application layer does not use Infrastructure or framework internals')
|
|
->expect('Application')
|
|
->not->toUse(['Infrastructure', 'Illuminate', 'Symfony']);
|
|
});
|