FluidTYPO3\Fluidpages\Provider\PageProvider::getControllerActionFromRecord PHP Метод

getControllerActionFromRecord() публичный Метод

public getControllerActionFromRecord ( array $row ) : string
$row array
Результат string
    public function getControllerActionFromRecord(array $row)
    {
        if (PageControllerInterface::DOKTYPE_RAW === (int) $row['doktype']) {
            return 'raw';
        }
        $action = $this->getControllerActionReferenceFromRecord($row);
        if (true === empty($action)) {
            $this->pageConfigurationService->message('No page template selected and no template was inherited from parent page(s)');
            return 'default';
        }
        $controllerActionName = array_pop(explode('->', $action));
        $controllerActionName[0] = strtolower($controllerActionName[0]);
        return $controllerActionName;
    }

Usage 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);
 }