Skip to content
Browse files

Merge branch 'feature/remove-request-from-route-callback-args' into d…

…evelop
  • Loading branch information...
2 parents 63bbd09 + 33cc480 commit 0b766e5df27fc5a6a7da09e94c96c4c92ad2b348 @trq trq committed Feb 5, 2013
Showing with 3 additions and 4 deletions.
  1. +0 −1 lib/Proem/Routing/RouteManager.php
  2. +3 −3 lib/Proem/Routing/Tests/RouteManagerTest.php
View
1 lib/Proem/Routing/RouteManager.php
@@ -189,7 +189,6 @@ public function route()
if ($route->process($this->request) !== false) {
if ($route->hasCallback()) {
$arguments = $route->getPayload();
- array_unshift($arguments, $this->request);
return call_user_func_array($route->getCallback(), $arguments);
} else {
return $route;
View
6 lib/Proem/Routing/Tests/RouteManagerTest.php
@@ -436,7 +436,7 @@ public function testCallbackGetsRequest()
{
$request = \Proem\Http\Request::create('/foo');
$result = (new RouteManager($request))
- ->attach('r1', new \Proem\Routing\Route('/foo', [], function($req) { return $req; }))
+ ->attach('r1', new \Proem\Routing\Route('/foo', [], function() use($request) { return $request; }))
->route();
$this->assertInstanceOf('\Proem\Http\Request', $result);
@@ -446,7 +446,7 @@ public function testCallbackGetsNamedArgs()
{
$request = \Proem\Http\Request::create('/view/trq');
list($action, $username) = (new RouteManager($request))
- ->attach('r1', new \Proem\Routing\Route('/{action}/{username}', [], function($req, $a, $u) { return [$a, $u]; }))
+ ->attach('r1', new \Proem\Routing\Route('/{action}/{username}', [], function($a, $u) { return [$a, $u]; }))
->route();
$this->assertEquals('view', $action);
@@ -463,7 +463,7 @@ public function testCallbackGetsArgsOfType()
'action' => '{alpha}',
'id' => '{int}'
]],
- function($req, $action, $id) {
+ function($action, $id) {
return [$action, $id];
}
))

0 comments on commit 0b766e5

Please sign in to comment.
Something went wrong with that request. Please try again.