| @@ 36-65 (lines=30) @@ | ||
| 33 | $this->compilerPass = new ResourceCompilerPass(); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function testTwigResource() |
|
| 37 | { |
|
| 38 | $containerBuilder = $this->createContainerBuilderMock(); |
|
| 39 | $containerBuilder |
|
| 40 | ->expects($this->exactly(2)) |
|
| 41 | ->method('hasParameter') |
|
| 42 | ->will($this->returnValueMap([ |
|
| 43 | ['templating.helper.form.resources', false], |
|
| 44 | [$parameter = 'twig.form.resources', true], |
|
| 45 | ])); |
|
| 46 | ||
| 47 | $containerBuilder |
|
| 48 | ->expects($this->once()) |
|
| 49 | ->method('getParameter') |
|
| 50 | ->with($this->identicalTo($parameter)) |
|
| 51 | ->will($this->returnValue([$template = 'layout.html.twig'])); |
|
| 52 | ||
| 53 | $containerBuilder |
|
| 54 | ->expects($this->once()) |
|
| 55 | ->method('setParameter') |
|
| 56 | ->with( |
|
| 57 | $this->identicalTo($parameter), |
|
| 58 | $this->identicalTo([ |
|
| 59 | '@FOSCKEditor/Form/ckeditor_widget.html.twig', |
|
| 60 | $template, |
|
| 61 | ]) |
|
| 62 | ); |
|
| 63 | ||
| 64 | $this->compilerPass->process($containerBuilder); |
|
| 65 | } |
|
| 66 | ||
| 67 | public function testPhpResource() |
|
| 68 | { |
|
| @@ 67-93 (lines=27) @@ | ||
| 64 | $this->compilerPass->process($containerBuilder); |
|
| 65 | } |
|
| 66 | ||
| 67 | public function testPhpResource() |
|
| 68 | { |
|
| 69 | $containerBuilder = $this->createContainerBuilderMock(); |
|
| 70 | $containerBuilder |
|
| 71 | ->expects($this->exactly(2)) |
|
| 72 | ->method('hasParameter') |
|
| 73 | ->will($this->returnValueMap([ |
|
| 74 | [$parameter = 'templating.helper.form.resources', true], |
|
| 75 | ['twig.form.resources', false], |
|
| 76 | ])); |
|
| 77 | ||
| 78 | $containerBuilder |
|
| 79 | ->expects($this->once()) |
|
| 80 | ->method('getParameter') |
|
| 81 | ->with($this->identicalTo($parameter)) |
|
| 82 | ->will($this->returnValue([$template = 'layout.html.php'])); |
|
| 83 | ||
| 84 | $containerBuilder |
|
| 85 | ->expects($this->once()) |
|
| 86 | ->method('setParameter') |
|
| 87 | ->with( |
|
| 88 | $this->identicalTo($parameter), |
|
| 89 | $this->identicalTo(['FOSCKEditorBundle:Form', $template]) |
|
| 90 | ); |
|
| 91 | ||
| 92 | $this->compilerPass->process($containerBuilder); |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * @return ContainerBuilder|\PHPUnit_Framework_MockObject_MockObject |
|