Skip to content

Commit

Permalink
tests: add load routes test case
Browse files Browse the repository at this point in the history
  • Loading branch information
siganushka committed Sep 20, 2024
1 parent 93bf77b commit b73ed5b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Routing/LoaderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Siganushka\RegionBundle\Tests\Routing;

use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Routing\AttributeRouteControllerLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\AttributeDirectoryLoader;
use Symfony\Component\Routing\Loader\PhpFileLoader;

class LoaderTest extends TestCase
{
public function testRotues(): void
{
$locator = new FileLocator(__DIR__.'/../../config/');

$resolver = new LoaderResolver([
new PhpFileLoader($locator),
new AttributeDirectoryLoader($locator, new AttributeRouteControllerLoader()),
]);

$loader = new DelegatingLoader($resolver);
$routes = $loader->load('routes.php');

static::assertSame('/regions', $routes->get('siganushka_region_region_getcollection')->getPath());
static::assertSame('/regions/{code}', $routes->get('siganushka_region_region_getitem')->getPath());
}
}

0 comments on commit b73ed5b

Please sign in to comment.