Skip to content

Commit

Permalink
Unit test for commit 3e8d536
Browse files Browse the repository at this point in the history
  • Loading branch information
nickl- committed Jun 22, 2012
1 parent 17972e8 commit 4d25277
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/library/Respect/Rest/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,22 @@ function test_single_last_param2()
$r->dispatch('get', '/documents/foo/bar')->response();
$this->assertEquals(array(array('foo', 'bar')), $args);
}
/**
* Unit test for Commit: 3e8d536
*
* Catchall route called with / only would not get passed a parameter
* to the callback function.
*/
function test_catchall_on_root_call_should_get_callback_parameter()
{
$r = new Router();
$args = array();
$r->any('/**', function($documentsPath) use (&$args) {
$args = func_get_args();
});
$r->dispatch('get', '/')->response();
$this->assertTrue(\is_array($args[0]));
}

/**
* @ticket 46
Expand Down Expand Up @@ -522,7 +538,7 @@ function test_optional_parameters_should_be_allowed_only_at_the_end_of_the_path(
}

function test_route_ordering_with_when()
{
{

$when = false;
$r = new Router();
Expand Down Expand Up @@ -555,7 +571,7 @@ function test_when_should_be_called_only_on_existent_methods()
$router->isAutoDispatched = false;

$r1 = $router->any('/meow/*', __NAMESPACE__.'\\RouteKnowsGet');
$r1->accept(array('application/json' => 'json_encode')); // some routine inheriting from AbstractAccept
$r1->accept(array('application/json' => 'json_encode')); // some routine inheriting from AbstractAccept

$router->any('/moo/*', __NAMESPACE__.'\\RouteKnowsNothing');

Expand Down

0 comments on commit 4d25277

Please sign in to comment.