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\SeoBundle\Tests\DependencyInjection; |
15
|
|
|
|
16
|
|
|
use Knp\Bundle\MenuBundle\KnpMenuBundle; |
17
|
|
|
use PHPUnit\Framework\TestCase; |
18
|
|
|
use Sonata\BlockBundle\SonataBlockBundle; |
19
|
|
|
use Sonata\SeoBundle\DependencyInjection\SonataSeoExtension; |
20
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @author Vincent Tommasi <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
final class SonataSeoExtensionTest extends TestCase |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* Tests the loading of blocks.xml file. |
29
|
|
|
*/ |
30
|
|
|
public function testBlocksLoading(): void |
31
|
|
|
{ |
32
|
|
|
$container = new ContainerBuilder(); |
33
|
|
|
$container->setParameter('kernel.bundles', [ |
34
|
|
|
'SonataBlockBundle' => SonataBlockBundle::class, |
35
|
|
|
'KnpMenuBundle' => KnpMenuBundle::class, |
36
|
|
|
]); |
37
|
|
|
|
38
|
|
|
$extension = new SonataSeoExtension(); |
39
|
|
|
$extension->load([[]], $container); |
40
|
|
|
|
41
|
|
|
$this->assertTrue($container->hasDefinition('sonata.seo.block.breadcrumb.homepage')); |
42
|
|
|
|
43
|
|
|
$container = new ContainerBuilder(); |
44
|
|
|
$container->setParameter('kernel.bundles', []); |
45
|
|
|
$extension->load([[]], $container); |
46
|
|
|
|
47
|
|
|
$this->assertFalse($container->hasDefinition('sonata.seo.block.breadcrumb.homepage')); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|