[FEATURE] Added support for class hinting on routes as requested by #491

This commit is contained in:
Simon Sessingø
2021-03-21 05:55:18 +01:00
parent e78040aabd
commit 21d180ebc9
9 changed files with 69 additions and 35 deletions
@@ -199,4 +199,15 @@ class RouterRouteTest extends \PHPUnit\Framework\TestCase
$this->assertEquals('custom-regex', $output);
}
public function testClassHint()
{
TestRouter::get('/my/test/url', ['DummyController', 'method1']);
TestRouter::all('/my/test/url', ['DummyController', 'method1']);
TestRouter::match(['put', 'get', 'post'], '/my/test/url', ['DummyController', 'method1']);
TestRouter::debug('/my/test/url', 'get');
$this->assertTrue(true);
}
}
+2 -2
View File
@@ -78,8 +78,8 @@ class RouterUrlTest extends \PHPUnit\Framework\TestCase
public function testSimilarUrls()
{
// Match normal route on alias
TestRouter::resource('/url11', 'DummyController@method1');
TestRouter::resource('/url1', 'DummyController@method1', ['as' => 'match']);
TestRouter::get('/url11', 'DummyController@method1');
TestRouter::resource('/url1', 'ResourceController', ['as' => 'match']);
TestRouter::debugNoReset('/url1', 'get');