public function testPluginWithoutEventAwareControllerRaisesDomainException() { $controller = new UneventfulController(); $plugin = new ForwardPlugin($this->controllers); $plugin->setController($controller); $this->setExpectedException('Zend\\Mvc\\Exception\\DomainException', 'InjectApplicationEventInterface'); $plugin->dispatch('forward'); }
public function testPluginWithoutLocatorAwareControllerRaisesDomainException() { $controller = new UnlocatableEventfulController(); $controller->setEvent($this->controller->getEvent()); $plugin = new ForwardPlugin(); $plugin->setController($controller); $this->setExpectedException('Zend\Mvc\Exception\DomainException', 'implements ServiceLocatorAwareInterface'); $plugin->dispatch('forward'); }
/** * compatibility with ModuleRouteListener * * @see Zend\Mvc\ModuleRouteListener */ public function testShorNamedController() { $shortNamedController = 'forward-fq'; $origCtlKey = ModuleRouteListener::ORIGINAL_CONTROLLER; $params = array(ModuleRouteListener::MODULE_NAMESPACE => 'ZendTest\\Mvc\\Controller\\TestAsset', 'action' => 'test', 'param1' => 'foo'); $result = $this->plugin->dispatch($shortNamedController, $params); $this->assertInternalType('array', $result); $this->assertArrayHasKey('content', $result); $this->assertEquals('ZendTest\\Mvc\\Controller\\TestAsset\\ForwardFqController::testAction', $result['content']); $this->assertArrayHasKey('params', $result); $this->assertArrayHasKey($origCtlKey, $result['params']); $this->assertEquals($shortNamedController, $result['params'][$origCtlKey]); }