@@ -33,11 +33,16 @@ public function testGetInAppFeature(): void
3333 {
3434 $ extension = new ExtensionStruct ();
3535 $ extension ->setName ('testExtension ' );
36+ $ otherExtension = new ExtensionStruct ();
37+ $ otherExtension ->setName ('otherExtension ' );
3638 $ service = $ this ->createMock (InAppPurchasesService::class);
3739 $ dataProvider = $ this ->createMock (AbstractExtensionDataProvider::class);
3840 $ dataProvider ->expects (static ::once ())
3941 ->method ('getInstalledExtensions ' )
40- ->willReturn (new ExtensionCollection ([$ extension ]));
42+ ->willReturn (new ExtensionCollection ([
43+ 'otherExtension ' => $ otherExtension ,
44+ 'testExtension ' => $ extension ,
45+ ]));
4146
4247 $ controller = new InAppPurchasesController (
4348 $ service ,
@@ -54,6 +59,30 @@ public function testGetInAppFeature(): void
5459 static ::assertSame ('testExtension ' , $ content ['name ' ]);
5560 }
5661
62+ public function testGetInAppFeatureWithUnknownExtension (): void
63+ {
64+ $ extension = new ExtensionStruct ();
65+ $ extension ->setName ('testExtension ' );
66+ $ service = $ this ->createMock (InAppPurchasesService::class);
67+ $ dataProvider = $ this ->createMock (AbstractExtensionDataProvider::class);
68+ $ dataProvider ->expects (static ::once ())
69+ ->method ('getInstalledExtensions ' )
70+ ->willReturn (new ExtensionCollection (['testExtension ' => $ extension ]));
71+
72+ $ controller = new InAppPurchasesController (
73+ $ service ,
74+ $ this ->createMock (InAppPurchaseUpdater::class),
75+ $ dataProvider ,
76+ $ this ->createMock (InAppPurchasesGateway::class),
77+ $ this ->createMock (EntityRepository::class),
78+ );
79+
80+ $ this ->expectException (ExtensionStoreException::class);
81+ $ this ->expectExceptionMessage ('The extension with technical name "otherExtension" is not known. ' );
82+
83+ $ controller ->getInAppPurchaseDetails ('otherExtension ' , Context::createDefaultContext ());
84+ }
85+
5786 public function testCreateCart (): void
5887 {
5988 $ cartStruct = $ this ->getInAppPurchaseCartStruct ();
0 commit comments