mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
Development
- Fixed DebugHandler::fireEvent not providing correct arguments when calling fireEvents. - Fixed custom regex setMatch not setting parsed parameters correctly (issue: #566). - Added unit-tests for catching issue in the future. - Added php-stan typehints.
This commit is contained in:
@@ -181,6 +181,22 @@ class RouterUrlTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$output = TestRouter::debugOutput('/admin/asd/bec/123', 'get');
|
||||
$this->assertEquals('match', $output);
|
||||
|
||||
TestRouter::router()->reset();
|
||||
}
|
||||
|
||||
public function testCustomRegexWithParameter()
|
||||
{
|
||||
TestRouter::request()->setHost('google.com');
|
||||
|
||||
$results = '';
|
||||
|
||||
TestRouter::get('/tester/{param}', function ($param = null) use($results) {
|
||||
return $results = $param;
|
||||
})->setMatch('/(.*)/i');
|
||||
|
||||
$output = TestRouter::debugOutput('/tester/abepik/ko');
|
||||
$this->assertEquals('/tester/abepik/ko/', $output);
|
||||
}
|
||||
|
||||
public function testRenderMultipleRoutesDisabled()
|
||||
|
||||
@@ -8,7 +8,7 @@ class TestRouter extends \Pecee\SimpleRouter\SimpleRouter
|
||||
static::request()->setHost('testhost.com');
|
||||
}
|
||||
|
||||
public static function debugNoReset($testUrl, $testMethod = 'get')
|
||||
public static function debugNoReset(string $testUrl, string $testMethod = 'get'): void
|
||||
{
|
||||
$request = static::request();
|
||||
|
||||
@@ -18,7 +18,7 @@ class TestRouter extends \Pecee\SimpleRouter\SimpleRouter
|
||||
static::start();
|
||||
}
|
||||
|
||||
public static function debug($testUrl, $testMethod = 'get', bool $reset = true)
|
||||
public static function debug(string $testUrl, string $testMethod = 'get', bool $reset = true): void
|
||||
{
|
||||
try {
|
||||
static::debugNoReset($testUrl, $testMethod);
|
||||
@@ -35,7 +35,7 @@ class TestRouter extends \Pecee\SimpleRouter\SimpleRouter
|
||||
|
||||
}
|
||||
|
||||
public static function debugOutput($testUrl, $testMethod = 'get', bool $reset = true)
|
||||
public static function debugOutput(string $testUrl, string $testMethod = 'get', bool $reset = true): string
|
||||
{
|
||||
$response = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user