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

Issue #3358 - Fix for console router not accepting controller word as part of a route #4182

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 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'));
}
} }