ldc-mesbr-app/tests/Unit/Domain/Exceptions/BrandCodeAlreadyExistsExceptionTest.php

25 lines
674 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Exceptions;
use Domain\Exceptions\BrandCodeAlreadyExistsException;
use Domain\Models\ValueObjects\Brand\BrandCode;
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);
});
});