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

Commit

Permalink
Merge branch 'hotfix/4182'
Browse files Browse the repository at this point in the history
Close #4182
  • Loading branch information
weierophinney committed Apr 4, 2013
2 parents 0f7346e + 5d71863 commit 7afa28d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Mvc/Router/Console/Simple.php
Expand Up @@ -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));
}

/**
Expand Down
14 changes: 14 additions & 0 deletions tests/ZendTest/Mvc/Router/Console/SimpleTest.php
Expand Up @@ -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 7afa28d

Please sign in to comment.