Skip to content
Snippets Groups Projects
Commit 888e7c25 authored by Demian Katz's avatar Demian Katz
Browse files

Added param default; removed unreachable code; expanded tests.

parent 9214ff7f
Branches
Tags
No related merge requests found
......@@ -125,7 +125,7 @@ class Router
*
* @return array
*/
public function getRouteDetails($driver, $routeSuffix,
public function getRouteDetails($driver, $routeSuffix = '',
$extraParams = array()
) {
// Extract source and ID from driver or string:
......@@ -146,9 +146,6 @@ class Router
// Build URL parameters:
$params = $extraParams;
$params['id'] = $id;
if (!empty($action)) {
$params['action'] = $action;
}
// Determine route based on naming convention (default VuFind route is
// the exception to the rule):
......
......@@ -56,7 +56,36 @@ class RouterTest extends TestCase
$router = $this->getRouter($driver);
$this->assertEquals(
array('params' => array('id' => 'test'), 'route' => 'record'),
$router->getRouteDetails($driver, '')
$router->getRouteDetails($driver)
);
}
/**
* Test routing with driver object.
*
* @return void
*/
public function testRoutingWithString()
{
$router = $this->getRouter();
$this->assertEquals(
array('params' => array('id' => 'test'), 'route' => 'summonrecord'),
$router->getRouteDetails('Summon|test')
);
}
/**
* Test action routing with driver object.
*
* @return void
*/
public function testActionRoutingWithDriver()
{
$driver = $this->getDriver();
$router = $this->getRouter($driver);
$this->assertEquals(
array('params' => array('id' => 'test'), 'route' => 'record-sms'),
$router->getActionRouteDetails($driver, 'SMS')
);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment