/** * @test */ public function throwStatusSetsTheStatusMessageAsContentIfNoFurtherContentIsProvided() { $controller = $this->getAccessibleMock(AbstractController::class, ['processRequest']); $controller->_call('initializeController', $this->mockActionRequest, $this->mockHttpResponse); $this->mockHttpResponse->expects($this->atLeastOnce())->method('setStatus')->with(404, null); $this->mockHttpResponse->expects($this->atLeastOnce())->method('getStatus')->will($this->returnValue('404 Not Found')); $this->mockHttpResponse->expects($this->atLeastOnce())->method('setContent')->with('404 Not Found'); try { $controller->_call('throwStatus', 404); } catch (StopActionException $e) { } }
/** * @test */ public function renderSetsContentTypeHeader() { $this->response->expects($this->once())->method('setHeader')->with('Content-Type', 'application/json'); $this->view->render(); }
/** * @test */ public function handleCallsMakeStandardsCompliantOnTheCurrentResponse() { $this->mockHttpResponse->expects($this->once())->method('makeStandardsCompliant')->with($this->mockHttpRequest); $this->standardsComplianceComponent->handle($this->mockComponentContext); }