Beispiel #1
0
 /**
  * @param string $url
  * @return PHPUnit_Routing_TestCase
  */
 public function get($url)
 {
     $Request = $this->createRequest($url);
     try {
         $this->params = $this->Router->match($Request);
         if ($this->reciprocity) {
             $this->assertEqual($url, $this->Router->urlize($this->params)->path());
         }
     } catch (NoMatchingRouteException $e) {
         $this->errors = true;
     }
     return $this;
 }
Beispiel #2
0
 public function checkForRoutedRequests(AkRouter &$Router)
 {
     $this->parameters_from_url = $params = $Router->match($this);
     if (!isset($params['controller']) || !$this->isValidControllerName($params['controller'])) {
         throw new NoMatchingRouteException('No route matches "' . $this->getPath() . '" with {:method=>:' . $this->getMethod() . '}');
     }
     if (empty($params['action'])) {
         $params['action'] = 'index';
     }
     if (!$this->isValidActionName($params['action'])) {
         throw new NoMatchingRouteException('No action was specified.');
     }
     if (!empty($params['module'])) {
         if (!$this->isValidModuleName($params['module'])) {
             throw new DispatchException('Invalid module ' . $params['module'] . '.');
         }
     } else {
         unset($this->_request['module']);
     }
     isset($params['module']) ? $this->module = $params['module'] : null;
     $this->controller = $params['controller'];
     $this->action = $params['action'];
     if (isset($params['lang'])) {
         AkLocaleManager::rememberNavigationLanguage($params['lang']);
         Ak::lang($params['lang']);
     }
     $this->_request = array_merge($this->_request, $params);
 }
Beispiel #3
0
 function checkForRoutedRequests(AkRouter &$Router)
 {
     $this->parameters_from_url = $params = $Router->match($this);
     if (!isset($params['controller']) || !$this->isValidControllerName($params['controller'])) {
         throw new DispatchException('No controller was specified.');
     }
     if (!isset($params['action']) || !$this->isValidActionName($params['action'])) {
         throw new DispatchException('No action was specified.');
     }
     if (isset($params['module']) && !$this->isValidModuleName($params['module'])) {
         throw new DispatchException('Invalid module.');
     }
     isset($params['module']) ? $this->module = $params['module'] : null;
     $this->controller = $params['controller'];
     $this->action = $params['action'];
     if (isset($params['lang'])) {
         AkLocaleManager::rememberNavigationLanguage($params['lang']);
         Ak::lang($params['lang']);
     }
     $this->_request = array_merge($this->_request, $params);
 }