Ejemplo n.º 1
0
 public function testRouteMiddlwareArguments()
 {
     $this->expectOutputString('foobar');
     Slim_Environment::mock(array('SCRIPT_NAME' => '', 'PATH_INFO' => '/foo'));
     $env = Slim_Environment::getInstance();
     $req = new Slim_Http_Request($env);
     $router = new Slim_Router();
     $router->setResourceUri($req->getResourceUri());
     $route = new Slim_Route('/foo', function () {
         echo "bar";
     });
     $route->setName('foo');
     $route->setMiddleware(function ($route) {
         echo $route->getName();
     });
     $route->matches($req->getResourceUri());
     //<-- Extracts params from resource URI
     $router->dispatch($route);
 }