コード例 #1
0
 /**
  * Tests the Joomla\Router\Router::getController method.
  *
  * @return  void
  *
  * @covers  Joomla\Router\Router::getController
  * @since   1.0
  */
 public function testGetController()
 {
     $this->instance->setControllerPrefix('\\Joomla\\Router\\Tests\\Stubs\\')->addMap('articles/:article_id', 'GooGet');
     $controller = $this->instance->getController('articles/3');
     $this->assertInstanceOf('\\Joomla\\Router\\Tests\\Stubs\\GooGet', $controller);
     $input = $controller->getInput();
     $this->assertEquals('3', $input->get('article_id'));
 }
コード例 #2
0
 /**
  * Find and execute the appropriate controller based on a given route.
  *
  * @param   string  $route  The route string for which to find and execute a controller.
  *
  * @return  AbstractTrackerController
  *
  * @since   1.0
  * @throws  RoutingException
  */
 public function getController($route)
 {
     try {
         return parent::getController($route);
     } catch (\InvalidArgumentException $e) {
         // 404
         throw new RoutingException($e->getMessage());
     } catch (\RuntimeException $e) {
         // 404
         throw new RoutingException($e->getMessage());
     }
 }