[BUGFIX] Fixed group not matching domain with no parameters (issue: #468).

- Added unit-tests
This commit is contained in:
Simon Sessingø
2021-03-26 01:32:01 +01:00
parent 39ee1bb7cd
commit 073479f9dd
2 changed files with 42 additions and 3 deletions

View File

@@ -107,6 +107,42 @@ class RouterRouteTest extends \PHPUnit\Framework\TestCase
$this->assertEquals('it, system', $response);
}
public function testFixedDomain()
{
$result = false;
TestRouter::request()->setHost('admin.world.com');
TestRouter::group(['domain' => 'admin.world.com'], function () use (&$result) {
TestRouter::get('/test', function ($subdomain = null) use (&$result) {
$result = true;
});
});
TestRouter::debug('/test', 'get');
$this->assertTrue($result);
}
public function testFixedNotAllowedDomain()
{
$result = false;
TestRouter::request()->setHost('other.world.com');
TestRouter::group(['domain' => 'admin.world.com'], function () use (&$result) {
TestRouter::get('/', function ($subdomain = null) use (&$result) {
$result = true;
});
});
try {
TestRouter::debug('/', 'get');
} catch(\Exception $e) {
}
$this->assertFalse($result);
}
public function testDomainAllowedRoute()
{
$result = false;