コード例 #1
0
ファイル: ViewRendererTest.php プロジェクト: heiglandreas/zf2
 public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvoked()
 {
     require_once $this->basePath . '/_files/modules/foo/controllers/Admin/IndexController.php';
     $this->request->setModuleName('foo')->setControllerName('admin_index')->setActionName('use-helper');
     $controller = new \Foo\Admin\IndexController($this->request, $this->response, array());
     $this->helper->render();
     $body = $this->response->getBody();
     $this->assertContains('FooUseHelper invoked', $body, 'Received ' . $body);
 }
コード例 #2
0
ファイル: ErrorHandlerTest.php プロジェクト: narixx/zf2
 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'));
 }
コード例 #3
0
ファイル: RedirectorTest.php プロジェクト: rexmac/zf2
 /**
  * @group ZF-4318
  */
 public function testServerVariableHttpsToOffDoesNotBuildHttpsUrl()
 {
     // Set Preconditions from Issue:
     $_SERVER['HTTPS'] = "off";
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['SERVER_PORT'] = 80;
     $this->redirector->setUseAbsoluteUri(true);
     $this->request->setModuleName('admin')->setControllerName('class')->setActionName('view');
     $this->redirector->gotoUrl('/bar/baz');
     $test = $this->redirector->getRedirectUrl();
     $this->assertNotContains('https://', $test);
     $this->assertEquals('http://localhost/bar/baz', $test);
 }
コード例 #4
0
ファイル: ErrorHandler.php プロジェクト: jager/cms
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     $front = Zend_Controller_Front::getInstance();
     if (!$front->getPlugin('Zend_Controller_Plugin_ErrorHandler') instanceof Zend_Controller_Plugin_ErrorHandler) {
         return;
     }
     $error = $front->getPlugin('Zend_Controller_Plugin_ErrorHandler');
     $testRequest = new Zend_Controller_Request_HTTP();
     $testRequest->setModuleName($request->getModuleName())->setControllerName($error->getErrorHandlerController())->setActionName($error->getErrorHandlerAction());
     if ($front->getDispatcher()->isDispatchable($testRequest)) {
         $error->setErrorHandlerModule($request->getModuleName());
     }
 }
コード例 #5
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     $front = Zend_Controller_Front::getInstance();
     //If the ErrorHandler plugin is not registered, bail out
     if (!$front->getPlugin('Zend_Controller_Plugin_ErrorHandler') instanceof Zend_Controller_Plugin_ErrorHandler) {
         return;
     }
     $error = $front->getPlugin('Zend_Controller_Plugin_ErrorHandler');
     //Generate a test request to use to determine if the error controller in our module exists
     $testRequest = new Zend_Controller_Request_HTTP();
     $testRequest->setModuleName($request->getModuleName())->setControllerName($error->getErrorHandlerController())->setActionName($error->getErrorHandlerAction());
     //Does the controller even exist?
     if ($front->getDispatcher()->isDispatchable($testRequest)) {
         $error->setErrorHandlerModule($request->getModuleName());
     }
 }