/** * @throws \InvalidArgumentException * @throws \PHPUnit_Framework_Exception */ protected function setUp() { $GLOBALS['TSFE'] = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false); $this->mockContentObject = $this->getMock(ContentObjectRenderer::class); $this->mockRequest = $this->getMock(Request::class); $this->mockExtensionService = $this->getMock(ExtensionService::class); $this->mockConfigurationManager = $this->getMock(ConfigurationManagerInterface::class); $this->uriBuilder = $this->getAccessibleMock(UriBuilder::class, array('build')); $this->uriBuilder->setRequest($this->mockRequest); $this->uriBuilder->_set('contentObject', $this->mockContentObject); $this->uriBuilder->_set('configurationManager', $this->mockConfigurationManager); $this->uriBuilder->_set('extensionService', $this->mockExtensionService); $this->uriBuilder->_set('environmentService', $this->getMock(EnvironmentService::class)); // Mocking backend user is required for backend URI generation as BackendUtility::getModuleUrl() is called $backendUserMock = $this->getMock(BackendUserAuthentication::class); $backendUserMock->expects($this->any())->method('check')->will($this->returnValue(true)); $GLOBALS['BE_USER'] = $backendUserMock; }
public function setUp() { $GLOBALS['TSFE'] = $this->getMock('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), array(), '', FALSE); $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $this->mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request'); $this->mockExtensionService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\ExtensionService'); $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); $this->uriBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder', array('build')); $this->uriBuilder->setRequest($this->mockRequest); $this->uriBuilder->_set('contentObject', $this->mockContentObject); $this->uriBuilder->_set('configurationManager', $this->mockConfigurationManager); $this->uriBuilder->_set('extensionService', $this->mockExtensionService); $this->uriBuilder->_set('environmentService', $this->getMock('TYPO3\\CMS\\Extbase\\Service\\EnvironmentService')); // Mocking backend user is required for backend URI generation as BackendUtility::getModuleUrl() is called $backendUserMock = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication'); $backendUserMock->expects($this->any())->method('check')->will($this->returnValue(TRUE)); $GLOBALS['BE_USER'] = $backendUserMock; }