|
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
|
|
|
|