/** * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $module = new ModuleStub(TEMP_DIR); $module->setController('test-controller', 'Titon\\Test\\Stub\\ControllerStub'); $app = new Application(new Request(), new Response()); $app->addModule('test-module', $module); $this->object = new FrontDispatcher(); $this->object->setApplication($app); $this->object->setRequest($app->getRequest()); $this->object->setResponse($app->getResponse()); $this->object->setParams(['module' => 'test-module', 'controller' => 'test-controller', 'action' => 'actionNoArgs', 'args' => []]); }
/** * Test that getController() returns a controller instance. */ public function testGetController() { $module = new ModuleStub(TEMP_DIR); $module->setController('test-controller', 'Titon\\Test\\Stub\\ControllerStub'); $app = new Application(new Request(), new Response()); $app->addModule('test-module', $module); $this->object->setApplication($app); $this->object->setRequest(new Request()); $this->object->setResponse(new Response()); $this->object->setParams(['module' => 'test-module', 'controller' => 'test-controller']); $this->assertInstanceOf('Titon\\Test\\Stub\\ControllerStub', $this->object->getController()); }