|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace spec\EzSystems\PlatformHttpCacheBundle\DependencyInjection\Compiler; |
| 4 | + |
| 5 | +use EzSystems\PlatformHttpCacheBundle\DependencyInjection\Compiler\KernelPass; |
| 6 | +use PhpSpec\ObjectBehavior; |
| 7 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 8 | +use Symfony\Component\DependencyInjection\Definition; |
| 9 | + |
| 10 | +class KernelPassSpec extends ObjectBehavior |
| 11 | +{ |
| 12 | + function let(ContainerBuilder $container) |
| 13 | + { |
| 14 | + $container->getDefinitions()->willReturn([]); |
| 15 | + $container->getAlias('ezpublish.http_cache.purge_client')->willReturn('some_random_id'); |
| 16 | + } |
| 17 | + |
| 18 | + function it_is_initializable() |
| 19 | + { |
| 20 | + $this->shouldHaveType(KernelPass::class); |
| 21 | + } |
| 22 | + |
| 23 | + function it_disables_the_kernels_httpcache_slots(ContainerBuilder $container) |
| 24 | + { |
| 25 | + $container->getDefinitions()->willReturn([ |
| 26 | + 'ezpublish.http_cache.witness_service' => new Definition(), |
| 27 | + 'ezpublish.http_cache.signalslot.some_slot' => new Definition(), |
| 28 | + 'ezpublish.http_cache.signalslot.some_other_slot' => new Definition(), |
| 29 | + 'witness_service' => new Definition(), |
| 30 | + ]); |
| 31 | + $container->removeDefinition('ezpublish.http_cache.signalslot.some_slot')->shouldBeCalled(); |
| 32 | + $container->removeDefinition('ezpublish.http_cache.signalslot.some_other_slot')->shouldBeCalled(); |
| 33 | + |
| 34 | + $this->process($container); |
| 35 | + } |
| 36 | + |
| 37 | + function it_disables_the_kernels_smartcache_event_listeners(ContainerBuilder $container) |
| 38 | + { |
| 39 | + $container->getDefinitions()->willReturn([ |
| 40 | + 'ezpublish.cache_clear.content.some_listener' => new Definition(), |
| 41 | + 'witness_service' => new Definition(), |
| 42 | + ]); |
| 43 | + $container->removeDefinition('ezpublish.cache_clear.content.some_listener')->shouldBeCalled(); |
| 44 | + |
| 45 | + $this->process($container); |
| 46 | + } |
| 47 | + |
| 48 | + function it_disables_the_kernels_view_cache_response_listener(ContainerBuilder $container) |
| 49 | + { |
| 50 | + $container->getDefinitions()->willReturn([ |
| 51 | + 'ezpublish.view.cache_response_listener' => new Definition(), |
| 52 | + 'witness_service' => new Definition(), |
| 53 | + ]); |
| 54 | + $container->removeDefinition('ezpublish.view.cache_response_listener')->shouldBeCalled(); |
| 55 | + |
| 56 | + $this->process($container); |
| 57 | + } |
| 58 | +} |
0 commit comments