test: add pretty url
This commit is contained in:
parent
ebfe5b34a2
commit
7e951c1d7e
1 changed files with 37 additions and 0 deletions
37
tests/PrettyUrlTest.php
Normal file
37
tests/PrettyUrlTest.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace wishthis\Tests\Api;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use wishthis\URL;
|
||||
|
||||
final class PrettyUrlTest extends TestCase
|
||||
{
|
||||
public function testPrettyUrl(): void
|
||||
{
|
||||
\define('ROOT', \dirname(__DIR__));
|
||||
|
||||
$requestUris = array(
|
||||
'//api/database-test',
|
||||
'/api/database-test',
|
||||
'api/database-test',
|
||||
'http://wishthis.online.localhost/index.php/api/database-test',
|
||||
'http://wishthis.online.localhost/index.php//api/database-test',
|
||||
);
|
||||
|
||||
require __DIR__ . '/../src/classes/wishthis/URL.php';
|
||||
|
||||
$expected_GET = array(
|
||||
'page' => 'api',
|
||||
'module' => 'database-test',
|
||||
);
|
||||
|
||||
foreach ($requestUris as $requestUri) {
|
||||
$url = new URL($requestUri);
|
||||
|
||||
$this->assertSame($expected_GET, $_GET, $requestUri);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue