FluidTYPO3\Fluidpages\Tests\Unit\Provider\PageProviderTest::testGetControllerActionFromRecord PHP Method

testGetControllerActionFromRecord() public method

public testGetControllerActionFromRecord ( array $record, string $fieldName, boolean $expectsMessage, string $expected )
$record array
$fieldName string
$expectsMessage boolean
$expected string
    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->injectPageConfigurationService($configurationService);
        }
        // make sure PageProvider is now using the right field name
        $instance->trigger($record, null, $fieldName);
        $result = $instance->getControllerActionFromRecord($record);
        $this->assertEquals($expected, $result);
    }