Пример #1
0
 /**
  * Sets up this test case
  *
  * @return void
  */
 public function setUp()
 {
     $this->view = $this->getAccessibleMock('TYPO3\\Fluid\\View\\StandaloneView', array('dummy'), array(), '', FALSE);
     $this->mockTemplateParser = $this->getMock('TYPO3\\Fluid\\Core\\Parser\\TemplateParser');
     $this->mockParsedTemplate = $this->getMock('TYPO3\\Fluid\\Core\\Parser\\ParsedTemplateInterface');
     $this->mockTemplateParser->expects($this->any())->method('parse')->will($this->returnValue($this->mockParsedTemplate));
     $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $this->mockObjectManager = $this->getMock('TYPO3\\Fluid\\Object\\ObjectManagerInterface');
     $this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'objectManagerCallback')));
     $this->mockObjectManager->expects($this->any())->method('create')->will($this->returnCallback(array($this, 'objectManagerCallback')));
     $this->mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
     $this->mockUriBuilder = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     $this->mockFlashMessages = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\FlashMessages');
     $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->mockControllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext');
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest));
     $this->mockViewHelperVariableContainer = $this->getMock('TYPO3\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer');
     $this->mockRenderingContext = $this->getMock('TYPO3\\Fluid\\Core\\Rendering\\RenderingContext');
     $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext));
     $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer));
     $this->view->injectTemplateParser($this->mockTemplateParser);
     $this->view->injectObjectManager($this->mockObjectManager);
     $this->view->setRenderingContext($this->mockRenderingContext);
     $this->mockTemplateCompiler = $this->getMock('TYPO3\\Fluid\\Core\\Compiler\\TemplateCompiler');
     $this->view->_set('templateCompiler', $this->mockTemplateCompiler);
     $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\Fluid\\Object\\ObjectManagerInterface', $this->mockObjectManager);
     \TYPO3\CMS\Core\Utility\GeneralUtility::addInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', $this->mockContentObject);
 }