Passed
Push — master ( 802754...f898ad )
by WEBEWEB
07:59 queued 25s
created

HighchartsExtensionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 1
1
<?php
2
3
/**
4
 * This file is part of the highcharts-bundle package.
5
 *
6
 * (c) 2017 WEBEWEB
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 WBW\Bundle\HighchartsBundle\Tests\DependencyInjection;
13
14
use PHPUnit_Framework_TestCase;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
17
use Symfony\Component\HttpKernel\KernelInterface;
18
use Symfony\Component\Translation\TranslatorInterface;
19
use WBW\Bundle\HighchartsBundle\DependencyInjection\HighchartsExtension;
20
use WBW\Bundle\HighchartsBundle\Provider\HighchartsLangProvider;
21
use WBW\Bundle\HighchartsBundle\Twig\Extension\HighchartsTwigExtension;
22
23
/**
24
 * Highcharts extension test.
25
 *
26
 * @author webeweb <https://github.com/webeweb/>
27
 * @package WBW\Bundle\HighchartsBundle\Tests\DependencyInjection
28
 * @final
29
 */
30
final class HighchartsExtensionTest extends PHPUnit_Framework_TestCase {
31
32
    /**
33
     * Tests the load() method.
34
     *
35
     * @return void
36
     */
37
    public function testLoad() {
38
39
        // Set the mocks.
40
        $kernel     = $this->getMockBuilder(KernelInterface::class)->getMock();
41
        $translator = $this->getMockBuilder(TranslatorInterface::class)->getMock();
42
43
        // We set a container builder with only the necessary.
44
        $container = new ContainerBuilder(new ParameterBag(["kernel.environment" => "dev"]));
45
        $container->set("kernel", $kernel);
46
        $container->set("translator", $translator);
47
48
        $obj = new HighchartsExtension();
49
50
        $obj->load([], $container);
51
        $this->assertInstanceOf(HighchartsTwigExtension::class, $container->get(HighchartsTwigExtension::SERVICE_NAME));
52
        $this->assertInstanceOf(HighchartsLangProvider::class, $container->get(HighchartsLangProvider::SERVICE_NAME));
53
    }
54
55
}
56