|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Ivory Form Extra 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\FormExtraBundle\Tests; |
|
13
|
|
|
|
|
14
|
|
|
use Ivory\FormExtraBundle\IvoryFormExtraBundle; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Ivory Form Extra bundle test. |
|
18
|
|
|
* |
|
19
|
|
|
* @author GeLo <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class IvoryFormExtraBundleTest extends \PHPUnit_Framework_TestCase |
|
22
|
|
|
{ |
|
23
|
|
|
/** @var \Ivory\FormExtraBundle\IvoryFormExtraBundle */ |
|
24
|
|
|
private $bundle; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritdoc} |
|
28
|
|
|
*/ |
|
29
|
|
|
protected function setUp() |
|
30
|
|
|
{ |
|
31
|
|
|
$this->bundle = new IvoryFormExtraBundle(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* {@inheritdoc} |
|
36
|
|
|
*/ |
|
37
|
|
|
protected function tearDown() |
|
38
|
|
|
{ |
|
39
|
|
|
unset($this->bundle); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function testBundle() |
|
43
|
|
|
{ |
|
44
|
|
|
$this->assertInstanceOf('Symfony\Component\HttpKernel\Bundle\Bundle', $this->bundle); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function testCompilerPasses() |
|
48
|
|
|
{ |
|
49
|
|
|
$containerBuilder = $this->createContainerBuilderMock(); |
|
50
|
|
|
$containerBuilder |
|
51
|
|
|
->expects($this->at(0)) |
|
52
|
|
|
->method('addCompilerPass') |
|
53
|
|
|
->with($this->isInstanceOf('Ivory\FormExtraBundle\DependencyInjection\Compiler\ResourceCompilerPass')) |
|
54
|
|
|
->will($this->returnSelf()); |
|
55
|
|
|
|
|
56
|
|
|
$containerBuilder |
|
57
|
|
|
->expects($this->at(1)) |
|
58
|
|
|
->method('addCompilerPass') |
|
59
|
|
|
->with($this->isInstanceOf('Ivory\FormExtraBundle\DependencyInjection\Compiler\TemplatingCompilerPass')) |
|
60
|
|
|
->will($this->returnSelf()); |
|
61
|
|
|
|
|
62
|
|
|
$this->bundle->build($containerBuilder); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return \Symfony\Component\DependencyInjection\ContainerBuilder|\PHPUnit_Framework_MockObject_MockObject |
|
67
|
|
|
*/ |
|
68
|
|
|
private function createContainerBuilderMock() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') |
|
71
|
|
|
->disableOriginalConstructor() |
|
72
|
|
|
->setMethods(array('addCompilerPass')) |
|
73
|
|
|
->getMock(); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|