/** * @dataProvider getRenderInheritanceFieldTestValues * @param array $parameters * @param array $settings * @param boolean $expectsEmpty */ public function testRenderInheritanceField(array $parameters, array $settings, $expectsEmpty) { $typoScript = array('plugin.' => array('tx_fluidpages.' => $settings)); /** @var ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject $configurationManager */ $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('getConfiguration')); $configurationManager->expects($this->any())->method('getConfiguration')->willReturn($typoScript); $instance = new PageLayoutSelector(); $instance->injectConfigurationManager($configurationManager); $result = $this->callInaccessibleMethod($instance, 'renderInheritanceField', $parameters); if (true === $expectsEmpty) { $this->assertEmpty($result); } else { $this->assertNotEmpty($result); } }
/** * @dataProvider getRenderOptionTestValues * @param string $file * @param Form|NULL $form * @param $expectedMessageFunction * @param $expectsEmptyOutput */ public function testRenderOption($file, $form, $expectedMessageFunction, $expectsEmptyOutput) { $instance = new PageLayoutSelector(); /** @var ConfigurationService|\PHPUnit_Framework_MockObject_MockObject $service */ $service = $this->getMock('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService', array('getPageConfiguration', 'getFormFromTemplateFile', 'message', 'debug')); $service->expects($this->any())->method('getPageConfiguration')->willReturn(array('templateRootPaths' => array('EXT:fluidpages/Tests/Fixtures/Templates/'))); $service->expects($this->any())->method('getFormFromTemplateFile')->willReturn($form); if (NULL !== $expectedMessageFunction) { $service->expects($this->once())->method($expectedMessageFunction); } $instance->injectConfigurationService($service); $result = $this->callInaccessibleMethod($instance, 'renderOption', 'fluidpages', $file, array()); if (TRUE === $expectsEmptyOutput) { $this->assertEmpty($result); } else { $this->assertNotEmpty($result); } }