Beispiel #1
0
 public function testUriIsReturnedIntoUnless()
 {
     $uriIsSame = false;
     $definedUri = $this->uri;
     $result = $this->firewall->route('/\\/managers\\/index.php/')->unless(function ($uri) use(&$uriIsSame, $definedUri) {
         $uriIsSame = $definedUri === $uri;
     })->handle(function () {
     })->execute();
     $this->assertTrue($uriIsSame);
 }
Beispiel #2
0
 /**
  * @param callable $fn
  */
 public function handle(closure $fn)
 {
     $firewall = new Firewall($this->requestUri);
     foreach ($this->routes as $route) {
         $firewall->route($route);
     }
     foreach ($this->conditions as $condition) {
         $firewall->unless($condition);
     }
     $this->collection[] = $firewall->handle($fn);
     $this->routes = array();
     $this->conditions = array();
 }