File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/Icons/tests/Unit/Registry Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \UX \Icons \Tests \Unit \Registry ;
13
13
14
14
use PHPUnit \Framework \TestCase ;
15
+ use Symfony \UX \Icons \Exception \IconNotFoundException ;
15
16
use Symfony \UX \Icons \Registry \InMemoryIconRegistry ;
16
17
use Symfony \UX \Icons \Svg \Icon ;
17
18
20
21
*/
21
22
final class InMemoryIconRegistryTest extends TestCase
22
23
{
23
- public function testRegistryConstructor ()
24
+ public function testRegistryConstructor (): void
24
25
{
25
26
$ icon = new Icon ('foo ' , ['bar ' => 'foobar ' ]);
26
27
$ registry = new InMemoryIconRegistry (['foo ' => $ icon ]);
27
28
28
29
$ this ->assertSame ($ icon , $ registry ->get ('foo ' ));
29
30
}
30
31
31
- public function testRegistryReplaceIcon ()
32
+ public function testRegistryReplaceIcon (): void
32
33
{
33
34
$ registry = new InMemoryIconRegistry ();
34
35
$ foo = new Icon ('foo ' , []);
@@ -43,4 +44,13 @@ public function testRegistryReplaceIcon()
43
44
$ registry ->set ('bar ' , $ foo );
44
45
$ this ->assertSame ($ foo , $ registry ->get ('bar ' ));
45
46
}
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
+ }
46
56
}
You can’t perform that action at this time.
0 commit comments