Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'add-colon-console-route' of github.com:ThomasCantonnet/…
Browse files Browse the repository at this point in the history
…zf2 into ThomasCantonnet-add-colon-console-route
  • Loading branch information
mwillbanks committed Aug 6, 2014
2 parents cdbcf0b + 09b1e5f commit d027367
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/Zend/Console/RouteMatcher/DefaultRouteMatcher.php
Expand Up @@ -136,7 +136,7 @@ protected function parseDefinition($def)
* Optional literal param, i.e.
* [something]
*/
elseif (preg_match('/\G\[ *?(?P<name>[a-zA-Z][a-zA-Z0-9\_\-]*?) *?\](?: +|$)/s', $def, $m, 0, $pos)) {
elseif (preg_match('/\G\[ *?(?P<name>[a-zA-Z][a-zA-Z0-9\_\-\:]*?) *?\](?: +|$)/s', $def, $m, 0, $pos)) {
$item = array(
'name' => $m['name'],
'literal' => true,
Expand Down Expand Up @@ -175,7 +175,7 @@ protected function parseDefinition($def)
* Mandatory literal param, i.e.
* something
*/
elseif (preg_match('/\G(?P<name>[a-zA-Z][a-zA-Z0-9\_\-]*?)(?: +|$)/s', $def, $m, 0, $pos)) {
elseif (preg_match('/\G(?P<name>[a-zA-Z][a-zA-Z0-9\_\-\:]*?)(?: +|$)/s', $def, $m, 0, $pos)) {
$item = array(
'name' => $m['name'],
'literal' => true,
Expand Down
25 changes: 25 additions & 0 deletions tests/ZendTest/Console/RouteMatcher/DefaultRouteMatcherTest.php
Expand Up @@ -321,11 +321,26 @@ public static function routeProvider()
array('fooo'),
null
),
'mandatory-literal-colon-match' => array(
'foo:bar',
array('foo:bar'),
array('foo:bar' => null)
),
'mandatory-literal-colon-match-2' => array(
'foo:bar baz',
array('foo:bar', 'baz'),
array('foo:bar' => null, 'baz' => null)
),
'mandatory-literal-order' => array(
'foo bar',
array('bar','foo'),
null
),
'mandatory-literal-order-colon' => array(
'foo bar baz:inga',
array('bar','foo', 'baz:inga'),
null
),
'mandatory-literal-partial-mismatch' => array(
'foo bar baz',
array('foo','bar'),
Expand Down Expand Up @@ -373,11 +388,21 @@ public static function routeProvider()
array('foo','bar'),
array('foo' => null, 'bar' => true, 'baz' => null)
),
'optional-literal-colon-match' => array(
'foo [bar] [baz:inga]',
array('foo','bar'),
array('foo' => null, 'bar' => true, 'baz:inga' => null)
),
'optional-literal-mismatch' => array(
'foo [bar] [baz]',
array('baz','bar'),
null
),
'optional-literal-colon-mismatch' => array(
'foo [bar] [baz:inga]',
array('baz:inga','bar'),
null
),
'optional-literal-shuffled-mismatch' => array(
'foo [bar] [baz]',
array('foo','baz','bar'),
Expand Down

0 comments on commit d027367

Please sign in to comment.