Skip to content
Browse files

Fix for console router not accepting controller word as part of a route

  • Loading branch information...
1 parent 0f7346e commit 57a5e26e312e601ec482e8f01551a91ff2e3dd8a @robertboloc committed
Showing with 15 additions and 1 deletion.
  1. +1 −1 library/Zend/Mvc/Router/Console/Simple.php
  2. +14 −0 tests/ZendTest/Mvc/Router/Console/SimpleTest.php
View
2 library/Zend/Mvc/Router/Console/Simple.php
@@ -797,7 +797,7 @@ public function match(Request $request, $pathOffset = null)
return null; // there are extraneous params that were not consumed
}
- return new RouteMatch(array_merge($this->defaults, $matches));
+ return new RouteMatch(array_replace($matches, $this->defaults));
}
/**
View
14 tests/ZendTest/Mvc/Router/Console/SimpleTest.php
@@ -695,4 +695,18 @@ public function testFactory()
)
);
}
+
+ public function testMatchMergeOfTheDefaults()
+ {
+ $defaults = array(
+ 'controller' => 'Controller/Test',
+ );
+
+ $request = new ConsoleRequest(array('scriptname.php', 'foo', 'controller'));
+ $route = new Simple('foo controller', array(), $defaults);
+ $match = $route->match($request);
+
+ $this->assertInstanceOf('Zend\Mvc\Router\Console\RouteMatch', $match);
+ $this->assertEquals($defaults['controller'], $match->getParam('controller'));
+ }
}

0 comments on commit 57a5e26

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