Completed
Pull Request — master (#49)
by Maximilian
248:35 queued 183:27
created

IvoryCKEditorBundleTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 49
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Ivory CKEditor package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\CKEditorBundle\Tests;
13
14
use Ivory\CKEditorBundle\DependencyInjection\Compiler\ResourceCompilerPass;
15
use Ivory\CKEditorBundle\DependencyInjection\Compiler\TemplatingCompilerPass;
16
use Ivory\CKEditorBundle\IvoryCKEditorBundle;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\HttpKernel\Bundle\Bundle;
19
20
/**
21
 * @author GeLo <[email protected]>
22
 * @author Adam Misiorny <[email protected]>
23
 */
24
class IvoryCKEditorBundleTest extends AbstractTestCase
25
{
26
    /**
27
     * @var IvoryCKEditorBundle
28
     */
29
    private $bundle;
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function setUp()
35
    {
36
        $this->bundle = new IvoryCKEditorBundle();
37
    }
38
39
    public function testBundle()
40
    {
41
        $this->assertInstanceOf(Bundle::class, $this->bundle);
42
    }
43
44
    public function testCompilerPasses()
45
    {
46
        $containerBuilder = $this->createContainerBuilderMock();
47
        $containerBuilder
48
            ->expects($this->at(0))
49
            ->method('addCompilerPass')
50
            ->with($this->isInstanceOf(ResourceCompilerPass::class))
51
            ->will($this->returnSelf());
52
53
        $containerBuilder
54
            ->expects($this->at(1))
55
            ->method('addCompilerPass')
56
            ->with($this->isInstanceOf(TemplatingCompilerPass::class))
57
            ->will($this->returnSelf());
58
59
        $this->bundle->build($containerBuilder);
60
    }
61
62
    /**
63
     * @return ContainerBuilder|\PHPUnit_Framework_MockObject_MockObject
64
     */
65
    private function createContainerBuilderMock()
66
    {
67
        return $this->getMockBuilder(ContainerBuilder::class)
68
            ->disableOriginalConstructor()
69
            ->setMethods(['addCompilerPass'])
70
            ->getMock();
71
    }
72
}
73