mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-16 10:40:18 +03:00
- Fixed: `RouteController` not matching certain urls. - Made `RouteResource` more strict in url-matching. - Added PHPUnit `RouterControllerTest` class. - Fixed merged `testSimularUrls` method in `RouterUrlTest`.
42 lines
938 B
PHP
42 lines
938 B
PHP
<?php
|
|
|
|
require_once 'Dummy/DummyController.php';
|
|
require_once 'Helpers/TestRouter.php';
|
|
|
|
class RouterControllerTest extends PHPUnit_Framework_TestCase
|
|
{
|
|
|
|
public function testGet()
|
|
{
|
|
// Match normal route on alias
|
|
TestRouter::controller('/url', 'DummyController');
|
|
|
|
$response = TestRouter::debugOutput('/url/test', 'get');
|
|
|
|
$this->assertEquals('getTest', $response);
|
|
|
|
}
|
|
|
|
public function testPost()
|
|
{
|
|
// Match normal route on alias
|
|
TestRouter::controller('/url', 'DummyController');
|
|
|
|
$response = TestRouter::debugOutput('/url/test', 'post');
|
|
|
|
$this->assertEquals('postTest', $response);
|
|
|
|
}
|
|
|
|
public function testPut()
|
|
{
|
|
// Match normal route on alias
|
|
TestRouter::controller('/url', 'DummyController');
|
|
|
|
$response = TestRouter::debugOutput('/url/test', 'put');
|
|
|
|
$this->assertEquals('putTest', $response);
|
|
|
|
}
|
|
|
|
} |