Fixes and development

- `$parameter` argument in `findUrl` method now supports both string,
array and null value to avoid confusion.

- Using return value in callbacks now displays value (issue: #257)
This commit is contained in:
Simon Sessingø
2017-08-13 03:06:27 +01:00
parent 6aa38cfa4c
commit 74187ee326
5 changed files with 23 additions and 14 deletions
+6
View File
@@ -12,6 +12,9 @@ class RouterUrlTest extends PHPUnit_Framework_TestCase
{
TestRouter::get('/', 'DummyController@method1');
TestRouter::get('/page/{id?}', 'DummyController@method1');
TestRouter::get('/test-output', function() {
return 'return value';
});
TestRouter::debugNoReset('/page/22', 'get');
$this->assertEquals('/page/{id?}/', TestRouter::router()->getRequest()->getLoadedRoute()->getUrl());
@@ -19,6 +22,9 @@ class RouterUrlTest extends PHPUnit_Framework_TestCase
TestRouter::debugNoReset('/', 'get');
$this->assertEquals('/', TestRouter::router()->getRequest()->getLoadedRoute()->getUrl());
$output = TestRouter::debugOutput('/test-output', 'get');
$this->assertEquals('return value', $output);
TestRouter::router()->reset();
}