25 lines
694 B
PHP
25 lines
694 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Exceptions;
|
|
|
|
use Domain\Exceptions\BrandCodeAlreadyExistsException;
|
|
use Domain\Models\ValueObjects\Brand\BrandCode;
|
|
use DomainException;
|
|
|
|
covers(BrandCodeAlreadyExistsException::class);
|
|
|
|
describe('brand code already exists exception', function (): void {
|
|
it('get the correct message', function (): void {
|
|
// GIVEN
|
|
$code = new BrandCode('AAA01');
|
|
|
|
// WHEN
|
|
$exception = new BrandCodeAlreadyExistsException($code);
|
|
|
|
// THEN
|
|
expect($exception->getMessage())->toBe('Brand code "AAA01" already exists.')
|
|
->and($exception)->toBeInstanceOf(DomainException::class);
|
|
});
|
|
});
|