getMessage())->toBe('Brand with id "' . $id . '" was not found.') ->and($exception)->toBeInstanceOf(DomainException::class); }); it('get the correct message from code', function (): void { // GIVEN $code = new BrandCode('AAA01'); // WHEN $exception = BrandNotFoundException::fromCode($code); // THEN expect($exception->getMessage())->toBe('Brand with code "AAA01" was not found.') ->and($exception)->toBeInstanceOf(DomainException::class); }); });