8000 test: Add routing tests (#45) · SymfonyTest/symfony-bundle-test@9bffe3a · GitHub
[go: up one dir, main page]

Skip to content

Commit 9bffe3a

Browse files
authored
test: Add routing tests (#45)
* test: Add routing tests * test: Remove empty line from routes.yml * cut: Remove version checks
1 parent 8e8be14 commit 9bffe3a

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
app_home:
2+
path: /
3+
4+
app_blog:
5+
path: /blog
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Nyholm\BundleTest\Tests\Functional;
4+
5+
use Nyholm\BundleTest\BaseBundleTestCase;
6+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
7+
use Symfony\Component\Routing\RouterInterface;
8+
9+
class BundleRoutingTest extends BaseBundleTestCase
10+
{
11+
public function testSetRoutingFile()
12+
{
13+
$this->setRoutingFile(__DIR__.'/../Fixtures/Resources/Routing/routes.yml');
14+
15+
$this->bootKernel();
16+
$container = $this->getContainer();
17+
$container = $container->get('test.service_container');
18+
/**
19+
* @var RouterInterface $router
20+
*/
21+
$router = $container->get(RouterInterface::class);
22+
$routeCollection = $router->getRouteCollection();
23+
$routes = $routeCollection->all();
24+
25+
$this->assertCount(2, $routes);
26+
$this->assertNotNull($routeCollection->get('app_home'));
27+
$this->assertNotNull($routeCollection->get('app_blog'));
28+
}
29+
30+
protected function getBundleClass()
31+
{
32+
return FrameworkBundle::class;
33+
}
34+
}

0 commit comments

Comments
 (0)
0