'd']; /** @var TestPluginService|MockObject */ private $testPluginService; /** @var QtiRunnerConfig|MockObject */ private $qtiRunnerConfig; /** @var TestProviderService|MockObject */ private $testProviderService; /** @var TestPreviewerConfigurationMapper */ private $testPreviewerConfigurationMapper; /** @var TestPreviewerConfigurationService */ private $subject; public function setUp(): void { $this->testProviderService = $this->createMock(TestProviderService::class); $this->testPluginService = $this->createMock(TestPluginService::class); $this->qtiRunnerConfig = $this->createMock(QtiRunnerConfig::class); $this->testPreviewerConfigurationMapper = new TestPreviewerConfigurationMapper(); $this->subject = new TestPreviewerConfigurationService(); $this->subject->setServiceLocator( $this->getServiceLocatorMock( [ TestPluginService::SERVICE_ID => $this->testPluginService, TestProviderService::SERVICE_ID => $this->testProviderService, QtiRunnerConfig::SERVICE_ID => $this->qtiRunnerConfig, TestPreviewerConfigurationMapper::class => $this->testPreviewerConfigurationMapper, ] ) ); } public function testGetTestRunnerConfiguration(): void { $this->qtiRunnerConfig->method('getConfig')->willReturn(self::OPTIONS); $plugins = $this->getPlugins(); $providers = $this->getProviders(); $this->testPluginService->method('getAllPlugins')->willReturn($plugins); $this->testProviderService->method('getAllProviders')->willReturn($providers); $configurationSample = new TestPreviewerConfig( ['category' => $providers, 'plugins' => $plugins,], self::OPTIONS ); $this->assertEquals( $configurationSample, $this->subject->getConfiguration() ); } private function getPlugins(): array { return [ new TestPlugin('id1', 'module', 'category', ['active' => true]), new TestPlugin('id2', 'module', 'category', ['active' => true]), ]; } private function getProviders(): array { return [ new ProviderModule('idp1', 'module', 'category', ['active' => true]), new ProviderModule('idp2', 'module', 'category', ['active' => true]), ]; } }