Skip to content

Commit

Permalink
Merge pull request #82 from digitalkaoz/issue_81
Browse files Browse the repository at this point in the history
fixed #81 cache clearer only registered for sf2.1
  • Loading branch information
Dan committed Jun 20, 2012
2 parents 97ab85a + c17f7dc commit e845c7e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
8 changes: 8 additions & 0 deletions DependencyInjection/LiipImagineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
namespace Liip\ImagineBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Reference;

use Liip\ImagineBundle\LiipImagineBundle;

class LiipImagineExtension extends Extension
{
/**
Expand Down Expand Up @@ -40,5 +44,9 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('liip_imagine.data.loader.default', $config['data_loader']);

$container->setParameter('liip_imagine.controller_action', $config['controller_action']);

if ('2' == Kernel::MAJOR_VERSION && '0' == Kernel::MINOR_VERSION) {
$container->removeDefinition('liip_imagine.cache.clearer');
}
}
}
17 changes: 17 additions & 0 deletions Tests/DependencyInjection/LiipImagineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
namespace Liip\ImagineBundle\Tests\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Liip\ImagineBundle\LiipImagineBundle;
use Liip\ImagineBundle\DependencyInjection\LiipImagineExtension;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -46,6 +48,21 @@ public function testLoadWithDefaults()
);
}

public function testCacheClearerRegistration()
{
$this->createFullConfiguration();

if ('2' == Kernel::MAJOR_VERSION && '0' == Kernel::MINOR_VERSION) {
$this->assertFalse($this->containerBuilder->hasDefinition('liip_imagine.cache.clearer'));
} else {
$this->assertTrue($this->containerBuilder->hasDefinition('liip_imagine.cache.clearer'));

$definition = $this->containerBuilder->getDefinition('liip_imagine.cache.clearer');
$definition->hasTag('kernel.cache_clearer');
$this->assertCount(2, $definition->getArguments());
}
}

/**
* @return ContainerBuilder
*/
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
"require": {
"php": ">=5.3.2",
"imagine/Imagine": "<=0.2.8",
"symfony/framework-bundle": ">=2.0,<2.2-dev"
"symfony/framework-bundle": ">=2.0.14,<2.2-dev"
},

"require-dev": {
"twig/twig":" >=1.0,<2.0-dev"
"twig/twig": ">=1.0,<2.0-dev",
"symfony/yaml": ">=2.0,<2.2-dev"
},

"suggest": {
"twig/twig":" >=1.0,<2.0-dev"
"twig/twig": ">=1.0,<2.0-dev"
},

"autoload": {
Expand Down

0 comments on commit e845c7e

Please sign in to comment.