Example #1
0
 /**
  * @dataProvider getControllerActionFromRecordTestValues
  * @param array $record
  * @param string $fieldName
  * @param boolean $expectsMessage
  * @param string $expected
  */
 public function testGetControllerActionFromRecord(array $record, $fieldName, $expectsMessage, $expected)
 {
     $instance = new PageProvider();
     if (PageControllerInterface::DOKTYPE_RAW !== $record['doktype'] && TRUE === empty($record[$fieldName])) {
         /** @var PageService $service */
         $service = $this->getMock('FluidTYPO3\\Fluidpages\\Service\\PageService', array('getPageTemplateConfiguration'));
         $instance->injectPageService($service);
     }
     if (TRUE === $expectsMessage) {
         /** @var ConfigurationService|\PHPUnit_Framework_MockObject_MockObject $configurationService */
         $configurationService = $this->getMock('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService', array('message'));
         $configurationService->expects($this->once())->method('message');
         $instance->injectConfigurationService($configurationService);
     }
     // make sure PageProvider is now using the right field name
     $instance->trigger($record, NULL, $fieldName);
     $result = $instance->getControllerActionFromRecord($record);
     $this->assertEquals($expected, $result);
 }