|
@@ -14,17 +14,12 @@ namespace Sonata\AdminBundle\Tests\Form\Extension;
|
|
|
use Sonata\AdminBundle\Form\Extension\ChoiceTypeExtension;
|
|
|
use Sonata\CoreBundle\Form\Extension\DependencyInjectionExtension;
|
|
|
use Symfony\Component\Form\Forms;
|
|
|
-use Symfony\Component\HttpKernel\Kernel;
|
|
|
|
|
|
class ChoiceTypeExtensionTest extends \PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
protected function setup()
|
|
|
{
|
|
|
- if (version_compare(Kernel::VERSION, '2.8', '<')) {
|
|
|
- $this->factory = Forms::createFormFactoryBuilder()
|
|
|
- ->addTypeExtension(new ChoiceTypeExtension())
|
|
|
- ->getFormFactory();
|
|
|
- } else { // SF2.7+
|
|
|
+ if (method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) {
|
|
|
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
|
|
$container->expects($this->any())->method('has')->will($this->returnValue(true));
|
|
|
$container->expects($this->any())->method('get')
|
|
@@ -43,11 +38,22 @@ class ChoiceTypeExtensionTest extends \PHPUnit_Framework_TestCase
|
|
|
),
|
|
|
);
|
|
|
|
|
|
- $dependency = new DependencyInjectionExtension($container, $typeServiceIds, $typeExtensionServiceIds, $guesserServiceIds, $mappingTypes, $extensionTypes);
|
|
|
+ $dependency = new DependencyInjectionExtension(
|
|
|
+ $container,
|
|
|
+ $typeServiceIds,
|
|
|
+ $typeExtensionServiceIds,
|
|
|
+ $guesserServiceIds,
|
|
|
+ $mappingTypes,
|
|
|
+ $extensionTypes
|
|
|
+ );
|
|
|
|
|
|
$this->factory = Forms::createFormFactoryBuilder()
|
|
|
->addExtension($dependency)
|
|
|
->getFormFactory();
|
|
|
+ } else {
|
|
|
+ $this->factory = Forms::createFormFactoryBuilder()
|
|
|
+ ->addTypeExtension(new ChoiceTypeExtension())
|
|
|
+ ->getFormFactory();
|
|
|
}
|
|
|
}
|
|
|
|