Example #1
0
 /**
  * @runInSeparateProcess
  *
  * Running in a separate process ensures that the controller classes don't exist
  * thus causing the 604 "Controller not Found" error
  * Note: Controller is not passed/defined in getRouterMock
  */
 public function testRouterAlwaysReturnsResponse()
 {
     $router = $this->getRouterMock();
     $this->application->updateInstance('Router', $router);
     $request = $this->getRequestMock('/test/2');
     $this->setRoutes();
     /*
      * Following matches route '/test/{id:default=1}' but since controller
      * is not defined we get a "Controller not found" (604) error
      */
     $response = $router->handle($request);
     $this->assertInstanceOf('\\Core\\Response\\Response', $response);
     $this->assertEquals(604, $response->getStatusCode());
     /*
      * Following does not match any route (hence response is a 404)
      */
     $response = $router->handle($request = $this->getRequestMock('/asdasd/2'));
     $this->assertInstanceOf('\\Core\\Response\\Response', $response);
     $this->assertEquals(404, $response->getStatusCode());
 }