/** * @expectedException RuntimeException */ public function testControllerActionLogicException() { $app = new App(['timezone' => 'UTC'], 'test-action'); $app->route()->setParam('controller', 'foo'); $app->route()->setParam('action', ''); $stub = $this->getMock(Controller::class, ['indexAction', 'controllerAction'], [$app]); $stub->method('controllerAction')->willReturn(true); $foo = new FooController($app); $this->assertEquals($stub->controllerAction(), $foo->testAction()); }
/** * Create respective class instances for controller usage. * Mapped and re-assign to the core instances. */ protected function factory() { $this->request = $this->app->request(); $this->response = $this->app->response(); $this->route = $this->app->route(); $this->view = $this->app->view(); return $this; }
public function testSingletonRouteClassInstanceViaStaticMethod() { $this->assertEquals($this->app->route(), App::route()); }
/** * Return requested action. */ public function getAction() { return $this->app->route()->getParams('action'); }