Completed
Branch master (cca27c)
by Yonel Ceruto
02:51
created

BreadcrumbsExtensionTest::testLoadTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 7
rs 9.4286
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the BreadcrumbsBundle.
5
 *
6
 * (c) Yonel Ceruto <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Yceruto\Bundle\BreadcrumbsBundle\Tests\DependencyInjection;
13
14
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Yceruto\Bundle\BreadcrumbsBundle\DependencyInjection\BreadcrumbsExtension;
17
18
class BreadcrumbsExtensionTest extends TestCase
19
{
20
    /**
21
     * @var ContainerBuilder
22
     */
23
    private $container;
24
25
    /**
26
     * @var BreadcrumbsExtension
27
     */
28
    private $extension;
29
30
    public function setUp()
31
    {
32
        $this->container = new ContainerBuilder();
33
        $this->container->setParameter('kernel.debug', false);
34
        $this->extension = new BreadcrumbsExtension();
35
    }
36
37
    /**
38
     * @dataProvider getData
39
     */
40
    public function testLoadTemplate($rootDir, $templatePath)
41
    {
42
        $this->container->getParameterBag()->add(array('kernel.root_dir' => $rootDir));
43
        $this->extension->load(array(), $this->container);
44
        $this->assertTrue($this->container->has('breadcrumbs_builder'));
45
        $this->assertEquals($templatePath, $this->container->getParameter('breadcrumbs_template'));
46
    }
47
48
    /**
49
     * Get data provider
50
     *
51
     * @return array
52
     */
53
    public function getData()
54
    {
55
        return array(
56
            array(__DIR__, '@Breadcrumbs/breadcrumbs/breadcrumbs.html.twig'),
57
            array(__DIR__.'/Fixtures', 'breadcrumbs/breadcrumbs.html.twig'),
58
        );
59
    }
60
}
61