File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,7 +52,11 @@ public function getAllowedPluginDescriptions(): array
5252 $ descriptions = [];
5353
5454 foreach ($ this ->getAllowedPlugins () as $ pluginName ) {
55- $ descriptions [$ pluginName ] = $ this ->getPluginDescription ($ pluginName );
55+ try {
56+ $ descriptions [$ pluginName ] = $ this ->getPluginDescription ($ pluginName );
57+ } catch (\Throwable $ e ) {
58+ $ descriptions [$ pluginName ] = '' ;
59+ }
5660 }
5761
5862 return $ descriptions ;
Original file line number Diff line number Diff line change @@ -143,6 +143,31 @@ public function testGetAllowedPluginDescriptionsReturnsEmptyStringWhenDescriptio
143143 $ this ->assertSame (['Login ' => '' ], $ provider ->getAllowedPluginDescriptions ());
144144 }
145145
146+ public function testGetAllowedPluginDescriptionsContinuesWhenOnePluginDescriptionFails (): void
147+ {
148+ $ provider = $ this ->getMockBuilder (PluginListProvider::class)
149+ ->disableOriginalConstructor ()
150+ ->onlyMethods (['getAllowedPlugins ' , 'getPluginDescription ' ])
151+ ->getMock ();
152+
153+ $ provider ->method ('getAllowedPlugins ' )
154+ ->willReturn (['Login ' , 'BrokenPlugin ' , 'ActivityLog ' ]);
155+ $ provider ->method ('getPluginDescription ' )
156+ ->willReturnCallback (static function (string $ pluginName ): string {
157+ if ($ pluginName === 'BrokenPlugin ' ) {
158+ throw new \RuntimeException ('Could not register API class ' );
159+ }
160+
161+ return $ pluginName === 'Login ' ? 'Login API description ' : 'Activity log API description ' ;
162+ });
163+
164+ $ this ->assertSame ([
165+ 'Login ' => 'Login API description ' ,
166+ 'BrokenPlugin ' => '' ,
167+ 'ActivityLog ' => 'Activity log API description ' ,
168+ ], $ provider ->getAllowedPluginDescriptions ());
169+ }
170+
146171 /**
147172 * @param string[] $activatedPlugins
148173 * @param array<string, bool> $inFilesystemByPlugin
You can’t perform that action at this time.
0 commit comments