FluidTYPO3\Fluidcontent\Tests\Unit\Service\ConfigurationServiceTest::testWriteCachedConfigurationIfMissing PHP Method

testWriteCachedConfigurationIfMissing() public method

    public function testWriteCachedConfigurationIfMissing()
    {
        $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array('prepare_SELECTquery'), array(), '', FALSE);
        $preparedStatementMock = $this->getMock('TYPO3\\CMS\\Core\\Database\\PreparedStatement', array('execute', 'fetch', 'free'), array(), '', FALSE);
        $preparedStatementMock->expects($this->any())->method('execute')->willReturn(FALSE);
        $preparedStatementMock->expects($this->any())->method('free');
        $preparedStatementMock->expects($this->any())->method('fetch')->willReturn(FALSE);
        $GLOBALS['TYPO3_DB']->expects($this->any())->method('prepare_SELECTquery')->willReturn($preparedStatementMock);
        /** @var ConfigurationService|\PHPUnit_Framework_MockObject_MockObject $service */
        $service = $this->getMock('FluidTYPO3\\Fluidcontent\\Service\\ConfigurationService', array('getAllRootTypoScriptTemplates', 'getTypoScriptTemplatesInRootline', 'renderPageTypoScriptForPageUid'), array(), '', FALSE);
        $service->expects($this->once())->method('getTypoScriptTemplatesInRootline')->willReturn(array(array('pid' => 1)));
        $service->expects($this->any())->method('renderPageTypoScriptForPageUid')->willReturn('test');
        $service->injectConfigurationManager(GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'));
        $service->injectCacheManager(GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Core\\Cache\\CacheManager'));
        $service->injectRecordService(GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService'));
        $pageRepository = $this->getMock(PageRepository::class, array('getRootLine'));
        $pageRepository->expects($this->any())->method('getRootLine')->willReturn(array(array('uid' => 1)));
        $service->injectPageRepository($pageRepository);
        $service->writeCachedConfigurationIfMissing();
    }