-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ezsystems/ezp26982-fix_kernel_integration
Fix kernel integration
- Loading branch information
Showing
5 changed files
with
110 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace spec\EzSystems\PlatformHttpCacheBundle\DependencyInjection\Compiler; | ||
|
||
use EzSystems\PlatformHttpCacheBundle\DependencyInjection\Compiler\KernelPass; | ||
use PhpSpec\ObjectBehavior; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Definition; | ||
|
||
class KernelPassSpec extends ObjectBehavior | ||
{ | ||
function let(ContainerBuilder $container) | ||
{ | ||
$container->getDefinitions()->willReturn([]); | ||
$container->getAlias('ezpublish.http_cache.purge_client')->willReturn('some_random_id'); | ||
} | ||
|
||
function it_is_initializable() | ||
{ | ||
$this->shouldHaveType(KernelPass::class); | ||
} | ||
|
||
function it_disables_the_kernels_httpcache_slots(ContainerBuilder $container) | ||
{ | ||
$container->getDefinitions()->willReturn([ | ||
'ezpublish.http_cache.witness_service' => new Definition(), | ||
'ezpublish.http_cache.signalslot.some_slot' => new Definition(), | ||
'ezpublish.http_cache.signalslot.some_other_slot' => new Definition(), | ||
'witness_service' => new Definition(), | ||
]); | ||
$container->removeDefinition('ezpublish.http_cache.signalslot.some_slot')->shouldBeCalled(); | ||
$container->removeDefinition('ezpublish.http_cache.signalslot.some_other_slot')->shouldBeCalled(); | ||
|
||
$this->process($container); | ||
} | ||
|
||
function it_disables_the_kernels_smartcache_event_listeners(ContainerBuilder $container) | ||
{ | ||
$container->getDefinitions()->willReturn([ | ||
'ezpublish.cache_clear.content.some_listener' => new Definition(), | ||
'witness_service' => new Definition(), | ||
]); | ||
$container->removeDefinition('ezpublish.cache_clear.content.some_listener')->shouldBeCalled(); | ||
|
||
$this->process($container); | ||
} | ||
|
||
function it_disables_the_kernels_view_cache_response_listener(ContainerBuilder $container) | ||
{ | ||
$container->getDefinitions()->willReturn([ | ||
'ezpublish.view.cache_response_listener' => new Definition(), | ||
'witness_service' => new Definition(), | ||
]); | ||
$container->removeDefinition('ezpublish.view.cache_response_listener')->shouldBeCalled(); | ||
|
||
$this->process($container); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
|
||
namespace EzSystems\PlatformHttpCacheBundle; | ||
|
||
use eZ\Bundle\EzPublishCoreBundle\HttpCache; | ||
use EzSystems\PlatformHttpCacheBundle\Proxy\TagAwareStore; | ||
|
||
/** | ||
* Custom AppCache. | ||
* | ||
* Enable by setting SYMFONY_HTTP_CACHE_CLASS to 'EzSystems\PlatformHttpCacheBundle\AppCache' | ||
*/ | ||
class AppCache extends HttpCache | ||
{ | ||
protected function createStore() | ||
{ | ||
return new TagAwareStore($this->cacheDir ?: $this->kernel->getCacheDir() . '/http_cache'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters