/** * Sets up this test case * @return void */ public function setUp() { $this->view = $this->getMock('TYPO3\\FLOW3\\Mvc\\View\\JsonView', array('loadConfigurationFromYamlFile')); $this->controllerContext = $this->getMock('TYPO3\\FLOW3\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE); $this->response = $this->getMock('TYPO3\\FLOW3\\Http\\Response', array()); $this->controllerContext->expects($this->any())->method('getResponse')->will($this->returnValue($this->response)); $this->view->setControllerContext($this->controllerContext); }
/** * @test */ public function renderReplacesErrorMessageMarkerWithEmptyStringIfNoErrorMessageIsSet() { $mockRequest = $this->getMock('\\TYPO3\\FLOW3\\Mvc\\RequestInterface'); $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($mockRequest)); $templateUrl = \vfsStream::url('testDirectory') . '/template.html'; file_put_contents($templateUrl, 'error message: {ERROR_MESSAGE}'); $this->view->expects($this->once())->method('getTemplatePathAndFilename')->will($this->returnValue($templateUrl)); $this->assertSame('error message: ', $this->view->render()); }