public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvokedInDefaultModule() { require_once $this->basePath . '/_files/modules/application/controllers/Admin/HelperController.php'; $this->request->setControllerName('admin_helper')->setActionName('render'); $controller = new \Admin\HelperController($this->request, $this->response, array()); $this->helper->render(); $body = $this->response->getBody(); $this->assertContains('SampleZfHelper invoked', $body, 'Received ' . $body); }
public function testPostDispatchQuitsWithFalseUserErrorHandlerParam() { $front = Controller\Front::getInstance(); $front->resetInstance(); $front->setParam('noErrorHandler', true); $this->response->setException(new Dispatcher\Exception('Testing controller exception')); $this->request->setModuleName('foo')->setControllerName('bar')->setActionName('baz'); $this->plugin->postDispatch($this->request); $this->assertNull($this->request->getParam('error_handler')); }
public function testUseAbsoluteUriSetsFullUriInResponse() { $_SERVER['HTTP_HOST'] = 'foobar.example.com'; $_SERVER['SERVER_PORT'] = '4443'; $_SERVER['HTTPS'] = 1; $this->redirector->setUseAbsoluteUri(true); $this->redirector->gotoUrl('/bar/baz'); $headers = $this->response->getHeaders(); $uri = false; foreach ($headers as $header) { if ('Location' == $header['name']) { $uri = $header['value']; } } if (!$uri) { $this->fail('No redirect header set in response'); } $this->assertEquals('https://foobar.example.com:4443/bar/baz', $uri); }