Skip to content

Commit 372cd76

Browse files
committed
Add missing test
1 parent 461b468 commit 372cd76

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Icons/tests/Unit/Registry/InMemoryIconRegistryTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\UX\Icons\Tests\Unit\Registry;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\UX\Icons\Exception\IconNotFoundException;
1516
use Symfony\UX\Icons\Registry\InMemoryIconRegistry;
1617
use Symfony\UX\Icons\Svg\Icon;
1718

@@ -20,15 +21,15 @@
2021
*/
2122
final class InMemoryIconRegistryTest extends TestCase
2223
{
23-
public function testRegistryConstructor()
24+
public function testRegistryConstructor(): void
2425
{
2526
$icon = new Icon('foo', ['bar' => 'foobar']);
2627
$registry = new InMemoryIconRegistry(['foo' => $icon]);
2728

2829
$this->assertSame($icon, $registry->get('foo'));
2930
}
3031

31-
public function testRegistryReplaceIcon()
32+
public function testRegistryReplaceIcon(): void
3233
{
3334
$registry = new InMemoryIconRegistry();
3435
$foo = new Icon('foo', []);
@@ -43,4 +44,13 @@ public function testRegistryReplaceIcon()
4344
$registry->set('bar', $foo);
4445
$this->assertSame($foo, $registry->get('bar'));
4546
}
47+
48+
public function testRegistryThrowsExceptionOnUnknownIcon(): void
49+
{
50+
$this->expectException(IconNotFoundException::class);
51+
$this->expectExceptionMessage('Icon "foo" not found.');
52+
53+
$registry = new InMemoryIconRegistry();
54+
$registry->get('foo');
55+
}
4656
}

0 commit comments

Comments
 (0)