/** * @dataProvider getBackendLayoutConfigurationTestValues * @param Provider $provider * @param mixed $record * @param array $expected */ public function testGetBackendLayoutConfiguration(Provider $provider, $record, array $expected) { $instance = new BackendLayoutDataProvider(); $pageUid = 1; /** @var ConfigurationService|\PHPUnit_Framework_MockObject_MockObject $configurationService */ $configurationService = $this->getMock('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService', array('resolvePageProvider', 'debug', 'message')); if (null !== $record) { $configurationService->expects($this->once())->method('resolvePageProvider')->with($record)->willReturn($provider); } /** @var WorkspacesAwareRecordService|\PHPUnit_Framework_MockObject_MockObject $recordService */ $recordService = $this->getMock('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService', array('getSingle')); $recordService->expects($this->once())->method('getSingle')->willReturn($record); $instance->injectConfigurationService($configurationService); $instance->injectWorkspacesAwareRecordService($recordService); $result = $this->callInaccessibleMethod($instance, 'getBackendLayoutConfiguration', $pageUid); $this->assertEquals($expected, $result); }
/** * @dataProvider getBackendLayoutConfigurationTestValues * @param Provider $provider * @param mixed $record * @param array $expected */ public function testGetBackendLayoutConfiguration(Provider $provider, $record, array $expected) { $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array('sL')); $GLOBALS['LANG']->csConvObj = $this->getMock('TYPO3\\CMS\\Core\\Charset\\CharsetConverter', array('readLLfile')); $GLOBALS['LANG']->expects($this->any())->method('sL')->willReturn('translatedlabel'); $GLOBALS['LANG']->csConvObj->expects($this->any())->method('readLLfile')->willReturn(array()); $instance = new BackendLayoutDataProvider(); $pageUid = 1; $backendLayout = array(); $configurationService = $this->getMock('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService', array('resolvePageProvider', 'debug', 'message')); if (NULL !== $record) { $configurationService->expects($this->once())->method('resolvePageProvider')->with($record)->willReturn($provider); } $recordService = $this->getMock('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService', array('getSingle')); $recordService->expects($this->once())->method('getSingle')->willReturn($record); $instance->injectConfigurationService($configurationService); $instance->injectWorkspacesAwareRecordService($recordService); $result = $this->callInaccessibleMethod($instance, 'getBackendLayoutConfiguration', $pageUid); $this->assertEquals($expected, $result); }