. // }}} namespace App\Tests\Core; use App\Core\Router\RouteLoader; use App\Core\Router\Router; use App\Util\GNUsocialTestCase; use ReflectionClass; use Symfony\Component\Routing\Route as SRoute; class RouterTest extends GNUsocialTestCase { public function testRouter() { parent::bootKernel(); $rl = new RouteLoader(); $rl->load('', null); // parameters ignored $rl->connect(id: 'test_route', uri_path: '/test/{id<\d+>}', target: []); $refl = (new ReflectionClass($rl))->getProperty('rc'); $refl->setAccessible(true); $routes = $refl->getValue($rl)->all(); static::assertIsArray($routes); static::assertInstanceOf(SRoute::class, $routes['test_route']); static::assertSame('/test/{id}', $routes['test_route']->getPath()); } public function testURLGen() { parent::bootKernel(); static::assertSame('/attachment/1/thumbnail/big', Router::url('attachment_thumbnail', ['id' => 1, 'size' => 'big'])); } }