public function testSetGetControllerName() { $this->_request->setControllerName('foo'); $this->assertEquals('foo', $this->_request->getControllerName()); $this->_request->setControllerName('bar'); $this->assertEquals('bar', $this->_request->getControllerName()); }
public function setUp() { $savePath = ini_get('session.save_path'); if (strpos($savePath, ';')) { $savePath = explode(';', $savePath); $savePath = array_pop($savePath); } if (empty($savePath)) { $this->markTestSkipped('Cannot test FlashMessenger due to unavailable session save path'); } if (headers_sent()) { $this->markTestSkipped('Cannot test FlashMessenger: cannot start session because headers already sent'); } \Zend\Session\Manager::start(); $this->front = \Zend\Controller\Front::getInstance(); $this->front->resetInstance(); $this->front->setControllerDirectory(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . '_files'); $this->front->returnResponse(true); $this->request = new \Zend\Controller\Request\Http(); $this->request->setControllerName('helper-flash-messenger'); $this->response = new \Zend\Controller\Response\Cli(); $this->controller = new \HelperFlashMessengerController($this->request, $this->response, array()); $this->helper = new \Zend\Controller\Action\Helper\FlashMessenger($this->controller); }
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); }