getServiceLocatorMock([ TestPluginService::SERVICE_ID => $this->getTestPluginService() ]); $feature = new SecurityFeature(); $feature->setServiceLocator($serviceLocatorMock); $plugins = $feature->getPluginsIds(); sort($plugins); $this->assertEquals(['secure1', 'secure2'], $plugins); } //data to stub the registry content private static $pluginData = [ 'taoQtiTest/runner/plugins/myPlugin' => [ 'id' => 'myPlugin', 'module' => 'baz', 'category' => 'test', ], 'taoQtiTest/runner/plugins/controls/title/title' => [ 'id' => 'title', 'module' => 'qux', 'category' => 'controls', 'active' => true ], 'taoQtiTest/runner/plugins/controls/timer/timer' => [ 'id' => 'secure1', 'module' => 'foo', 'category' => 'security', 'active' => true ], 'taoQtiTest/runner/plugins/inactive' => [ 'id' => 'secure2', 'module' => 'bar', 'category' => 'security', 'active' => true ] ]; /** * Get the service with the stubbed registry * @return TestPluginService */ protected function getTestPluginService() { $prophecy = $this->prophesize(PluginRegistry::class); $prophecy->getMap()->willReturn(self::$pluginData); $testPluginService = new TestPluginService(); $testPluginService->setRegistry($prophecy->reveal()); return $testPluginService; } }