- Added namespaces to various architecture test files for consistency. - Created a new integration test suite in phpunit.xml.
99 lines
2.6 KiB
PHP
99 lines
2.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Architecture;
|
|
|
|
use Shared\DDD\Directory;
|
|
use Shared\DDD\Entity;
|
|
use Shared\DDD\Repository;
|
|
|
|
describe('Domain Architecture Rules', function (): void {
|
|
arch('Domain Entities implement Shared\DDD\Entity')
|
|
->expect('Domain\Models\Entities')
|
|
->toImplement(Entity::class);
|
|
|
|
arch('Domain Entities are final and readonly')
|
|
->expect('Domain\Models\Entities')
|
|
->toBeReadonly()
|
|
->toBeFinal();
|
|
|
|
arch('Domain Ports contain only interfaces')
|
|
->expect('Domain\Ports')
|
|
->classes()
|
|
->toBeInterface();
|
|
|
|
arch('Domain Port Directories extend Shared\DDD\Directory')
|
|
->expect('Domain\Ports\Directories')
|
|
->toExtend(Directory::class);
|
|
|
|
arch('Domain Port Repositories extend Shared\DDD\Repository')
|
|
->expect('Domain\Ports\Repositories')
|
|
->toExtend(Repository::class);
|
|
|
|
arch('Domain does not depend on Application, Presentation, Infra, or App')
|
|
->expect('Domain')
|
|
->not->toUse([
|
|
'Application',
|
|
'Presentation',
|
|
'Infra',
|
|
'Infrastructure',
|
|
'App',
|
|
]);
|
|
|
|
arch('Domain does not depend on Illuminate or Symfony frameworks')
|
|
->expect('Domain')
|
|
->not->toUse([
|
|
'Illuminate',
|
|
'Symfony',
|
|
]);
|
|
|
|
arch('Domain Value Objects are readonly')
|
|
->expect('Domain\Models\ValueObjects')
|
|
->toBeReadonly()
|
|
->ignoring([
|
|
'Domain\Models\ValueObjects\Employees\EmployeeSortColumn',
|
|
'Domain\Models\ValueObjects\Inco\PortionType',
|
|
'Domain\Models\ValueObjects\IncoCompo\IncoCompoPartDto',
|
|
]);
|
|
|
|
arch('Domain exceptions extend native DomainException')
|
|
->expect('Domain\Exceptions')
|
|
->toExtend(\DomainException::class);
|
|
|
|
arch('Domain does not use Laravel helper functions')
|
|
->expect('Domain')
|
|
->not->toUse([
|
|
'abort',
|
|
'app',
|
|
'auth',
|
|
'asset',
|
|
'back',
|
|
'bcrypt',
|
|
'broadcast',
|
|
'cache',
|
|
'config',
|
|
'cookie',
|
|
'csrf_token',
|
|
'dd',
|
|
'dump',
|
|
'decrypt',
|
|
'dispatch',
|
|
'event',
|
|
'factory',
|
|
'logger',
|
|
'redirect',
|
|
'request',
|
|
'response',
|
|
'route',
|
|
'session',
|
|
'storage',
|
|
'url',
|
|
'throw_if',
|
|
'throw_unless',
|
|
'__',
|
|
'trans',
|
|
'trans_choice',
|
|
'view',
|
|
]);
|
|
});
|