Exemple #1
0
 /**
  * @param $pathInfo
  * @return RouteInfo
  * @throws \Huruk\Exception\PageNotFoundException
  */
 public function matchUrl($pathInfo)
 {
     try {
         $routeParams = $this->getRouter()->match($pathInfo);
         $routeInfo = new RouteInfo($routeParams);
     } catch (\Exception $e) {
         Huruk::trigger(self::EVENT_ROUTE_DONT_MATCH, new Event(array($pathInfo)));
         throw new PageNotFoundException('Resource not found!!');
     }
     return $routeInfo;
 }
 public function testStaticPost()
 {
     $closure = function () {
         $response = new Responder('One->Two');
         $response->disableSendHeaders();
         return $response;
     };
     $request = Request::create('http://example.com/post_route', 'POST');
     ob_start();
     Huruk::post('/post_route', $closure);
     Huruk::run($request);
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertContains('One->Two', $output);
 }
Exemple #3
0
 /**
  * @param RouteInfo $routeInfo
  */
 private function triggerPostActionEvent(RouteInfo $routeInfo)
 {
     Huruk::trigger(self::EVENT_POSTACTION, new Event(array('routeInfo' => $routeInfo)));
 }