Skip to content

Commit

Permalink
Fix form type tag BC layer
Browse files Browse the repository at this point in the history
  • Loading branch information
GeLoLabs committed Dec 8, 2015
1 parent 7fc539a commit bff1d04
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 178 deletions.
41 changes: 0 additions & 41 deletions DependencyInjection/Compiler/FormTypeCompilerPass.php

This file was deleted.

7 changes: 7 additions & 0 deletions DependencyInjection/IvoryCKEditorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
use Symfony\Component\HttpKernel\Kernel;

/**
* Ivory CKEditor extension.
Expand All @@ -42,6 +43,12 @@ protected function loadInternal(array $config, ContainerBuilder $container)
$this->registerStylesSet($config, $container);
$this->registerTemplates($config, $container);
}

if (Kernel::VERSION_ID < 30000) {
$container->getDefinition('ivory_ck_editor.form.type')
->clearTag('form.type')
->addTag('form.type', array('alias' => 'ckeditor'));
}
}

/**
Expand Down
4 changes: 1 addition & 3 deletions IvoryCKEditorBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Ivory\CKEditorBundle;

use Ivory\CKEditorBundle\DependencyInjection\Compiler\AssetsHelperCompilerPass;
use Ivory\CKEditorBundle\DependencyInjection\Compiler\FormTypeCompilerPass;
use Ivory\CKEditorBundle\DependencyInjection\Compiler\ResourceCompilerPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -32,7 +31,6 @@ public function build(ContainerBuilder $container)
{
$container
->addCompilerPass(new ResourceCompilerPass())
->addCompilerPass(new AssetsHelperCompilerPass())
->addCompilerPass(new FormTypeCompilerPass());
->addCompilerPass(new AssetsHelperCompilerPass());
}
}
16 changes: 15 additions & 1 deletion Tests/DependencyInjection/AbstractIvoryCKEditorExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Ivory\CKEditorBundle\DependencyInjection\IvoryCKEditorExtension;
use Ivory\CKEditorBundle\Tests\Fixtures\Extension\FrameworkExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;

/**
* Abstract Ivory CKEditor extension test.
Expand Down Expand Up @@ -80,7 +81,7 @@ protected function tearDown()
*/
abstract protected function loadConfiguration(ContainerBuilder $container, $configuration);

public function testDefaultFormType()
public function testFormType()
{
$this->container->compile();

Expand All @@ -102,6 +103,19 @@ public function testDefaultFormType()
$this->assertSame($this->container->get('ivory_ck_editor.template_manager'), $type->getTemplateManager());
}

public function testFormTag()
{
$this->container->compile();

$tag = $this->container->getDefinition('ivory_ck_editor.form.type')->getTag('form.type');

if (Kernel::VERSION_ID < 30000) {
$this->assertSame(array(array('alias' => 'ckeditor')), $tag);
} else {
$this->assertSame(array(array()), $tag);
}
}

public function testDisable()
{
$this->loadConfiguration($this->container, 'disable');
Expand Down
127 changes: 0 additions & 127 deletions Tests/DependencyInjection/Compiler/FormTypeCompilerPassTest.php

This file was deleted.

6 changes: 0 additions & 6 deletions Tests/IvoryCKEditorBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ public function testCompilerPasses()
->with($this->isInstanceOf('Ivory\CKEditorBundle\DependencyInjection\Compiler\AssetsHelperCompilerPass'))
->will($this->returnSelf());

$containerBuilder
->expects($this->at(2))
->method('addCompilerPass')
->with($this->isInstanceOf('Ivory\CKEditorBundle\DependencyInjection\Compiler\FormTypeCompilerPass'))
->will($this->returnSelf());

$bundle = new IvoryCKEditorBundle();
$bundle->build($containerBuilder);
}
Expand Down

0 comments on commit bff1d04

Please sign in to comment.