Development

- Fixed where method calling itself instead of setWhere.
- Added unit-tests for regex.
This commit is contained in:
Simon Sessingø
2017-01-19 18:40:47 +01:00
parent 7cc2652bcd
commit 523d49359b
2 changed files with 13 additions and 1 deletions

View File

@@ -402,7 +402,7 @@ abstract class Route implements IRoute
*/
public function where(array $options)
{
return $this->where($options);
return $this->setWhere($options);
}
/**

View File

@@ -99,4 +99,16 @@ class RouterUrlTest extends PHPUnit_Framework_TestCase
}
public function testRegEx()
{
SimpleRouter::router()->reset();
SimpleRouter::request()->setMethod('get');
SimpleRouter::request()->setUri('/my/custom-path');
SimpleRouter::get('/my/{path}', 'DummyController@start')->where(['path' => '[a-zA-Z\-]+']);
SimpleRouter::start();
}
}