Completed
Pull Request — master (#456)
by Vincent
12:26
created

RoutingTest::getKernelClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\NotificationBundle\Tests\Functional\Routing;
15
16
use Sonata\NotificationBundle\Tests\App\AppKernel;
17
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
18
19
/**
20
 * @author Javier Spagnoletti <[email protected]>
21
 */
22
final class RoutingTest extends WebTestCase
23
{
24
    /**
25
     * @group legacy
26
     *
27
     * @dataProvider getRoutes
28
     */
29
    public function testRoutes(string $name, string $path, array $methods): void
30
    {
31
        $client = static::createClient();
32
        $router = $client->getContainer()->get('router');
33
34
        $route = $router->getRouteCollection()->get($name);
35
36
        $this->assertNotNull($route);
37
        $this->assertSame($path, $route->getPath());
38
        $this->assertEmpty(array_diff($methods, $route->getMethods()));
39
    }
40
41
    public function getRoutes(): iterable
42
    {
43
        yield ['nelmio_api_doc_index', '/api/doc/{view}', ['GET']];
44
        yield ['sonata_api_notification_message_get_messages', '/api/notification/messages.{_format}', ['GET']];
45
        yield ['sonata_api_notification_message_post_message', '/api/notification/messages.{_format}', ['POST']];
46
    }
47
48
    protected static function getKernelClass(): string
49
    {
50
        return AppKernel::class;
51
    }
52
}
53