Merge branch '2.8'

* 2.8:
  [Locale] Add missing @group legacy annotations
  [Form] Add missing @group legacy annotations
  [Form] Use FQCN form types
  Fix security-acl deps
  Fix typo
  [Security] Removed security-acl from the core
  fixed typos
  Fix doctrine mapping validation type error
  Remove skipping of tests based on ICU data version whenever possible
  Fix the handling of null as locale in the stub intl classes
  do not dump leading backslashes in class names
  fix issue #15377
  Skip ::class constant
  [Config] type specific check for emptiness
  [Form] Deprecated FormTypeInterface::getName() and passing of type instances

Conflicts:
	UPGRADE-2.8.md
	composer.json
	src/Symfony/Bridge/Doctrine/composer.json
	src/Symfony/Bridge/Twig/composer.json
	src/Symfony/Bundle/SecurityBundle/composer.json
	src/Symfony/Component/ClassLoader/ClassMapGenerator.php
	src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
	src/Symfony/Component/Form/Tests/AbstractExtensionTest.php
	src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
	src/Symfony/Component/Form/Tests/SimpleFormTest.php
	src/Symfony/Component/Locale/Tests/LocaleTest.php
	src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php
	src/Symfony/Component/Security/Acl/README.md
	src/Symfony/Component/Security/Acl/composer.json
This commit is contained in:
Nicolas Grekas 2015-08-01 12:05:47 +02:00
commit ac9998f0c6
235 changed files with 3007 additions and 10562 deletions

View File

@ -49,7 +49,6 @@
"symfony/proxy-manager-bridge": "self.version",
"symfony/routing": "self.version",
"symfony/security": "2.99.99",
"symfony/security-acl": "self.version",
"symfony/security-core": "self.version",
"symfony/security-csrf": "self.version",
"symfony/security-http": "self.version",
@ -73,7 +72,8 @@
"doctrine/doctrine-bundle": "~1.4",
"monolog/monolog": "~1.11",
"ocramius/proxy-manager": "~0.4|~1.0",
"egulias/email-validator": "~1.2"
"egulias/email-validator": "~1.2",
"symfony/security-acl": "self.version"
},
"autoload": {
"psr-4": {

View File

@ -252,7 +252,7 @@ abstract class AbstractDoctrineExtension extends Extension
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.
'"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '.
'You can register them by adding a new driver to the '.
'"%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'.metadata_driver')
'"%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'_metadata_driver')
));
}
}

View File

@ -94,12 +94,12 @@ abstract class DoctrineType extends AbstractType
* Gets important parts from QueryBuilder that will allow to cache its results.
* For instance in ORM two query builders with an equal SQL string and
* equal parameters are considered to be equal.
*
*
* @param object $queryBuilder
*
*
* @return array|false Array with important QueryBuilder parts or false if
* they can't be determined
*
*
* @internal This method is public to be usable as callback. It should not
* be used in user code.
*/
@ -328,6 +328,6 @@ abstract class DoctrineType extends AbstractType
public function getParent()
{
return 'choice';
return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
}
}

View File

@ -56,7 +56,18 @@ class EntityType extends DoctrineType
return new ORMQueryBuilderLoader($queryBuilder, $manager, $class);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'entity';
}
@ -64,11 +75,11 @@ class EntityType extends DoctrineType
/**
* We consider two query builders with an equal SQL string and
* equal parameters to be equal.
*
*
* @param QueryBuilder $queryBuilder
*
*
* @return array
*
*
* @internal This method is public to be usable as callback. It should not
* be used in user code.
*/

View File

@ -102,12 +102,25 @@ class EntityTypeTest extends TypeTestCase
// be managed!
}
/**
* @group legacy
*/
public function testLegacyName()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
));
$this->assertSame('entity', $field->getConfig()->getType()->getName());
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\MissingOptionsException
*/
public function testClassOptionIsRequired()
{
$this->factory->createNamed('name', 'entity');
$this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType');
}
/**
@ -115,7 +128,7 @@ class EntityTypeTest extends TypeTestCase
*/
public function testInvalidClassOption()
{
$this->factory->createNamed('name', 'entity', null, array(
$this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'class' => 'foo',
));
}
@ -127,7 +140,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@ -144,7 +157,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@ -161,7 +174,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$qb = $this->em->createQueryBuilder()->select('e')->from(self::SINGLE_IDENT_CLASS, 'e');
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@ -177,7 +190,7 @@ class EntityTypeTest extends TypeTestCase
*/
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => new \stdClass(),
@ -189,7 +202,7 @@ class EntityTypeTest extends TypeTestCase
*/
public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function () {
@ -202,7 +215,7 @@ class EntityTypeTest extends TypeTestCase
public function testSetDataSingleNull()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
@ -215,7 +228,7 @@ class EntityTypeTest extends TypeTestCase
public function testSetDataMultipleExpandedNull()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => true,
'em' => 'default',
@ -229,7 +242,7 @@ class EntityTypeTest extends TypeTestCase
public function testSetDataMultipleNonExpandedNull()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@ -243,7 +256,7 @@ class EntityTypeTest extends TypeTestCase
public function testSubmitSingleExpandedNull()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => true,
'em' => 'default',
@ -257,7 +270,7 @@ class EntityTypeTest extends TypeTestCase
public function testSubmitSingleNonExpandedNull()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@ -271,7 +284,7 @@ class EntityTypeTest extends TypeTestCase
public function testSubmitMultipleNull()
{
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
@ -289,7 +302,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@ -311,7 +324,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@ -335,7 +348,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@ -360,7 +373,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@ -391,7 +404,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@ -417,7 +430,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@ -447,7 +460,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => true,
'em' => 'default',
@ -473,7 +486,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => true,
'em' => 'default',
@ -502,7 +515,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => true,
'em' => 'default',
@ -528,7 +541,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
// not all persisted entities should be displayed
@ -553,7 +566,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($item1, $item2, $item3, $item4));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::ITEM_GROUP_CLASS,
'choices' => array($item1, $item2, $item3, $item4),
@ -584,7 +597,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'preferred_choices' => array($entity3, $entity2),
@ -603,7 +616,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'choices' => array($entity2, $entity3),
@ -623,7 +636,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'choices' => array($entity1, $entity2),
@ -644,7 +657,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::COMPOSITE_IDENT_CLASS,
'choices' => array($entity1, $entity2),
@ -667,7 +680,7 @@ class EntityTypeTest extends TypeTestCase
$repository = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => $repository->createQueryBuilder('e')
@ -689,7 +702,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function ($repository) {
@ -713,7 +726,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::COMPOSITE_IDENT_CLASS,
'query_builder' => function ($repository) {
@ -735,7 +748,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@ -756,7 +769,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@ -782,7 +795,7 @@ class EntityTypeTest extends TypeTestCase
->with(self::SINGLE_IDENT_CLASS)
->will($this->returnValue($this->em));
$this->factory->createNamed('name', 'entity', null, array(
$this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
'choice_label' => 'name',
@ -797,7 +810,7 @@ class EntityTypeTest extends TypeTestCase
$this->emRegistry->expects($this->never())
->method('getManagerForClass');
$this->factory->createNamed('name', 'entity', null, array(
$this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => $this->em,
'class' => self::SINGLE_IDENT_CLASS,
'choice_label' => 'name',
@ -826,15 +839,15 @@ class EntityTypeTest extends TypeTestCase
->addTypeGuesser($entityTypeGuesser)
->getFormFactory();
$formBuilder = $factory->createNamedBuilder('form', 'form');
$formBuilder = $factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType');
$formBuilder->add('property1', 'entity', array(
$formBuilder->add('property1', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => $repo->createQueryBuilder('e')->where('e.id IN (1, 2)'),
));
$formBuilder->add('property2', 'entity', array(
$formBuilder->add('property2', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function (EntityRepository $repo) {
@ -842,7 +855,7 @@ class EntityTypeTest extends TypeTestCase
},
));
$formBuilder->add('property3', 'entity', array(
$formBuilder->add('property3', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function (EntityRepository $repo) {
@ -873,14 +886,14 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1));
$field1 = $this->factory->createNamed('name', 'entity', null, array(
$field1 = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
'choice_label' => 'name',
));
$field2 = $this->factory->createNamed('name', 'entity', null, array(
$field2 = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@ -901,7 +914,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,

View File

@ -65,7 +65,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
public function testThemeBlockInheritanceUsingUse()
{
$view = $this->factory
->createNamed('name', 'email')
->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
@ -80,7 +80,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
public function testThemeBlockInheritanceUsingExtend()
{
$view = $this->factory
->createNamed('name', 'email')
->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
@ -95,7 +95,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
public function testThemeBlockInheritanceUsingDynamicExtend()
{
$view = $this->factory
->createNamed('name', 'email')
->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;

View File

@ -31,6 +31,7 @@
"symfony/translation": "~2.8|~3.0",
"symfony/yaml": "~2.8|~3.0",
"symfony/security": "~2.8|~3.0",
"symfony/security-acl": "~2.8|~3.0",
"symfony/stopwatch": "~2.8|~3.0",
"symfony/console": "~2.8|~3.0",
"symfony/var-dumper": "~2.8|~3.0",

View File

@ -33,16 +33,29 @@ class FormPass implements CompilerPassInterface
// Builds an array with service IDs as keys and tag aliases as values
$types = array();
foreach ($container->findTaggedServiceIds('form.type') as $serviceId => $tag) {
$alias = isset($tag[0]['alias'])
? $tag[0]['alias']
: $serviceId;
// Remember which names will not be supported in Symfony 3.0 to trigger
// deprecation errors
$legacyNames = array();
// Flip, because we want tag aliases (= type identifiers) as keys
$types[$alias] = $serviceId;
foreach ($container->findTaggedServiceIds('form.type') as $serviceId => $tag) {
// The following if-else block is deprecated and will be removed
// in Symfony 3.0
// Deprecation errors are triggered in DependencyInjectionExtension
if (isset($tag[0]['alias'])) {
$types[$tag[0]['alias']] = $serviceId;
$legacyNames[$tag[0]['alias']] = true;
} else {
$types[$serviceId] = $serviceId;
$legacyNames[$serviceId] = true;
}
// Support type access by FQCN
$serviceDefinition = $container->getDefinition($serviceId);
$types[$serviceDefinition->getClass()] = $serviceId;
}
$definition->replaceArgument(1, $types);
$definition->replaceArgument(4, $legacyNames);
$typeExtensions = array();

View File

@ -37,6 +37,8 @@
<argument type="collection" />
<!-- All services with tag "form.type_guesser" are inserted here by FormPass -->
<argument type="collection" />
<!-- The deprecated type names are inserted here by FormPass -->
<argument type="collection" />
</service>
<!-- ValidatorTypeGuesser -->

View File

@ -0,0 +1,223 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Form\AbstractType;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class FormPassTest extends \PHPUnit_Framework_TestCase
{
public function testDoNothingIfFormExtensionNotLoaded()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new FormPass());
$container->compile();
$this->assertFalse($container->hasDefinition('form.extension'));
}
public function testAddTaggedTypes()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new FormPass());
$extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
$extDefinition->setArguments(array(
new Reference('service_container'),
array(),
array(),
array(),
array(),
));
$definition1 = new Definition(__CLASS__.'_Type1');
$definition1->addTag('form.type');
$definition2 = new Definition(__CLASS__.'_Type2');
$definition2->addTag('form.type');
$container->setDefinition('form.extension', $extDefinition);
$container->setDefinition('my.type1', $definition1);
$container->setDefinition('my.type2', $definition2);
$container->compile();
$extDefinition = $container->getDefinition('form.extension');
$this->assertEquals(array(
// As of Symfony 2.8, the class is used to look up types
__CLASS__.'_Type1' => 'my.type1',
__CLASS__.'_Type2' => 'my.type2',
// Before Symfony 2.8, the service ID was used as default alias
'my.type1' => 'my.type1',
'my.type2' => 'my.type2',
), $extDefinition->getArgument(1));
}
public function testUseCustomAliasIfSet()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new FormPass());
$extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
$extDefinition->setArguments(array(
new Reference('service_container'),
array(),
array(),
array(),
array(),
));
$definition1 = new Definition(__CLASS__.'_Type1');
$definition1->addTag('form.type', array('alias' => 'mytype1'));
$definition2 = new Definition(__CLASS__.'_Type2');
$definition2->addTag('form.type', array('alias' => 'mytype2'));
$container->setDefinition('form.extension', $extDefinition);
$container->setDefinition('my.type1', $definition1);
$container->setDefinition('my.type2', $definition2);
$container->compile();
$extDefinition = $container->getDefinition('form.extension');
$this->assertEquals(array(
__CLASS__.'_Type1' => 'my.type1',
__CLASS__.'_Type2' => 'my.type2',
'mytype1' => 'my.type1',
'mytype2' => 'my.type2',
), $extDefinition->getArgument(1));
}
public function testPassLegacyNames()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new FormPass());
$extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
$extDefinition->setArguments(array(
new Reference('service_container'),
array(),
array(),
array(),
array(),
));
$definition1 = new Definition(__CLASS__.'_Type1');
$definition1->addTag('form.type');
$definition2 = new Definition(__CLASS__.'_Type2');
$definition2->addTag('form.type', array('alias' => 'mytype2'));
$container->setDefinition('form.extension', $extDefinition);
$container->setDefinition('my.type1', $definition1);
$container->setDefinition('my.type2', $definition2);
$container->compile();
$extDefinition = $container->getDefinition('form.extension');
$this->assertEquals(array(
// Service ID if no alias is set
'my.type1' => true,
// Alias if set
'mytype2' => true,
), $extDefinition->getArgument(4));
}
public function testAddTaggedTypeExtensions()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new FormPass());
$extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
$extDefinition->setArguments(array(
new Reference('service_container'),
array(),
array(),
array(),
array(),
));
$definition1 = new Definition('stdClass');
$definition1->addTag('form.type_extension', array('alias' => 'type1'));
$definition2 = new Definition('stdClass');
$definition2->addTag('form.type_extension', array('alias' => 'type1'));
$definition3 = new Definition('stdClass');
$definition3->addTag('form.type_extension', array('alias' => 'type2'));
$container->setDefinition('form.extension', $extDefinition);
$container->setDefinition('my.type_extension1', $definition1);
$container->setDefinition('my.type_extension2', $definition2);
$container->setDefinition('my.type_extension3', $definition3);
$container->compile();
$extDefinition = $container->getDefinition('form.extension');
$this->assertSame(array(
'type1' => array(
'my.type_extension1',
'my.type_extension2',
),
'type2' => array(
'my.type_extension3',
),
), $extDefinition->getArgument(2));
}
public function testAddTaggedGuessers()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new FormPass());
$extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
$extDefinition->setArguments(array(
new Reference('service_container'),
array(),
array(),
array(),
array(),
));
$definition1 = new Definition('stdClass');
$definition1->addTag('form.type_guesser');
$definition2 = new Definition('stdClass');
$definition2->addTag('form.type_guesser');
$container->setDefinition('form.extension', $extDefinition);
$container->setDefinition('my.guesser1', $definition1);
$container->setDefinition('my.guesser2', $definition2);
$container->compile();
$extDefinition = $container->getDefinition('form.extension');
$this->assertSame(array(
'my.guesser1',
'my.guesser2',
), $extDefinition->getArgument(3));
}
}
class FormPassTest_Type1 extends AbstractType
{
}
class FormPassTest_Type2 extends AbstractType
{
}

View File

@ -71,7 +71,7 @@ class SecurityDataCollector extends DataCollector
if (null !== $this->roleHierarchy) {
$allRoles = $this->roleHierarchy->getReachableRoles($assignedRoles);
foreach ($allRoles as $role) {
if (!in_array($role, $assignedRoles)) {
if (!in_array($role, $assignedRoles, true)) {
$inheritedRoles[] = $role;
}
}

View File

@ -19,7 +19,7 @@ class LoginController extends ContainerAware
{
public function loginAction()
{
$form = $this->container->get('form.factory')->create('user_login');
$form = $this->container->get('form.factory')->create('Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType');
return $this->container->get('templating')->renderResponse('CsrfFormLoginBundle:Login:login.html.twig', array(
'form' => $form->createView(),

View File

@ -27,7 +27,7 @@ use Symfony\Component\Security\Core\Security;
* @author Henrik Bjornskov <henrik@bjrnskov.dk>
* @author Jeremy Mikola <jmikola@gmail.com>
*/
class UserLoginFormType extends AbstractType
class UserLoginType extends AbstractType
{
private $requestStack;
@ -42,9 +42,9 @@ class UserLoginFormType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('username', 'text')
->add('password', 'password')
->add('_target_path', 'hidden')
->add('username', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('password', 'Symfony\Component\Form\Extension\Core\Type\PasswordType')
->add('_target_path', 'Symfony\Component\Form\Extension\Core\Type\HiddenType')
;
$request = $this->requestStack->getCurrentRequest();
@ -84,12 +84,4 @@ class UserLoginFormType extends AbstractType
'intention' => 'authenticate',
));
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'user_login';
}
}

View File

@ -3,11 +3,11 @@ imports:
services:
csrf_form_login.form.type:
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginFormType
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType
arguments:
- @request_stack
tags:
- { name: form.type, alias: user_login }
- { name: form.type }
security:
encoders:

View File

@ -18,6 +18,7 @@
"require": {
"php": ">=5.5.9",
"symfony/security": "~2.8|~3.0",
"symfony/security-acl": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0"
},
"require-dev": {

View File

@ -110,6 +110,25 @@ class ClassMapGenerator
case T_CLASS:
case T_INTERFACE:
case T_TRAIT:
// Skip usage of ::class constant
$isClassConstant = false;
for ($j = $i - 1; $j > 0; --$j) {
if (is_string($tokens[$j])) {
break;
}
if (T_DOUBLE_COLON === $tokens[$j][0]) {
$isClassConstant = true;
break;
} elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
break;
}
}
if ($isClassConstant) {
continue;
}
// Find the classname
while (($t = $tokens[++$i]) && is_array($t)) {
if (T_STRING === $t[0]) {

View File

@ -47,7 +47,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider getTestCreateMapTests
*/
public function testDump($directory, $expected)
public function testDump($directory)
{
$this->prepare_workspace();
@ -112,6 +112,12 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
)),
);
if (PHP_VERSION_ID >= 50500) {
$data[] = array(__DIR__.'/Fixtures/php5.5', array(
'ClassCons\\Foo' => __DIR__.'/Fixtures/php5.5/class_cons.php',
));
}
return $data;
}

View File

@ -0,0 +1,11 @@
<?php
namespace ClassCons;
class Foo
{
public function __construct()
{
\Foo\TBar/* foo */::class;
}
}

View File

@ -39,4 +39,13 @@ class BooleanNode extends ScalarNode
throw $ex;
}
}
/**
* {@inheritdoc}
*/
protected function isValueEmpty($value)
{
// a boolean value cannot be empty
return false;
}
}

View File

@ -52,4 +52,13 @@ class NumericNode extends ScalarNode
return $value;
}
/**
* {@inheritdoc}
*/
protected function isValueEmpty($value)
{
// a numeric value cannot be empty
return false;
}
}

View File

@ -46,4 +46,12 @@ class ScalarNode extends VariableNode
throw $ex;
}
}
/**
* {@inheritdoc}
*/
protected function isValueEmpty($value)
{
return null === $value || '' === $value;
}
}

View File

@ -84,7 +84,7 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
*/
protected function finalizeValue($value)
{
if (!$this->allowEmptyValue && empty($value)) {
if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
$ex = new InvalidConfigurationException(sprintf(
'The path "%s" cannot contain an empty value, but got %s.',
$this->getPath(),
@ -116,4 +116,20 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
{
return $rightSide;
}
/**
* Evaluates if the given value is to be treated as empty.
*
* By default, PHP's empty() function is used to test for emptiness. This
* method may be overridden by subtypes to better match their understanding
* of empty data.
*
* @param mixed $value
*
* @return bool
*/
protected function isValueEmpty($value)
{
return empty($value);
}
}

View File

@ -24,6 +24,19 @@ class BooleanNodeTest extends \PHPUnit_Framework_TestCase
$this->assertSame($value, $node->normalize($value));
}
/**
* @dataProvider getValidValues
*
* @param bool $value
*/
public function testValidNonEmptyValues($value)
{
$node = new BooleanNode('test');
$node->setAllowEmptyValue(false);
$this->assertSame($value, $node->finalize($value));
}
public function getValidValues()
{
return array(

View File

@ -24,6 +24,19 @@ class FloatNodeTest extends \PHPUnit_Framework_TestCase
$this->assertSame($value, $node->normalize($value));
}
/**
* @dataProvider getValidValues
*
* @param int $value
*/
public function testValidNonEmptyValues($value)
{
$node = new FloatNode('test');
$node->setAllowEmptyValue(false);
$this->assertSame($value, $node->finalize($value));
}
public function getValidValues()
{
return array(

View File

@ -24,6 +24,19 @@ class IntegerNodeTest extends \PHPUnit_Framework_TestCase
$this->assertSame($value, $node->normalize($value));
}
/**
* @dataProvider getValidValues
*
* @param int $value
*/
public function testValidNonEmptyValues($value)
{
$node = new IntegerNode('test');
$node->setAllowEmptyValue(false);
$this->assertSame($value, $node->finalize($value));
}
public function getValidValues()
{
return array(

View File

@ -76,4 +76,51 @@ class ScalarNodeTest extends \PHPUnit_Framework_TestCase
$node->normalize(array());
}
/**
* @dataProvider getValidNonEmptyValues
*
* @param mixed $value
*/
public function testValidNonEmptyValues($value)
{
$node = new ScalarNode('test');
$node->setAllowEmptyValue(false);
$this->assertSame($value, $node->finalize($value));
}
public function getValidNonEmptyValues()
{
return array(
array(false),
array(true),
array('foo'),
array(0),
array(1),
array(0.0),
array(0.1),
);
}
/**
* @dataProvider getEmptyValues
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*
* @param mixed $value
*/
public function testNotAllowedEmptyValuesThrowException($value)
{
$node = new ScalarNode('test');
$node->setAllowEmptyValue(false);
$node->finalize($value);
}
public function getEmptyValues()
{
return array(
array(null),
array(''),
);
}
}

View File

@ -166,14 +166,18 @@ class GraphvizDumper extends Dumper
$container = $this->cloneContainer();
foreach ($container->getDefinitions() as $id => $definition) {
$className = $definition->getClass();
$class = $definition->getClass();
if ('\\' === substr($class, 0, 1)) {
$class = substr($class, 1);
}
try {
$className = $this->container->getParameterBag()->resolveValue($className);
$class = $this->container->getParameterBag()->resolveValue($class);
} catch (ParameterNotFoundException $e) {
}
$nodes[$id] = array('class' => str_replace('\\', '\\\\', $className), 'attributes' => array_merge($this->options['node.definition'], array('style' => $definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope(false) ? 'filled' : 'dotted')));
$nodes[$id] = array('class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], array('style' => $definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope(false) ? 'filled' : 'dotted')));
$container->setDefinition($id, new Definition('stdClass'));
}

View File

@ -366,7 +366,13 @@ class PhpDumper extends Dumper
*/
private function addServiceInstance($id, $definition)
{
$class = $this->dumpValue($definition->getClass());
$class = $definition->getClass();
if ('\\' === substr($class, 0, 1)) {
$class = substr($class, 1);
}
$class = $this->dumpValue($class);
if (0 === strpos($class, "'") && !preg_match('/^\'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id));
@ -554,7 +560,7 @@ class PhpDumper extends Dumper
if ($definition->isSynthetic()) {
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
} elseif ($class = $definition->getClass()) {
$return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : '\\'.$class, $class);
$return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : '\\'.ltrim($class, '\\'), ltrim($class, '\\'));
} elseif ($definition->getFactory()) {
$factory = $definition->getFactory();
if (is_string($factory)) {

View File

@ -114,8 +114,12 @@ class XmlDumper extends Dumper
if (null !== $id) {
$service->setAttribute('id', $id);
}
if ($definition->getClass()) {
$service->setAttribute('class', $definition->getClass());
if ($class = $definition->getClass()) {
if ('\\' === substr($class, 0, 1)) {
$class = substr($class, 1);
}
$service->setAttribute('class', $class);
}
if (!$definition->isShared()) {
$service->setAttribute('shared', 'false');

View File

@ -64,8 +64,12 @@ class YamlDumper extends Dumper
private function addService($id, $definition)
{
$code = " $id:\n";
if ($definition->getClass()) {
$code .= sprintf(" class: %s\n", $definition->getClass());
if ($class = $definition->getClass()) {
if ('\\' === substr($class, 0, 1)) {
$class = substr($class, 1);
}
$code .= sprintf(" class: %s\n", $class);
}
if (!$definition->isPublic()) {

View File

@ -10,7 +10,7 @@ use Symfony\Component\ExpressionLanguage\Expression;
$container = new ContainerBuilder();
$container
->register('foo', 'Bar\FooClass')
->register('foo', '\Bar\FooClass')
->addTag('foo', array('foo' => 'foo'))
->addTag('foo', array('bar' => 'bar', 'baz' => 'baz'))
->setFactory(array('Bar\\FooClass', 'getInstance'))

View File

@ -156,7 +156,15 @@ abstract class AbstractExtension implements FormExtensionInterface
throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
}
$this->types[$type->getName()] = $type;
// Since Symfony 3.0 types are identified by their FQCN
$fqcn = get_class($type);
$legacyName = $type->getName();
$this->types[$fqcn] = $type;
if ($legacyName) {
$this->types[$legacyName] = $type;
}
}
}

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Form;
use Symfony\Component\Form\Util\StringUtil;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -46,11 +47,37 @@ abstract class AbstractType implements FormTypeInterface
{
}
/**
* {@inheritdoc}
*/
public function getName()
{
// As of Symfony 2.8, the name defaults to the fully-qualified class name
return get_class($this);
}
/**
* Returns the prefix of the template block name for this type.
*
* The block prefixes default to the underscored short class name with
* the "Type" suffix removed (e.g. "UserProfileType" => "user_profile").
*
* @return string The prefix of the template block name
*/
public function getBlockPrefix()
{
$fqcn = get_class($this);
$name = $this->getName();
// For BC: Use the name as block prefix if one is set
return $name !== $fqcn ? $name : StringUtil::fqcnToBlockPrefix($fqcn);
}
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'form';
return 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
}

View File

@ -15,6 +15,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Util\StringUtil;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -77,7 +78,17 @@ abstract class BaseType extends AbstractType
$blockPrefixes = array();
for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
array_unshift($blockPrefixes, $type->getName());
if (method_exists($type, 'getBlockPrefix')) {
array_unshift($blockPrefixes, $type->getBlockPrefix());
} else {
@trigger_error(get_class($type).': The ResolvedFormTypeInterface::getBlockPrefix() method will be added in version 3.0. You should add it to your implementation.', E_USER_DEPRECATED);
$fqcn = get_class($type->getInnerType());
$name = $type->getName();
$hasCustomName = $name !== $fqcn;
array_unshift($blockPrefixes, $hasCustomName ? $name : StringUtil::fqcnToBlockPrefix($fqcn));
}
}
$blockPrefixes[] = $uniqueBlockPrefix;

View File

@ -31,13 +31,21 @@ class BirthdayType extends AbstractType
*/
public function getParent()
{
return 'date';
return __NAMESPACE__.'\DateType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'birthday';
}

View File

@ -32,6 +32,14 @@ class ButtonType extends BaseType implements ButtonTypeInterface
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'button';
}

View File

@ -66,6 +66,14 @@ class CheckboxType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'checkbox';
}

View File

@ -361,6 +361,14 @@ class ChoiceType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'choice';
}
@ -424,12 +432,12 @@ class ChoiceType extends AbstractType
);
if ($options['multiple']) {
$choiceType = 'checkbox';
$choiceType = __NAMESPACE__.'\CheckboxType';
// The user can check 0 or more checkboxes. If required
// is true, he is required to check all of them.
$choiceOpts['required'] = false;
} else {
$choiceType = 'radio';
$choiceType = __NAMESPACE__.'\RadioType';
}
$builder->add($name, $choiceType, $choiceOpts);

View File

@ -88,7 +88,7 @@ class CollectionType extends AbstractType
'prototype' => true,
'prototype_data' => null,
'prototype_name' => '__name__',
'type' => 'text',
'type' => __NAMESPACE__.'\TextType',
'options' => array(),
'delete_empty' => false,
));
@ -100,6 +100,14 @@ class CollectionType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'collection';
}

View File

@ -33,13 +33,21 @@ class CountryType extends AbstractType
*/
public function getParent()
{
return 'choice';
return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'country';
}

View File

@ -33,13 +33,21 @@ class CurrencyType extends AbstractType
*/
public function getParent()
{
return 'choice';
return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'currency';
}

View File

@ -161,8 +161,8 @@ class DateTimeType extends AbstractType
'time' => $timeParts,
)),
)))
->add('date', 'date', $dateOptions)
->add('time', 'time', $timeOptions)
->add('date', __NAMESPACE__.'\DateType', $dateOptions)
->add('time', __NAMESPACE__.'\TimeType', $timeOptions)
;
}
@ -284,6 +284,14 @@ class DateTimeType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'datetime';
}

View File

@ -37,6 +37,11 @@ class DateType extends AbstractType
\IntlDateFormatter::SHORT,
);
private static $widgets = array(
'text' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'choice' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType',
);
/**
* {@inheritdoc}
*/
@ -101,9 +106,9 @@ class DateType extends AbstractType
}
$builder
->add('year', $options['widget'], $yearOptions)
->add('month', $options['widget'], $monthOptions)
->add('day', $options['widget'], $dayOptions)
->add('year', self::$widgets[$options['widget']], $yearOptions)
->add('month', self::$widgets[$options['widget']], $monthOptions)
->add('day', self::$widgets[$options['widget']], $dayOptions)
->addViewTransformer(new DateTimeToArrayTransformer(
$options['model_timezone'], $options['view_timezone'], array('year', 'month', 'day')
))
@ -253,6 +258,14 @@ class DateType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'date';
}

View File

@ -20,13 +20,21 @@ class EmailType extends AbstractType
*/
public function getParent()
{
return 'text';
return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'email';
}

View File

@ -61,6 +61,14 @@ class FileType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'file';
}

View File

@ -244,6 +244,14 @@ class FormType extends BaseType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'form';
}

View File

@ -34,6 +34,14 @@ class HiddenType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'hidden';
}

View File

@ -73,6 +73,14 @@ class IntegerType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'integer';
}

View File

@ -33,13 +33,21 @@ class LanguageType extends AbstractType
*/
public function getParent()
{
return 'choice';
return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'language';
}

View File

@ -33,13 +33,21 @@ class LocaleType extends AbstractType
*/
public function getParent()
{
return 'choice';
return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'locale';
}

View File

@ -78,6 +78,14 @@ class MoneyType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'money';
}

View File

@ -71,6 +71,14 @@ class NumberType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'number';
}

View File

@ -44,13 +44,21 @@ class PasswordType extends AbstractType
*/
public function getParent()
{
return 'text';
return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'password';
}

View File

@ -62,6 +62,14 @@ class PercentType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'percent';
}

View File

@ -20,13 +20,21 @@ class RadioType extends AbstractType
*/
public function getParent()
{
return 'checkbox';
return __NAMESPACE__.'\CheckboxType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'radio';
}

View File

@ -20,13 +20,21 @@ class RangeType extends AbstractType
*/
public function getParent()
{
return 'text';
return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'range';
}

View File

@ -47,7 +47,7 @@ class RepeatedType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'type' => 'text',
'type' => __NAMESPACE__.'\TextType',
'options' => array(),
'first_options' => array(),
'second_options' => array(),
@ -65,6 +65,14 @@ class RepeatedType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'repeated';
}

View File

@ -26,13 +26,21 @@ class ResetType extends AbstractType implements ButtonTypeInterface
*/
public function getParent()
{
return 'button';
return __NAMESPACE__.'\ButtonType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'reset';
}

View File

@ -20,13 +20,21 @@ class SearchType extends AbstractType
*/
public function getParent()
{
return 'text';
return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'search';
}

View File

@ -33,13 +33,21 @@ class SubmitType extends AbstractType implements SubmitButtonTypeInterface
*/
public function getParent()
{
return 'button';
return __NAMESPACE__.'\ButtonType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'submit';
}

View File

@ -30,6 +30,14 @@ class TextType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'text';
}

View File

@ -30,13 +30,21 @@ class TextareaType extends AbstractType
*/
public function getParent()
{
return 'text';
return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'textarea';
}

View File

@ -25,6 +25,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class TimeType extends AbstractType
{
private static $widgets = array(
'text' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'choice' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType',
);
/**
* {@inheritdoc}
*/
@ -99,14 +104,14 @@ class TimeType extends AbstractType
}
}
$builder->add('hour', $options['widget'], $hourOptions);
$builder->add('hour', self::$widgets[$options['widget']], $hourOptions);
if ($options['with_minutes']) {
$builder->add('minute', $options['widget'], $minuteOptions);
$builder->add('minute', self::$widgets[$options['widget']], $minuteOptions);
}
if ($options['with_seconds']) {
$builder->add('second', $options['widget'], $secondOptions);
$builder->add('second', self::$widgets[$options['widget']], $secondOptions);
}
$builder->addViewTransformer(new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts, 'text' === $options['widget']));
@ -238,6 +243,14 @@ class TimeType extends AbstractType
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'time';
}

View File

@ -39,13 +39,21 @@ class TimezoneType extends AbstractType
*/
public function getParent()
{
return 'choice';
return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'timezone';
}

View File

@ -43,13 +43,21 @@ class UrlType extends AbstractType
*/
public function getParent()
{
return 'text';
return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'url';
}

View File

@ -108,7 +108,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
$tokenId = $options['csrf_token_id'] ?: ($form->getName() ?: get_class($form->getConfig()->getType()->getInnerType()));
$data = (string) $options['csrf_token_manager']->getToken($tokenId);
$csrfForm = $factory->createNamed($options['csrf_field_name'], 'hidden', $data, array(
$csrfForm = $factory->createNamed($options['csrf_field_name'], 'Symfony\Component\Form\Extension\Core\Type\HiddenType', $data, array(
'mapped' => false,
));
@ -153,6 +153,6 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
*/
public function getExtendedType()
{
return 'form';
return 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
}

View File

@ -50,6 +50,14 @@ class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface
return $this->proxiedType->getName();
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return method_exists($this->proxiedType, 'getBlockPrefix') ? $this->proxiedType->getBlockPrefix() : $this->getName();
}
/**
* {@inheritdoc}
*/

View File

@ -22,17 +22,19 @@ class DependencyInjectionExtension implements FormExtensionInterface
private $typeServiceIds;
private $typeExtensionServiceIds;
private $guesserServiceIds;
private $legacyNames;
private $guesser;
private $guesserLoaded = false;
public function __construct(ContainerInterface $container,
array $typeServiceIds, array $typeExtensionServiceIds,
array $guesserServiceIds)
array $guesserServiceIds, array $legacyNames = array())
{
$this->container = $container;
$this->typeServiceIds = $typeServiceIds;
$this->typeExtensionServiceIds = $typeExtensionServiceIds;
$this->guesserServiceIds = $guesserServiceIds;
$this->legacyNames = $legacyNames;
}
public function getType($name)
@ -41,15 +43,21 @@ class DependencyInjectionExtension implements FormExtensionInterface
throw new InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $name));
}
if (isset($this->legacyNames[$name])) {
@trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
}
$type = $this->container->get($this->typeServiceIds[$name]);
if ($type->getName() !== $name) {
// BC: validate result of getName() for legacy names (non-FQCN)
if (isset($this->legacyNames[$name]) && $type->getName() !== $name) {
throw new InvalidArgumentException(
sprintf('The type name specified for the service "%s" does not match the actual name. Expected "%s", given "%s"',
$this->typeServiceIds[$name],
$name,
$type->getName()
));
)
);
}
return $type;
@ -57,11 +65,23 @@ class DependencyInjectionExtension implements FormExtensionInterface
public function hasType($name)
{
return isset($this->typeServiceIds[$name]);
if (isset($this->typeServiceIds[$name])) {
if (isset($this->legacyNames[$name])) {
@trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
}
return true;
}
return false;
}
public function getTypeExtensions($name)
{
if (isset($this->legacyNames[$name])) {
@trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
}
$extensions = array();
if (isset($this->typeExtensionServiceIds[$name])) {
@ -75,6 +95,10 @@ class DependencyInjectionExtension implements FormExtensionInterface
public function hasTypeExtensions($name)
{
if (isset($this->legacyNames[$name])) {
@trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
}
return isset($this->typeExtensionServiceIds[$name]);
}

View File

@ -94,6 +94,6 @@ class FormTypeValidatorExtension extends BaseValidatorExtension
*/
public function getExtendedType()
{
return 'form';
return 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
}

View File

@ -40,6 +40,6 @@ class RepeatedTypeValidatorExtension extends AbstractTypeExtension
*/
public function getExtendedType()
{
return 'repeated';
return 'Symfony\Component\Form\Extension\Core\Type\RepeatedType';
}
}

View File

@ -21,6 +21,6 @@ class SubmitTypeValidatorExtension extends BaseValidatorExtension
*/
public function getExtendedType()
{
return 'submit';
return 'Symfony\Component\Form\Extension\Core\Type\SubmitType';
}
}

View File

@ -99,7 +99,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
}
if (null === $type && null === $this->getDataClass()) {
$type = 'text';
$type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
}
if (null !== $type) {

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Form;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Util\StringUtil;
class FormFactory implements FormFactoryInterface
{
@ -34,7 +35,7 @@ class FormFactory implements FormFactoryInterface
/**
* {@inheritdoc}
*/
public function create($type = 'form', $data = null, array $options = array())
public function create($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
return $this->createBuilder($type, $data, $options)->getForm();
}
@ -42,7 +43,7 @@ class FormFactory implements FormFactoryInterface
/**
* {@inheritdoc}
*/
public function createNamed($name, $type = 'form', $data = null, array $options = array())
public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
return $this->createNamedBuilder($name, $type, $data, $options)->getForm();
}
@ -58,11 +59,37 @@ class FormFactory implements FormFactoryInterface
/**
* {@inheritdoc}
*/
public function createBuilder($type = 'form', $data = null, array $options = array())
public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
$name = $type instanceof FormTypeInterface || $type instanceof ResolvedFormTypeInterface
? $type->getName()
: $type;
$name = null;
$typeName = null;
if ($type instanceof ResolvedFormTypeInterface) {
if (method_exists($type, 'getBlockPrefix')) {
// As of Symfony 3.0, the block prefix of the type is used as
// default name
$name = $type->getBlockPrefix();
} else {
// BC
$typeName = $type->getName();
}
} elseif ($type instanceof FormTypeInterface) {
// BC
$typeName = $type->getName();
} else {
// BC
$typeName = $type;
}
if (null === $name) {
if (false === strpos($typeName, '\\')) {
// No FQCN - leave unchanged for BC
$name = $typeName;
} else {
// FQCN
$name = StringUtil::fqcnToBlockPrefix($typeName);
}
}
return $this->createNamedBuilder($name, $type, $data, $options);
}
@ -70,17 +97,20 @@ class FormFactory implements FormFactoryInterface
/**
* {@inheritdoc}
*/
public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array())
public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
if (null !== $data && !array_key_exists('data', $options)) {
$options['data'] = $data;
}
if ($type instanceof FormTypeInterface) {
@trigger_error('Passing type instances to FormBuilder::add(), Form::add() or the FormFactory is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
$type = $this->resolveType($type);
} elseif (is_string($type)) {
$type = $this->registry->getType($type);
} elseif (!$type instanceof ResolvedFormTypeInterface) {
} elseif ($type instanceof ResolvedFormTypeInterface) {
@trigger_error('Passing type instances to FormBuilder::add(), Form::add() or the FormFactory is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
} else {
throw new UnexpectedTypeException($type, 'string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface');
}
@ -99,7 +129,7 @@ class FormFactory implements FormFactoryInterface
public function createBuilderForProperty($class, $property, $data = null, array $options = array())
{
if (null === $guesser = $this->registry->getTypeGuesser()) {
return $this->createNamedBuilder($property, 'text', $data, $options);
return $this->createNamedBuilder($property, 'Symfony\Component\Form\Extension\Core\Type\TextType', $data, $options);
}
$typeGuess = $guesser->guessType($class, $property);
@ -107,7 +137,7 @@ class FormFactory implements FormFactoryInterface
$requiredGuess = $guesser->guessRequired($class, $property);
$patternGuess = $guesser->guessPattern($class, $property);
$type = $typeGuess ? $typeGuess->getType() : 'text';
$type = $typeGuess ? $typeGuess->getType() : 'Symfony\Component\Form\Extension\Core\Type\TextType';
$maxLength = $maxLengthGuess ? $maxLengthGuess->getValue() : null;
$pattern = $patternGuess ? $patternGuess->getValue() : null;

View File

@ -78,7 +78,7 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
*/
public function addType(FormTypeInterface $type)
{
$this->types[$type->getName()] = $type;
$this->types[] = $type;
return $this;
}
@ -89,7 +89,7 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
public function addTypes(array $types)
{
foreach ($types as $type) {
$this->types[$type->getName()] = $type;
$this->types[] = $type;
}
return $this;

View File

@ -29,7 +29,7 @@ interface FormFactoryInterface
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
public function create($type = 'form', $data = null, array $options = array());
public function create($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form.
@ -45,7 +45,7 @@ interface FormFactoryInterface
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
public function createNamed($name, $type = 'form', $data = null, array $options = array());
public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form for a property of a class.
@ -74,7 +74,7 @@ interface FormFactoryInterface
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
public function createBuilder($type = 'form', $data = null, array $options = array());
public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form builder.
@ -88,7 +88,7 @@ interface FormFactoryInterface
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array());
public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form builder for a property of a class.

View File

@ -34,6 +34,11 @@ class FormRegistry implements FormRegistryInterface
*/
private $types = array();
/**
* @var string[]
*/
private $legacyNames = array();
/**
* @var FormTypeGuesserInterface|false|null
*/
@ -84,12 +89,21 @@ class FormRegistry implements FormRegistryInterface
}
if (!$type) {
throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
// Support fully-qualified class names
if (class_exists($name) && in_array('Symfony\Component\Form\FormTypeInterface', class_implements($name))) {
$type = new $name();
} else {
throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
}
}
$this->resolveAndAddType($type);
}
if (isset($this->legacyNames[$name])) {
@trigger_error('Accessing types by their string name is deprecated since version 2.8 and will be removed in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
}
return $this->types[$name];
}
@ -103,27 +117,52 @@ class FormRegistry implements FormRegistryInterface
*/
private function resolveAndAddType(FormTypeInterface $type)
{
$typeExtensions = array();
$parentType = $type->getParent();
$fqcn = get_class($type);
$name = $type->getName();
$hasCustomName = $name !== $fqcn;
if ($parentType instanceof FormTypeInterface) {
@trigger_error('Returning a FormTypeInterface from FormTypeInterface::getParent() is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
$this->resolveAndAddType($parentType);
$parentType = $parentType->getName();
}
$typeExtensions = array();
if ($hasCustomName) {
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
$extension->getTypeExtensions($name)
);
}
if ($typeExtensions) {
@trigger_error('Returning a type name from FormTypeExtensionInterface::getExtendedType() is deprecated since version 2.8 and will be removed in 3.0. Return the fully-qualified type class name instead.', E_USER_DEPRECATED);
}
}
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
$extension->getTypeExtensions($type->getName())
$extension->getTypeExtensions($fqcn)
);
}
$this->types[$type->getName()] = $this->resolvedTypeFactory->createResolvedType(
$resolvedType = $this->resolvedTypeFactory->createResolvedType(
$type,
$typeExtensions,
$parentType ? $this->getType($parentType) : null
);
$this->types[$fqcn] = $resolvedType;
if ($hasCustomName) {
// Enable access by the explicit type name until Symfony 3.0
$this->types[$name] = $resolvedType;
$this->legacyNames[$name] = true;
}
}
/**
@ -131,6 +170,10 @@ class FormRegistry implements FormRegistryInterface
*/
public function hasType($name)
{
if (isset($this->legacyNames[$name])) {
@trigger_error('Accessing types by their string name is deprecated since version 2.8 and will be removed in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
}
if (isset($this->types[$name])) {
return true;
}

View File

@ -82,7 +82,12 @@ interface FormTypeInterface
* is discouraged because it leads to a performance penalty. The support
* for returning type instances may be dropped from future releases.
*
* @return string|null|FormTypeInterface The name of the parent type if any, null otherwise.
* Returning a {@link FormTypeInterface} instance is deprecated since
* Symfony 2.8 and will be unsupported as of Symfony 3.0. Return the
* fully-qualified class name of the parent type instead.
*
* @return string|null|FormTypeInterface The name of the parent type if any,
* null otherwise.
*/
public function getParent();
@ -90,6 +95,9 @@ interface FormTypeInterface
* Returns the name of this type.
*
* @return string The name of this type
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use the fully-qualified class name of the type instead.
*/
public function getName();
}

View File

@ -38,15 +38,22 @@ class PreloadedExtension implements FormExtensionInterface
/**
* Creates a new preloaded extension.
*
* @param FormTypeInterface[] $types The types that the extension should support.
* @param array[FormTypeExtensionInterface[]] $typeExtensions The type extensions that the extension should support.
* @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support.
* @param FormTypeInterface[] $types The types that the extension should support
* @param FormTypeExtensionInterface[][] $typeExtensions The type extensions that the extension should support
* @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support
*/
public function __construct(array $types, array $typeExtensions, FormTypeGuesserInterface $typeGuesser = null)
{
$this->types = $types;
$this->typeExtensions = $typeExtensions;
$this->typeGuesser = $typeGuesser;
foreach ($types as $type) {
// Up to Symfony 2.8, types were identified by their names
$this->types[$type->getName()] = $type;
// Since Symfony 2.8, types are identified by their FQCN
$this->types[get_class($type)] = $type;
}
}
/**

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\Form;
use Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Util\StringUtil;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@ -23,6 +24,16 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
*/
class ResolvedFormType implements ResolvedFormTypeInterface
{
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $blockPrefix;
/**
* @var FormTypeInterface
*/
@ -45,11 +56,40 @@ class ResolvedFormType implements ResolvedFormTypeInterface
public function __construct(FormTypeInterface $innerType, array $typeExtensions = array(), ResolvedFormTypeInterface $parent = null)
{
if (!preg_match('/^[a-z0-9_]*$/i', $innerType->getName())) {
$fqcn = get_class($innerType);
$name = $innerType->getName();
$hasCustomName = $name !== $fqcn;
if (method_exists($innerType, 'getBlockPrefix')) {
$reflector = new \ReflectionMethod($innerType, 'getName');
$isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
$reflector = new \ReflectionMethod($innerType, 'getBlockPrefix');
$isNewOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
// Bundles compatible with both 2.3 and 2.8 should implement both methods
// Anyone else should only override getBlockPrefix() if they actually
// want to have a different block prefix than the default one
if ($isOldOverwritten && !$isNewOverwritten) {
@trigger_error(get_class($this->innerType).': The FormTypeInterface::getName() method is deprecated since version 2.8 and will be removed in 3.0. Remove it from your classes. Use getBlockPrefix() if you want to customize the template block prefix. This method will be added to the FormTypeInterface with Symfony 3.0.', E_USER_DEPRECATED);
}
$blockPrefix = $innerType->getBlockPrefix();
} else {
@trigger_error(get_class($this->innerType).': The FormTypeInterface::getBlockPrefix() method will be added in version 3.0. You should extend AbstractType or add it to your implementation.', E_USER_DEPRECATED);
// Deal with classes that don't extend AbstractType
// Calculate block prefix from the FQCN by default
$blockPrefix = $hasCustomName ? $name : StringUtil::fqcnToBlockPrefix($fqcn);
}
// As of Symfony 2.8, getName() returns the FQCN by default
// Otherwise check that the name matches the old naming restrictions
if ($hasCustomName && !preg_match('/^[a-z0-9_]*$/i', $name)) {
throw new InvalidArgumentException(sprintf(
'The "%s" form type name ("%s") is not valid. Names must only contain letters, numbers, and "_".',
get_class($innerType),
$innerType->getName()
$name
));
}
@ -59,6 +99,8 @@ class ResolvedFormType implements ResolvedFormTypeInterface
}
}
$this->name = $name;
$this->blockPrefix = $blockPrefix;
$this->innerType = $innerType;
$this->typeExtensions = $typeExtensions;
$this->parent = $parent;
@ -69,7 +111,17 @@ class ResolvedFormType implements ResolvedFormTypeInterface
*/
public function getName()
{
return $this->innerType->getName();
return $this->name;
}
/**
* Returns the prefix of the template block name for this type.
*
* @return string The prefix of the template block name
*/
public function getBlockPrefix()
{
return $this->blockPrefix;
}
/**

View File

@ -17,7 +17,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
{
public function testLabelOnForm()
{
$form = $this->factory->createNamed('name', 'date');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType');
$view = $form->createView();
$this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view);
@ -32,7 +32,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testLabelDoesNotRenderFieldAttributes()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'attr' => array(
'class' => 'my&class',
@ -49,7 +49,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testLabelWithCustomAttributesPassedDirectly()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'label_attr' => array(
'class' => 'my&class',
@ -66,7 +66,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), 'Custom label', array(
'label_attr' => array(
'class' => 'my&class',
@ -84,7 +84,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView(), null, array(
@ -104,7 +104,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testErrors()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error 1[/trans]'));
$form->addError(new FormError('[trans]Error 2[/trans]'));
$view = $form->createView();
@ -137,7 +137,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testOverrideWidgetBlock()
{
// see custom_widgets.html.twig
$form = $this->factory->createNamed('text_id', 'text');
$form = $this->factory->createNamed('text_id', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
$this->assertMatchesXpath($html,
@ -155,7 +155,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testCheckedCheckbox()
{
$form = $this->factory->createNamed('name', 'checkbox', true);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', true);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@ -173,7 +173,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testUncheckedCheckbox()
{
$form = $this->factory->createNamed('name', 'checkbox', false);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@ -191,7 +191,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testCheckboxWithValue()
{
$form = $this->factory->createNamed('name', 'checkbox', false, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false, array(
'value' => 'foo&bar',
));
@ -211,7 +211,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoice()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@ -233,7 +233,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceWithoutTranslation()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@ -256,7 +256,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceAttributes()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@ -279,7 +279,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceWithPreferred()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@ -303,7 +303,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceWithPreferredAndNoSeparator()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@ -326,7 +326,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceWithPreferredAndBlankSeparator()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@ -350,7 +350,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testChoiceWithOnlyPreferred()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&a', '&b'),
'multiple' => false,
@ -367,7 +367,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceNonRequired()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@ -391,7 +391,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceNonRequiredNoneSelected()
{
$form = $this->factory->createNamed('name', 'choice', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@ -415,7 +415,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceNonRequiredWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@ -440,7 +440,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceRequiredWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@ -465,7 +465,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceRequiredWithPlaceholderViaView()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@ -489,7 +489,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceGrouped()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array(
'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'Group&2' => array('&c' => 'Choice&C'),
@ -520,7 +520,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMultipleChoice()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => true,
@ -544,7 +544,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMultipleChoiceAttributes()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'required' => true,
@ -569,7 +569,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMultipleChoiceSkipsPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => true,
'expanded' => false,
@ -592,7 +592,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMultipleChoiceNonRequired()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => true,
@ -615,7 +615,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceExpanded()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -650,7 +650,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceExpandedWithoutTranslation()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -686,7 +686,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceExpandedAttributes()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@ -722,7 +722,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceExpandedWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -767,7 +767,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSingleChoiceExpandedWithBooleanValue()
{
$form = $this->factory->createNamed('name', 'choice', true, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -802,7 +802,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMultipleChoiceExpanded()
{
$form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'multiple' => true,
'expanded' => true,
@ -847,7 +847,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMultipleChoiceExpandedWithoutTranslation()
{
$form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'multiple' => true,
'expanded' => true,
@ -893,7 +893,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMultipleChoiceExpandedAttributes()
{
$form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => true,
@ -939,7 +939,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testCountry()
{
$form = $this->factory->createNamed('name', 'country', 'AT');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@ -953,7 +953,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testCountryWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'country', 'AT', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT', array(
'placeholder' => 'Select&Country',
'required' => false,
));
@ -971,7 +971,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTime()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@ -1007,7 +1007,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTimeWithPlaceholderGlobal()
{
$form = $this->factory->createNamed('name', 'datetime', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@ -1047,7 +1047,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
{
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
$form = $this->factory->createNamed('name', 'datetime', $data, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array(
'input' => 'array',
'required' => false,
));
@ -1084,7 +1084,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTimeWithSeconds()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@ -1125,7 +1125,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTimeSingleText()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'single_text',
'time_widget' => 'single_text',
@ -1154,7 +1154,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTimeWithWidgetSingleText()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
'model_timezone' => 'UTC',
@ -1173,7 +1173,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'choice',
'time_widget' => 'choice',
@ -1194,7 +1194,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateChoice()
{
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'choice',
));
@ -1223,7 +1223,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateChoiceWithPlaceholderGlobal()
{
$form = $this->factory->createNamed('name', 'date', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'placeholder' => 'Change&Me',
@ -1254,7 +1254,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateChoiceWithPlaceholderOnYear()
{
$form = $this->factory->createNamed('name', 'date', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'required' => false,
@ -1285,7 +1285,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateText()
{
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'text',
));
@ -1317,7 +1317,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDateSingleText()
{
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'single_text',
));
@ -1334,7 +1334,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testBirthDay()
{
$form = $this->factory->createNamed('name', 'birthday', '2000-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '2000-02-03', array(
'input' => 'string',
));
@ -1362,7 +1362,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testBirthDayWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'birthday', '1950-01-01', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '1950-01-01', array(
'input' => 'string',
'placeholder' => '',
'required' => false,
@ -1395,7 +1395,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testEmail()
{
$form = $this->factory->createNamed('name', 'email', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1410,7 +1410,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testEmailWithMaxLength()
{
$form = $this->factory->createNamed('name', 'email', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@ -1427,7 +1427,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testHidden()
{
$form = $this->factory->createNamed('name', 'hidden', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\HiddenType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1444,7 +1444,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
*/
public function testLegacyReadOnly()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'read_only' => true,
));
@ -1460,7 +1460,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testDisabled()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'disabled' => true,
));
@ -1476,7 +1476,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testInteger()
{
$form = $this->factory->createNamed('name', 'integer', 123);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\IntegerType', 123);
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1490,7 +1490,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testLanguage()
{
$form = $this->factory->createNamed('name', 'language', 'de');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LanguageType', 'de');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@ -1504,7 +1504,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testLocale()
{
$form = $this->factory->createNamed('name', 'locale', 'de_AT');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LocaleType', 'de_AT');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@ -1518,7 +1518,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testMoney()
{
$form = $this->factory->createNamed('name', 'money', 1234.56, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType', 1234.56, array(
'currency' => 'EUR',
));
@ -1542,7 +1542,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testNumber()
{
$form = $this->factory->createNamed('name', 'number', 1234.56);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\NumberType', 1234.56);
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1556,7 +1556,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testPassword()
{
$form = $this->factory->createNamed('name', 'password', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1569,7 +1569,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testPasswordSubmittedWithNotAlwaysEmpty()
{
$form = $this->factory->createNamed('name', 'password', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', null, array(
'always_empty' => false,
));
$form->submit('foo&bar');
@ -1586,7 +1586,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testPasswordWithMaxLength()
{
$form = $this->factory->createNamed('name', 'password', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@ -1602,7 +1602,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testPercent()
{
$form = $this->factory->createNamed('name', 'percent', 0.1);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PercentType', 0.1);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@ -1624,7 +1624,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testCheckedRadio()
{
$form = $this->factory->createNamed('name', 'radio', true);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', true);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@ -1648,7 +1648,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testUncheckedRadio()
{
$form = $this->factory->createNamed('name', 'radio', false);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@ -1671,7 +1671,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testRadioWithValue()
{
$form = $this->factory->createNamed('name', 'radio', false, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false, array(
'value' => 'foo&bar',
));
@ -1696,7 +1696,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testRange()
{
$form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5)));
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5)));
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1711,7 +1711,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testRangeWithMinMaxValues()
{
$form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5, 'max' => 57)));
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5, 'max' => 57)));
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1727,7 +1727,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTextarea()
{
$form = $this->factory->createNamed('name', 'textarea', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextareaType', 'foo&bar', array(
'attr' => array('pattern' => 'foo'),
));
@ -1743,7 +1743,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testText()
{
$form = $this->factory->createNamed('name', 'text', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1758,7 +1758,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTextWithMaxLength()
{
$form = $this->factory->createNamed('name', 'text', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@ -1775,7 +1775,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSearch()
{
$form = $this->factory->createNamed('name', 'search', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SearchType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -1790,7 +1790,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTime()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@ -1817,7 +1817,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTimeWithSeconds()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@ -1852,7 +1852,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTimeText()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'text',
));
@ -1885,7 +1885,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTimeSingleText()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
));
@ -1903,7 +1903,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTimeWithPlaceholderGlobal()
{
$form = $this->factory->createNamed('name', 'time', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@ -1930,7 +1930,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTimeWithPlaceholderOnYear()
{
$form = $this->factory->createNamed('name', 'time', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'required' => false,
'placeholder' => array('hour' => 'Change&Me'),
@ -1957,7 +1957,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTimezone()
{
$form = $this->factory->createNamed('name', 'timezone', 'Europe/Vienna');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', 'Europe/Vienna');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@ -1976,7 +1976,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testTimezoneWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'timezone', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', null, array(
'placeholder' => 'Select&Timezone',
'required' => false,
));
@ -1994,7 +1994,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testUrl()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
$form = $this->factory->createNamed('name', 'url', $url);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url);
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@ -2008,7 +2008,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testButton()
{
$form = $this->factory->createNamed('name', 'button');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/button[@type="button"][@name="name"][.="[trans]Name[/trans]"][@class="my&class btn"]'
@ -2017,7 +2017,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testSubmit()
{
$form = $this->factory->createNamed('name', 'submit');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/button[@type="submit"][@name="name"][@class="my&class btn"]'
@ -2026,7 +2026,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testReset()
{
$form = $this->factory->createNamed('name', 'reset');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ResetType');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/button[@type="reset"][@name="name"][@class="my&class btn"]'
@ -2035,7 +2035,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testWidgetAttributes()
{
$form = $this->factory->createNamed('text', 'text', 'value', array(
$form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'required' => true,
'disabled' => true,
'attr' => array('readonly' => true, 'maxlength' => 10, 'pattern' => '\d+', 'class' => 'foobar', 'data-foo' => 'bar'),
@ -2049,7 +2049,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testWidgetAttributeNameRepeatedIfTrue()
{
$form = $this->factory->createNamed('text', 'text', 'value', array(
$form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'attr' => array('foo' => true),
));
@ -2061,7 +2061,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testButtonAttributes()
{
$form = $this->factory->createNamed('button', 'button', null, array(
$form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'disabled' => true,
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
@ -2074,7 +2074,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
public function testButtonAttributeNameRepeatedIfTrue()
{
$form = $this->factory->createNamed('button', 'button', null, array(
$form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'attr' => array('foo' => true),
));

View File

@ -19,7 +19,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
{
public function testRow()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@ -39,7 +39,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRowOverrideVariables()
{
$view = $this->factory->createNamed('name', 'text')->createView();
$view = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType')->createView();
$html = $this->renderRow($view, array(
'attr' => array('class' => 'my&class'),
'label' => 'foo&bar',
@ -58,7 +58,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRepeatedRow()
{
$form = $this->factory->createNamed('name', 'repeated');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@ -85,7 +85,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testButtonRow()
{
$form = $this->factory->createNamed('name', 'button');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$view = $form->createView();
$html = $this->renderRow($view);
@ -101,11 +101,11 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRest()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text')
->add('field2', 'repeated')
->add('field3', 'text')
->add('field4', 'text')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->add('field3', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field4', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -142,15 +142,15 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestWithChildrenForms()
{
$child1 = $this->factory->createNamedBuilder('child1', 'form')
->add('field1', 'text')
->add('field2', 'text');
$child1 = $this->factory->createNamedBuilder('child1', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$child2 = $this->factory->createNamedBuilder('child2', 'form')
->add('field1', 'text')
->add('field2', 'text');
$child2 = $this->factory->createNamedBuilder('child2', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$view = $this->factory->createNamedBuilder('parent', 'form')
$view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($child1)
->add($child2)
->getForm()
@ -200,9 +200,9 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestAndRepeatedWithRow()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('first', 'text')
->add('password', 'repeated')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('first', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('password', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->getForm()
->createView();
@ -226,9 +226,9 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestAndRepeatedWithRowPerChild()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('first', 'text')
->add('password', 'repeated')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('first', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('password', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->getForm()
->createView();
@ -254,9 +254,9 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestAndRepeatedWithWidgetPerChild()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('first', 'text')
->add('password', 'repeated')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('first', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('password', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->getForm()
->createView();
@ -284,8 +284,8 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testCollection()
{
$form = $this->factory->createNamed('names', 'collection', array('a', 'b'), array(
'type' => 'text',
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('a', 'b'), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -306,8 +306,8 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
array('title' => 'a'),
array('title' => 'b'),
);
$form = $this->factory->createNamed('names', 'collection', $data, array(
'type' => new AlternatingRowType(),
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', $data, array(
'type' => 'Symfony\Component\Form\Tests\Fixtures\AlternatingRowType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -324,8 +324,8 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testEmptyCollection()
{
$form = $this->factory->createNamed('names', 'collection', array(), array(
'type' => 'text',
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -340,12 +340,12 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
{
$collection = $this->factory->createNamedBuilder(
'collection',
'collection',
'Symfony\Component\Form\Extension\Core\Type\CollectionType',
array('a', 'b'),
array('type' => 'text')
array('type' => 'Symfony\Component\Form\Extension\Core\Type\TextType')
);
$form = $this->factory->createNamedBuilder('form', 'form')
$form = $this->factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($collection)
->getForm();
@ -378,11 +378,11 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testForm()
{
$form = $this->factory->createNamedBuilder('name', 'form')
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->setMethod('PUT')
->setAction('http://example.com')
->add('firstName', 'text')
->add('lastName', 'text')
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
// include ampersands everywhere to validate escaping
@ -422,9 +422,9 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testFormWidget()
{
$form = $this->factory->createNamedBuilder('name', 'form')
->add('firstName', 'text')
->add('lastName', 'text')
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -450,10 +450,10 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
// https://github.com/symfony/symfony/issues/2308
public function testNestedFormError()
{
$form = $this->factory->createNamedBuilder('name', 'form')
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
->add('grandChild', 'form')
->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array('error_bubbling' => false))
->add('grandChild', 'Symfony\Component\Form\Extension\Core\Type\FormType')
)
->getForm();
@ -476,11 +476,11 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
->method('getToken')
->will($this->returnValue(new CsrfToken('token_id', 'foo&bar')));
$form = $this->factory->createNamedBuilder('name', 'form')
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
// No CSRF protection on nested forms
->createNamedBuilder('child', 'form')
->add($this->factory->createNamedBuilder('grandchild', 'text'))
->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory->createNamedBuilder('grandchild', 'Symfony\Component\Form\Extension\Core\Type\TextType'))
)
->getForm();
@ -497,8 +497,8 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRepeated()
{
$form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
'type' => 'text',
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', 'foobar', array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -523,7 +523,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRepeatedWithCustomOptions()
{
$form = $this->factory->createNamed('name', 'repeated', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
// the global required value cannot be overridden
'first_options' => array('label' => 'Test', 'required' => false),
'second_options' => array('label' => 'Test2'),
@ -551,8 +551,8 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testSearchInputName()
{
$form = $this->factory->createNamedBuilder('full', 'form')
->add('name', 'search')
$form = $this->factory->createNamedBuilder('full', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('name', 'Symfony\Component\Form\Extension\Core\Type\SearchType')
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -572,7 +572,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testLabelHasNoId()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderRow($form->createView());
$this->assertMatchesXpath($html,
@ -587,7 +587,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testLabelIsNotRenderedWhenSetToFalse()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => false,
));
$html = $this->renderRow($form->createView());
@ -608,7 +608,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testThemeBlockInheritance($theme)
{
$view = $this->factory
->createNamed('name', 'email')
->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
@ -625,11 +625,11 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
*/
public function testThemeInheritance($parentTheme, $childTheme)
{
$child = $this->factory->createNamedBuilder('child', 'form')
->add('field', 'text');
$child = $this->factory->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$view = $this->factory->createNamedBuilder('parent', 'form')
->add('field', 'text')
$view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add($child)
->getForm()
->createView()
@ -671,7 +671,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testCollectionRowWithCustomBlock()
{
$collection = array('one', 'two', 'three');
$form = $this->factory->createNamedBuilder('names', 'collection', $collection)
$form = $this->factory->createNamedBuilder('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', $collection)
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -691,7 +691,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
*/
public function testChoiceRowWithCustomBlock()
{
$form = $this->factory->createNamedBuilder('name_c', 'choice', 'a', array(
$form = $this->factory->createNamedBuilder('name_c', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', 'a', array(
'choices' => array('a' => 'ChoiceA', 'b' => 'ChoiceB'),
'expanded' => true,
))
@ -709,9 +709,9 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testFormEndWithRest()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text')
->add('field2', 'text')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -739,9 +739,9 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testFormEndWithoutRest()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text')
->add('field2', 'text')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -755,11 +755,11 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testWidgetContainerAttributes()
{
$form = $this->factory->createNamed('form', 'form', null, array(
$form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
$form->add('text', 'text');
$form->add('text', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
@ -769,7 +769,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testWidgetContainerAttributeNameRepeatedIfTrue()
{
$form = $this->factory->createNamed('form', 'form', null, array(
$form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('foo' => true),
));

View File

@ -19,14 +19,14 @@ class AbstractExtensionTest extends \PHPUnit_Framework_TestCase
public function testHasType()
{
$loader = new ConcreteExtension();
$this->assertTrue($loader->hasType('foo'));
$this->assertFalse($loader->hasType('bar'));
$this->assertTrue($loader->hasType('Symfony\Component\Form\Tests\Fixtures\FooType'));
$this->assertFalse($loader->hasType('foo'));
}
public function testGetType()
{
$loader = new ConcreteExtension();
$this->assertInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType', $loader->getType('foo'));
$this->assertInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType', $loader->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
}
}

View File

@ -126,7 +126,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabel()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$view = $form->createView();
$this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view);
@ -141,7 +141,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelWithoutTranslation()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'translation_domain' => false,
));
@ -155,7 +155,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelOnForm()
{
$form = $this->factory->createNamed('name', 'date');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType');
$view = $form->createView();
$this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view);
@ -170,7 +170,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelWithCustomTextPassedAsOption()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView());
@ -185,7 +185,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelWithCustomTextPassedDirectly()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), 'Custom label');
$this->assertMatchesXpath($html,
@ -198,7 +198,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelWithCustomTextPassedAsOptionAndDirectly()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView(), 'Overridden label');
@ -213,7 +213,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelDoesNotRenderFieldAttributes()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'attr' => array(
'class' => 'my&class',
@ -230,7 +230,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelWithCustomAttributesPassedDirectly()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'label_attr' => array(
'class' => 'my&class',
@ -247,7 +247,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), 'Custom label', array(
'label_attr' => array(
'class' => 'my&class',
@ -266,7 +266,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
// https://github.com/symfony/symfony/issues/5029
public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView(), null, array(
@ -287,7 +287,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelFormatName()
{
$form = $this->factory->createNamedBuilder('myform')
->add('myfield', 'text')
->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view, null, array('label_format' => 'form.%name%'));
@ -303,7 +303,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelFormatId()
{
$form = $this->factory->createNamedBuilder('myform')
->add('myfield', 'text')
->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view, null, array('label_format' => 'form.%id%'));
@ -320,8 +320,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
{
$options = array('label_format' => 'form.%name%');
$form = $this->factory->createNamedBuilder('myform', 'form', null, $options)
->add('myfield', 'text')
$form = $this->factory->createNamedBuilder('myform', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, $options)
->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view);
@ -338,8 +338,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
{
$options = array('label_format' => 'form.%name%');
$form = $this->factory->createNamedBuilder('myform', 'form', null, $options)
->add('myfield', 'text', array('label_format' => 'field.%name%'))
$form = $this->factory->createNamedBuilder('myform', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, $options)
->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('label_format' => 'field.%name%'))
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view);
@ -355,7 +355,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelFormatOnButton()
{
$form = $this->factory->createNamedBuilder('myform')
->add('mybutton', 'button')
->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType')
->getForm();
$view = $form->get('mybutton')->createView();
$html = $this->renderWidget($view, array('label_format' => 'form.%name%'));
@ -372,7 +372,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLabelFormatOnButtonId()
{
$form = $this->factory->createNamedBuilder('myform')
->add('mybutton', 'button')
->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType')
->getForm();
$view = $form->get('mybutton')->createView();
$html = $this->renderWidget($view, array('label_format' => 'form.%id%'));
@ -388,7 +388,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testErrors()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error 1[/trans]'));
$form->addError(new FormError('[trans]Error 2[/trans]'));
$view = $form->createView();
@ -408,7 +408,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testOverrideWidgetBlock()
{
// see custom_widgets.html.twig
$form = $this->factory->createNamed('text_id', 'text');
$form = $this->factory->createNamed('text_id', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
$this->assertMatchesXpath($html,
@ -425,7 +425,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testCheckedCheckbox()
{
$form = $this->factory->createNamed('name', 'checkbox', true);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', true);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -439,7 +439,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testUncheckedCheckbox()
{
$form = $this->factory->createNamed('name', 'checkbox', false);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -452,7 +452,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testCheckboxWithValue()
{
$form = $this->factory->createNamed('name', 'checkbox', false, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false, array(
'value' => 'foo&bar',
));
@ -467,7 +467,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoice()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@ -500,7 +500,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceWithoutTranslation()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@ -522,7 +522,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceAttributes()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@ -544,7 +544,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceWithPreferred()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@ -567,7 +567,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceWithPreferredAndNoSeparator()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@ -589,7 +589,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceWithPreferredAndBlankSeparator()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@ -612,7 +612,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testChoiceWithOnlyPreferred()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&a', '&b'),
'multiple' => false,
@ -628,7 +628,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceNonRequired()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@ -651,7 +651,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceNonRequiredNoneSelected()
{
$form = $this->factory->createNamed('name', 'choice', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@ -674,7 +674,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceNonRequiredWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@ -698,7 +698,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceRequiredWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@ -725,7 +725,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceRequiredWithPlaceholderViaView()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@ -751,7 +751,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceGrouped()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array(
'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'Group&2' => array('&c' => 'Choice&C'),
@ -781,7 +781,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMultipleChoice()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => true,
@ -804,7 +804,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMultipleChoiceAttributes()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'required' => true,
@ -828,7 +828,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMultipleChoiceSkipsPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => true,
'expanded' => false,
@ -850,7 +850,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMultipleChoiceNonRequired()
{
$form = $this->factory->createNamed('name', 'choice', array('&a'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => true,
@ -872,7 +872,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceExpanded()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -894,7 +894,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceExpandedWithoutTranslation()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -917,7 +917,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceExpandedAttributes()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@ -940,7 +940,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceExpandedWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'choice', '&a', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -965,7 +965,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSingleChoiceExpandedWithBooleanValue()
{
$form = $this->factory->createNamed('name', 'choice', true, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@ -987,7 +987,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMultipleChoiceExpanded()
{
$form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'multiple' => true,
'expanded' => true,
@ -1012,7 +1012,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMultipleChoiceExpandedWithoutTranslation()
{
$form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'multiple' => true,
'expanded' => true,
@ -1038,7 +1038,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMultipleChoiceExpandedAttributes()
{
$form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => true,
@ -1064,7 +1064,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testCountry()
{
$form = $this->factory->createNamed('name', 'country', 'AT');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@ -1077,7 +1077,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testCountryWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'country', 'AT', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT', array(
'placeholder' => 'Select&Country',
'required' => false,
));
@ -1094,7 +1094,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTime()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@ -1133,7 +1133,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTimeWithPlaceholderGlobal()
{
$form = $this->factory->createNamed('name', 'datetime', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@ -1175,7 +1175,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
{
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
$form = $this->factory->createNamed('name', 'datetime', $data, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array(
'input' => 'array',
'required' => false,
));
@ -1214,7 +1214,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTimeWithSeconds()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@ -1256,7 +1256,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTimeSingleText()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'single_text',
'time_widget' => 'single_text',
@ -1282,7 +1282,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTimeWithWidgetSingleText()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
'model_timezone' => 'UTC',
@ -1300,7 +1300,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
{
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'choice',
'time_widget' => 'choice',
@ -1320,7 +1320,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateChoice()
{
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'choice',
));
@ -1345,7 +1345,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateChoiceWithPlaceholderGlobal()
{
$form = $this->factory->createNamed('name', 'date', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'placeholder' => 'Change&Me',
@ -1372,7 +1372,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateChoiceWithPlaceholderOnYear()
{
$form = $this->factory->createNamed('name', 'date', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'required' => false,
@ -1399,7 +1399,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateText()
{
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'text',
));
@ -1427,7 +1427,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateSingleText()
{
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'single_text',
));
@ -1443,8 +1443,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDateErrorBubbling()
{
$form = $this->factory->createNamedBuilder('form', 'form')
->add('date', 'date')
$form = $this->factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('date', 'Symfony\Component\Form\Extension\Core\Type\DateType')
->getForm();
$form->get('date')->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
@ -1455,7 +1455,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testBirthDay()
{
$form = $this->factory->createNamed('name', 'birthday', '2000-02-03', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '2000-02-03', array(
'input' => 'string',
));
@ -1479,7 +1479,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testBirthDayWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'birthday', '1950-01-01', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '1950-01-01', array(
'input' => 'string',
'placeholder' => '',
'required' => false,
@ -1508,7 +1508,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testEmail()
{
$form = $this->factory->createNamed('name', 'email', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1522,7 +1522,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testEmailWithMaxLength()
{
$form = $this->factory->createNamed('name', 'email', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@ -1538,7 +1538,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testFile()
{
$form = $this->factory->createNamed('name', 'file');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\FileType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1549,7 +1549,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testHidden()
{
$form = $this->factory->createNamed('name', 'hidden', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\HiddenType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1565,7 +1565,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
*/
public function testLegacyReadOnly()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'read_only' => true,
));
@ -1580,7 +1580,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testDisabled()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'disabled' => true,
));
@ -1595,7 +1595,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testInteger()
{
$form = $this->factory->createNamed('name', 'integer', 123);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\IntegerType', 123);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1608,7 +1608,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLanguage()
{
$form = $this->factory->createNamed('name', 'language', 'de');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LanguageType', 'de');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@ -1621,7 +1621,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testLocale()
{
$form = $this->factory->createNamed('name', 'locale', 'de_AT');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LocaleType', 'de_AT');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@ -1634,7 +1634,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testMoney()
{
$form = $this->factory->createNamed('name', 'money', 1234.56, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType', 1234.56, array(
'currency' => 'EUR',
));
@ -1650,7 +1650,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testNumber()
{
$form = $this->factory->createNamed('name', 'number', 1234.56);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\NumberType', 1234.56);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1663,7 +1663,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testPassword()
{
$form = $this->factory->createNamed('name', 'password', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1675,7 +1675,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testPasswordSubmittedWithNotAlwaysEmpty()
{
$form = $this->factory->createNamed('name', 'password', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', null, array(
'always_empty' => false,
));
$form->submit('foo&bar');
@ -1691,7 +1691,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testPasswordWithMaxLength()
{
$form = $this->factory->createNamed('name', 'password', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@ -1706,7 +1706,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testPercent()
{
$form = $this->factory->createNamed('name', 'percent', 0.1);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PercentType', 0.1);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1720,7 +1720,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testCheckedRadio()
{
$form = $this->factory->createNamed('name', 'radio', true);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', true);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1734,7 +1734,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testUncheckedRadio()
{
$form = $this->factory->createNamed('name', 'radio', false);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1747,7 +1747,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testRadioWithValue()
{
$form = $this->factory->createNamed('name', 'radio', false, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false, array(
'value' => 'foo&bar',
));
@ -1762,7 +1762,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testRange()
{
$form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5)));
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5)));
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1776,7 +1776,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testRangeWithMinMaxValues()
{
$form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5, 'max' => 57)));
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5, 'max' => 57)));
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1791,7 +1791,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTextarea()
{
$form = $this->factory->createNamed('name', 'textarea', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextareaType', 'foo&bar', array(
'attr' => array('pattern' => 'foo'),
));
@ -1806,7 +1806,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testText()
{
$form = $this->factory->createNamed('name', 'text', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1820,7 +1820,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTextWithMaxLength()
{
$form = $this->factory->createNamed('name', 'text', 'foo&bar', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@ -1836,7 +1836,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testSearch()
{
$form = $this->factory->createNamed('name', 'search', 'foo&bar');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SearchType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -1850,7 +1850,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTime()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@ -1874,7 +1874,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimeWithSeconds()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@ -1905,7 +1905,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimeText()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'text',
));
@ -1935,7 +1935,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimeSingleText()
{
$form = $this->factory->createNamed('name', 'time', '04:05:06', array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
));
@ -1952,7 +1952,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimeWithPlaceholderGlobal()
{
$form = $this->factory->createNamed('name', 'time', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@ -1977,7 +1977,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimeWithPlaceholderOnYear()
{
$form = $this->factory->createNamed('name', 'time', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'required' => false,
'placeholder' => array('hour' => 'Change&Me'),
@ -2002,8 +2002,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimeErrorBubbling()
{
$form = $this->factory->createNamedBuilder('form', 'form')
->add('time', 'time')
$form = $this->factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('time', 'Symfony\Component\Form\Extension\Core\Type\TimeType')
->getForm();
$form->get('time')->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
@ -2014,7 +2014,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimezone()
{
$form = $this->factory->createNamed('name', 'timezone', 'Europe/Vienna');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', 'Europe/Vienna');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@ -2032,7 +2032,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTimezoneWithPlaceholder()
{
$form = $this->factory->createNamed('name', 'timezone', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', null, array(
'placeholder' => 'Select&Timezone',
'required' => false,
));
@ -2049,7 +2049,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testUrl()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
$form = $this->factory->createNamed('name', 'url', $url);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@ -2062,8 +2062,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testCollectionPrototype()
{
$form = $this->factory->createNamedBuilder('name', 'form', array('items' => array('one', 'two', 'three')))
->add('items', 'collection', array('allow_add' => true))
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType', array('items' => array('one', 'two', 'three')))
->add('items', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('allow_add' => true))
->getForm()
->createView();
@ -2078,8 +2078,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testEmptyRootFormName()
{
$form = $this->factory->createNamedBuilder('', 'form')
->add('child', 'text')
$form = $this->factory->createNamedBuilder('', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('child', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$this->assertMatchesXpath($this->renderWidget($form->createView()),
@ -2090,7 +2090,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testButton()
{
$form = $this->factory->createNamed('name', 'button');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/button[@type="button"][@name="name"][.="[trans]Name[/trans]"]'
@ -2099,14 +2099,14 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testButtonLabelIsEmpty()
{
$form = $this->factory->createNamed('name', 'button');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$this->assertSame('', $this->renderLabel($form->createView()));
}
public function testSubmit()
{
$form = $this->factory->createNamed('name', 'submit');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/button[@type="submit"][@name="name"]'
@ -2115,7 +2115,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testReset()
{
$form = $this->factory->createNamed('name', 'reset');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ResetType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/button[@type="reset"][@name="name"]'
@ -2124,7 +2124,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testStartTag()
{
$form = $this->factory->create('form', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'get',
'action' => 'http://example.com/directory',
));
@ -2136,7 +2136,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testStartTagForPutRequest()
{
$form = $this->factory->create('form', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'put',
'action' => 'http://example.com/directory',
));
@ -2153,7 +2153,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testStartTagWithOverriddenVars()
{
$form = $this->factory->create('form', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'put',
'action' => 'http://example.com/directory',
));
@ -2168,11 +2168,11 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testStartTagForMultipartForm()
{
$form = $this->factory->createBuilder('form', null, array(
$form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'get',
'action' => 'http://example.com/directory',
))
->add('file', 'file')
->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType')
->getForm();
$html = $this->renderStart($form->createView());
@ -2182,7 +2182,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testStartTagWithExtraAttributes()
{
$form = $this->factory->create('form', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'get',
'action' => 'http://example.com/directory',
));
@ -2196,7 +2196,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testWidgetAttributes()
{
$form = $this->factory->createNamed('text', 'text', 'value', array(
$form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'required' => true,
'disabled' => true,
'attr' => array('readonly' => true, 'maxlength' => 10, 'pattern' => '\d+', 'class' => 'foobar', 'data-foo' => 'bar'),
@ -2210,7 +2210,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testWidgetAttributeNameRepeatedIfTrue()
{
$form = $this->factory->createNamed('text', 'text', 'value', array(
$form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'attr' => array('foo' => true),
));
@ -2222,7 +2222,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testWidgetAttributeHiddenIfFalse()
{
$form = $this->factory->createNamed('text', 'text', 'value', array(
$form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'attr' => array('foo' => false),
));
@ -2233,7 +2233,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testButtonAttributes()
{
$form = $this->factory->createNamed('button', 'button', null, array(
$form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'disabled' => true,
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
@ -2246,7 +2246,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testButtonAttributeNameRepeatedIfTrue()
{
$form = $this->factory->createNamed('button', 'button', null, array(
$form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'attr' => array('foo' => true),
));
@ -2258,7 +2258,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testButtonAttributeHiddenIfFalse()
{
$form = $this->factory->createNamed('button', 'button', null, array(
$form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'attr' => array('foo' => false),
));
@ -2269,7 +2269,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTextareaWithWhitespaceOnlyContentRetainsValue()
{
$form = $this->factory->createNamed('textarea', 'textarea', ' ');
$form = $this->factory->createNamed('textarea', 'Symfony\Component\Form\Extension\Core\Type\TextareaType', ' ');
$html = $this->renderWidget($form->createView());
@ -2278,8 +2278,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTextareaWithWhitespaceOnlyContentRetainsValueWhenRenderingForm()
{
$form = $this->factory->createBuilder('form', array('textarea' => ' '))
->add('textarea', 'textarea')
$form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array('textarea' => ' '))
->add('textarea', 'Symfony\Component\Form\Extension\Core\Type\TextareaType')
->getForm();
$html = $this->renderForm($form->createView());
@ -2289,7 +2289,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testWidgetContainerAttributeHiddenIfFalse()
{
$form = $this->factory->createNamed('form', 'form', null, array(
$form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('foo' => false),
));
@ -2301,9 +2301,9 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
public function testTranslatedAttributes()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('firstName', 'text', array('attr' => array('title' => 'Foo')))
->add('lastName', 'text', array('attr' => array('placeholder' => 'Bar')))
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('attr' => array('title' => 'Foo')))
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('attr' => array('placeholder' => 'Bar')))
->getForm()
->createView();

View File

@ -323,7 +323,7 @@ abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($iniMax));
$options = array('post_max_size_message' => 'Max {{ max }}!');
$form = $this->factory->createNamed('name', 'text', null, $options);
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, $options);
$this->setRequestData('POST', array(), array());
$this->requestHandler->handleRequest($form, $this->request);

View File

@ -18,7 +18,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
{
public function testRow()
{
$form = $this->factory->createNamed('name', 'text');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@ -42,7 +42,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testLabelIsNotRenderedWhenSetToFalse()
{
$form = $this->factory->createNamed('name', 'text', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => false,
));
$html = $this->renderRow($form->createView());
@ -61,7 +61,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeatedRow()
{
$form = $this->factory->createNamed('name', 'repeated');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType');
$html = $this->renderRow($form->createView());
$this->assertMatchesXpath($html,
@ -91,7 +91,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeatedRowWithErrors()
{
$form = $this->factory->createNamed('name', 'repeated');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@ -128,7 +128,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testButtonRow()
{
$form = $this->factory->createNamed('name', 'button');
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$view = $form->createView();
$html = $this->renderRow($view);
@ -147,11 +147,11 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRest()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text')
->add('field2', 'repeated')
->add('field3', 'text')
->add('field4', 'text')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->add('field3', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field4', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -194,8 +194,8 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testCollection()
{
$form = $this->factory->createNamed('names', 'collection', array('a', 'b'), array(
'type' => 'text',
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('a', 'b'), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -212,8 +212,8 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testEmptyCollection()
{
$form = $this->factory->createNamed('names', 'collection', array(), array(
'type' => 'text',
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -226,11 +226,11 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testForm()
{
$view = $this->factory->createNamedBuilder('name', 'form')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->setMethod('PUT')
->setAction('http://example.com')
->add('firstName', 'text')
->add('lastName', 'text')
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -278,9 +278,9 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testFormWidget()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('firstName', 'text')
->add('lastName', 'text')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -315,10 +315,10 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
// https://github.com/symfony/symfony/issues/2308
public function testNestedFormError()
{
$form = $this->factory->createNamedBuilder('name', 'form')
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
->add('grandChild', 'form')
->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array('error_bubbling' => false))
->add('grandChild', 'Symfony\Component\Form\Extension\Core\Type\FormType')
)
->getForm();
@ -341,11 +341,11 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
->method('getToken')
->will($this->returnValue(new CsrfToken('token_id', 'foo&bar')));
$form = $this->factory->createNamedBuilder('name', 'form')
$form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
// No CSRF protection on nested forms
->createNamedBuilder('child', 'form')
->add($this->factory->createNamedBuilder('grandchild', 'text'))
->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory->createNamedBuilder('grandchild', 'Symfony\Component\Form\Extension\Core\Type\TextType'))
)
->getForm();
@ -365,8 +365,8 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeated()
{
$form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
'type' => 'text',
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', 'foobar', array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -399,8 +399,8 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeatedWithCustomOptions()
{
$form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
'type' => 'password',
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', 'foobar', array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\PasswordType',
'first_options' => array('label' => 'Test', 'required' => false),
'second_options' => array('label' => 'Test2'),
));
@ -440,7 +440,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testCollectionRowWithCustomBlock()
{
$collection = array('one', 'two', 'three');
$form = $this->factory->createNamedBuilder('names', 'collection', $collection)
$form = $this->factory->createNamedBuilder('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', $collection)
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@ -456,9 +456,9 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testFormEndWithRest()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text')
->add('field2', 'text')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -494,9 +494,9 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testFormEndWithoutRest()
{
$view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text')
->add('field2', 'text')
$view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@ -510,11 +510,11 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testWidgetContainerAttributes()
{
$form = $this->factory->createNamed('form', 'form', null, array(
$form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
$form->add('text', 'text');
$form->add('text', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
@ -524,7 +524,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testWidgetContainerAttributeNameRepeatedIfTrue()
{
$form = $this->factory->createNamed('form', 'form', null, array(
$form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('foo' => true),
));

View File

@ -26,16 +26,16 @@ class CompoundFormPerformanceTest extends \Symfony\Component\Form\Test\FormPerfo
$this->setMaxRunningTime(1);
for ($i = 0; $i < 40; ++$i) {
$form = $this->factory->createBuilder('form')
->add('firstName', 'text')
->add('lastName', 'text')
->add('gender', 'choice', array(
$form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add('gender', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
'choices' => array('male' => 'Male', 'female' => 'Female'),
'required' => false,
))
->add('age', 'number')
->add('birthDate', 'birthday')
->add('city', 'choice', array(
->add('age', 'Symfony\Component\Form\Extension\Core\Type\NumberType')
->add('birthDate', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType')
->add('city', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
// simulate 300 different cities
'choices' => range(1, 300),
))

View File

@ -110,7 +110,7 @@ class CompoundFormTest extends AbstractFormTest
$factory = Forms::createFormFactoryBuilder()
->getFormFactory();
$child = $factory->create('file', null, array('auto_initialize' => false));
$child = $factory->createNamed('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', null, array('auto_initialize' => false));
$this->form->add($child);
$this->form->submit(array('file' => null), false);

View File

@ -166,9 +166,11 @@ class DateTimeToLocalizedStringTransformerTest extends DateTimeTestCase
{
$transformer = new DateTimeToLocalizedStringTransformer();
$this->markTestIncomplete('Checking for intl errors needs to be reimplemented');
// HOW TO REPRODUCE?
//$this->setExpectedException('Symfony\Component\Form\Extension\Core\DataTransformer\Transdate_formationFailedException');
//$this->setExpectedException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
//$transformer->transform(1.5);
}

View File

@ -20,10 +20,7 @@ class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
{
parent::setUp();
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
\Locale::setDefault('en');
}
public function transformWithRoundingProvider()
@ -89,6 +86,11 @@ class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new IntegerToLocalizedStringTransformer();
$this->assertEquals(1, $transformer->reverseTransform('1'));
@ -106,6 +108,11 @@ class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
public function testReverseTransformWithGrouping()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new IntegerToLocalizedStringTransformer(null, true);
$this->assertEquals(1234, $transformer->reverseTransform('1.234,5'));

View File

@ -16,18 +16,13 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
public function testTransform()
{
parent::setUp();
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
}
public function testTransform()
{
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
$this->assertEquals('1,23', $transformer->transform(123));
@ -51,6 +46,11 @@ class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
$this->assertEquals(123, $transformer->reverseTransform('1,23'));

View File

@ -20,10 +20,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
{
parent::setUp();
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
\Locale::setDefault('en');
}
public function provideTransformations()
@ -44,6 +41,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testTransform($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault($locale);
$transformer = new NumberToLocalizedStringTransformer();
@ -67,6 +67,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testTransformWithGrouping($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault($locale);
$transformer = new NumberToLocalizedStringTransformer(null, true);
@ -76,6 +79,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new NumberToLocalizedStringTransformer(2);
$this->assertEquals('1234,50', $transformer->transform(1234.5));
@ -84,6 +92,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function transformWithRoundingProvider()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
return array(
// towards positive infinity (1.6 -> 2, -1.6 -> -1)
array(0, 1234.5, '1235', NumberToLocalizedStringTransformer::ROUND_CEILING),
@ -183,6 +196,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testTransformDoesNotRoundIfNoScale()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new NumberToLocalizedStringTransformer(null, null, NumberToLocalizedStringTransformer::ROUND_DOWN);
$this->assertEquals('1234,547', $transformer->transform(1234.547));
@ -193,6 +211,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testReverseTransform($to, $from, $locale)
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault($locale);
$transformer = new NumberToLocalizedStringTransformer();
@ -205,6 +226,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testReverseTransformWithGrouping($to, $from, $locale)
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault($locale);
$transformer = new NumberToLocalizedStringTransformer(null, true);
@ -219,6 +243,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('The "mbstring" extension is required for this test.');
}
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('ru');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@ -228,6 +255,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testReverseTransformWithGroupingButWithoutGroupSeparator()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new NumberToLocalizedStringTransformer(null, true);
// omit group separator
@ -343,6 +375,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@ -360,6 +395,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new NumberToLocalizedStringTransformer(null, true);
$transformer->reverseTransform('1.234.5');
@ -370,6 +410,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new NumberToLocalizedStringTransformer(null, true);
$transformer->reverseTransform('1234.5');
@ -377,6 +422,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer();
@ -386,6 +434,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('bg');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@ -403,7 +454,6 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
{
\Locale::setDefault('en');
$transformer = new NumberToLocalizedStringTransformer(null, true);
$transformer->reverseTransform('1,234,5');
@ -414,7 +464,6 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
*/
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
{
\Locale::setDefault('en');
$transformer = new NumberToLocalizedStringTransformer(null, true);
$transformer->reverseTransform('1234,5');
@ -422,7 +471,6 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGroupingUsed()
{
\Locale::setDefault('en');
$transformer = new NumberToLocalizedStringTransformer();
$this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
@ -542,6 +590,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('The "mbstring" extension is required for this test.');
}
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('ru');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@ -559,6 +610,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('The "mbstring" extension is required for this test.');
}
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('ru');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@ -587,6 +641,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('The "mbstring" extension is required for this test.');
}
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('ru');
$transformer = new NumberToLocalizedStringTransformer(null, true);

View File

@ -20,10 +20,7 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
{
parent::setUp();
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
\Locale::setDefault('en');
}
public function testTransform()
@ -55,6 +52,11 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
public function testTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new PercentToLocalizedStringTransformer(2);
$this->assertEquals('12,34', $transformer->transform(0.1234));
@ -89,6 +91,11 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
public function testReverseTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new PercentToLocalizedStringTransformer(2);
$this->assertEquals(0.1234, $transformer->reverseTransform('12,34'));

View File

@ -45,7 +45,7 @@ abstract class BaseTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassIdAndNameToViewWithParent()
{
$view = $this->factory->createNamedBuilder('parent', 'form')
$view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('child', $this->getTestedType())
->getForm()
->createView();
@ -57,8 +57,8 @@ abstract class BaseTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassIdAndNameToViewWithGrandParent()
{
$builder = $this->factory->createNamedBuilder('parent', 'form')
->add('child', 'form');
$builder = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType');
$builder->get('child')->add('grand_child', $this->getTestedType());
$view = $builder->getForm()->createView();
@ -80,7 +80,7 @@ abstract class BaseTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testInheritTranslationDomainFromParent()
{
$view = $this->factory
->createNamedBuilder('parent', 'form', null, array(
->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'translation_domain' => 'domain',
))
->add('child', $this->getTestedType())
@ -93,7 +93,7 @@ abstract class BaseTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPreferOwnTranslationDomain()
{
$view = $this->factory
->createNamedBuilder('parent', 'form', null, array(
->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'translation_domain' => 'parent_domain',
))
->add('child', $this->getTestedType(), array(
@ -107,7 +107,7 @@ abstract class BaseTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testDefaultTranslationDomain()
{
$view = $this->factory->createNamedBuilder('parent', 'form')
$view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('child', $this->getTestedType())
->getForm()
->createView();

View File

@ -16,18 +16,28 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
*/
class BirthdayTypeTest extends BaseTypeTest
{
/**
* @group legacy
*/
public function testLegacyName()
{
$form = $this->factory->create('birthday');
$this->assertSame('birthday', $form->getConfig()->getType()->getName());
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testSetInvalidYearsOption()
{
$this->factory->create('birthday', null, array(
$this->factory->create('Symfony\Component\Form\Extension\Core\Type\BirthdayType', null, array(
'years' => 'bad value',
));
}
protected function getTestedType()
{
return 'birthday';
return 'Symfony\Component\Form\Extension\Core\Type\BirthdayType';
}
}

View File

@ -16,13 +16,23 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
*/
class ButtonTypeTest extends BaseTypeTest
{
/**
* @group legacy
*/
public function testLegacyName()
{
$form = $this->factory->create('button');
$this->assertSame('button', $form->getConfig()->getType()->getName());
}
public function testCreateButtonInstances()
{
$this->assertInstanceOf('Symfony\Component\Form\Button', $this->factory->create('button'));
$this->assertInstanceOf('Symfony\Component\Form\Button', $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ButtonType'));
}
protected function getTestedType()
{
return 'button';
return 'Symfony\Component\Form\Extension\Core\Type\ButtonType';
}
}

View File

@ -15,10 +15,20 @@ use Symfony\Component\Form\CallbackTransformer;
class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
{
public function testDataIsFalseByDefault()
/**
* @group legacy
*/
public function testLegacyName()
{
$form = $this->factory->create('checkbox');
$this->assertSame('checkbox', $form->getConfig()->getType()->getName());
}
public function testDataIsFalseByDefault()
{
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$this->assertFalse($form->getData());
$this->assertFalse($form->getNormData());
$this->assertNull($form->getViewData());
@ -26,7 +36,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassValueToView()
{
$form = $this->factory->create('checkbox', null, array('value' => 'foobar'));
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array('value' => 'foobar'));
$view = $form->createView();
$this->assertEquals('foobar', $view->vars['value']);
@ -34,7 +44,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testCheckedIfDataTrue()
{
$form = $this->factory->create('checkbox');
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$form->setData(true);
$view = $form->createView();
@ -43,7 +53,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testCheckedIfDataTrueWithEmptyValue()
{
$form = $this->factory->create('checkbox', null, array('value' => ''));
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array('value' => ''));
$form->setData(true);
$view = $form->createView();
@ -52,7 +62,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testNotCheckedIfDataFalse()
{
$form = $this->factory->create('checkbox');
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$form->setData(false);
$view = $form->createView();
@ -61,7 +71,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitWithValueChecked()
{
$form = $this->factory->create('checkbox', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => 'foobar',
));
$form->submit('foobar');
@ -72,7 +82,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitWithRandomValueChecked()
{
$form = $this->factory->create('checkbox', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => 'foobar',
));
$form->submit('krixikraxi');
@ -83,7 +93,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitWithValueUnchecked()
{
$form = $this->factory->create('checkbox', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => 'foobar',
));
$form->submit(null);
@ -94,7 +104,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitWithEmptyValueChecked()
{
$form = $this->factory->create('checkbox', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit('');
@ -105,7 +115,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitWithEmptyValueUnchecked()
{
$form = $this->factory->create('checkbox', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit(null);
@ -116,7 +126,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitWithEmptyValueAndFalseUnchecked()
{
$form = $this->factory->create('checkbox', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit(false);
@ -127,7 +137,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitWithEmptyValueAndTrueChecked()
{
$form = $this->factory->create('checkbox', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit(true);
@ -151,7 +161,7 @@ class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
}
);
$form = $this->factory->createBuilder('checkbox')
$form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\CheckboxType')
->addModelTransformer($transformer)
->getForm();

View File

@ -30,7 +30,7 @@ class ChoiceTypePerformanceTest extends FormPerformanceTestCase
$choices = range(1, 300);
for ($i = 0; $i < 100; ++$i) {
$this->factory->create('choice', mt_rand(1, 400), array(
$this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', mt_rand(1, 400), array(
'choices' => $choices,
));
}

View File

@ -67,12 +67,22 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->objectChoices = null;
}
/**
* @group legacy
*/
public function testLegacyName()
{
$form = $this->factory->create('choice');
$this->assertSame('choice', $form->getConfig()->getType()->getName());
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testChoicesOptionExpectsArrayOrTraversable()
{
$this->factory->create('choice', null, array(
$this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => new \stdClass(),
));
}
@ -82,7 +92,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testChoiceListOptionExpectsChoiceListInterface()
{
$this->factory->create('choice', null, array(
$this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choice_list' => array('foo' => 'foo'),
));
}
@ -92,19 +102,19 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testChoiceLoaderOptionExpectsChoiceLoaderInterface()
{
$this->factory->create('choice', null, array(
$this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choice_loader' => new \stdClass(),
));
}
public function testChoiceListAndChoicesCanBeEmpty()
{
$this->factory->create('choice');
$this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType');
}
public function testExpandedChoicesOptionsTurnIntoChildren()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => $this->choices,
));
@ -114,7 +124,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPlaceholderPresentOnNonRequiredExpandedSingleChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -127,7 +137,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPlaceholderNotPresentIfRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -140,7 +150,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPlaceholderNotPresentIfMultiple()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'required' => false,
@ -153,7 +163,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPlaceholderNotPresentIfEmptyChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -169,7 +179,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testExpandedChoicesOptionsAreFlattened()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => $this->groupedChoices,
));
@ -194,7 +204,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$obj4 = (object) array('id' => 4, 'name' => 'Jon');
$obj5 = (object) array('id' => 5, 'name' => 'Roman');
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => array(
'Symfony' => array($obj1, $obj2, $obj3),
@ -214,7 +224,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testExpandedCheckboxesAreNeverRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'required' => true,
@ -228,7 +238,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testExpandedRadiosAreRequiredIfChoiceChildIsRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -242,7 +252,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testExpandedRadiosAreNotRequiredIfChoiceChildIsNotRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -256,7 +266,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleNonExpanded()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@ -271,7 +281,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleNonExpandedInvalidChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@ -286,7 +296,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleNonExpandedNull()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@ -304,7 +314,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleNonExpandedNullNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(),
@ -319,7 +329,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleNonExpandedEmpty()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@ -334,7 +344,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleNonExpandedEmptyExplicitEmptyChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(
@ -357,7 +367,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleNonExpandedEmptyNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(),
@ -372,7 +382,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleNonExpandedFalse()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@ -390,7 +400,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleNonExpandedFalseNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(),
@ -405,7 +415,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleNonExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->objectChoices,
@ -427,7 +437,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testLegacySubmitSingleNonExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choice_list' => new ObjectChoiceList(
@ -451,7 +461,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleNonExpanded()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@ -466,7 +476,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleNonExpandedEmpty()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@ -484,7 +494,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitMultipleNonExpandedEmptyNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => array(),
@ -499,7 +509,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleNonExpandedInvalidScalarChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@ -514,7 +524,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleNonExpandedInvalidArrayChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@ -529,7 +539,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleNonExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->objectChoices,
@ -550,7 +560,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testLegacySubmitMultipleNonExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choice_list' => new ObjectChoiceList(
@ -573,7 +583,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -601,7 +611,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedRequiredInvalidChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -629,7 +639,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedNonRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -659,7 +669,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedNonRequiredInvalidChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -687,7 +697,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedRequiredNull()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -718,7 +728,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleExpandedRequiredNullNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -735,7 +745,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedRequiredEmpty()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -766,7 +776,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleExpandedRequiredEmptyNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -783,7 +793,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedRequiredFalse()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -814,7 +824,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleExpandedRequiredFalseNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@ -831,7 +841,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedNonRequiredNull()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -864,7 +874,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleExpandedNonRequiredNullNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -881,7 +891,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedNonRequiredEmpty()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -914,7 +924,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleExpandedNonRequiredEmptyNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -931,7 +941,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedNonRequiredFalse()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -964,7 +974,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitSingleExpandedNonRequiredFalseNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@ -981,7 +991,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedWithEmptyChild()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choices' => array(
@ -1003,7 +1013,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choices' => $this->objectChoices,
@ -1034,7 +1044,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testLegacySubmitSingleExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choice_list' => new ObjectChoiceList(
@ -1067,7 +1077,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitSingleExpandedNumericChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choices' => $this->numericChoices,
@ -1092,7 +1102,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleExpanded()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@ -1119,7 +1129,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleExpandedInvalidScalarChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@ -1146,7 +1156,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleExpandedInvalidArrayChoice()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@ -1173,7 +1183,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleExpandedEmpty()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@ -1201,7 +1211,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// choices are available.
public function testSubmitMultipleExpandedEmptyNoChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => array(),
@ -1215,7 +1225,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleExpandedWithEmptyChild()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => array(
@ -1240,7 +1250,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->objectChoices,
@ -1271,7 +1281,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testLegacySubmitMultipleExpandedObjectChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choice_list' => new ObjectChoiceList(
@ -1304,7 +1314,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSubmitMultipleExpandedNumericChoices()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->numericChoices,
@ -1333,7 +1343,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testSetDataSingleNonExpandedAcceptsBoolean()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->numericChoices,
@ -1348,7 +1358,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSetDataMultipleNonExpandedAcceptsBoolean()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->numericChoices,
@ -1363,7 +1373,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassRequiredToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
));
$view = $form->createView();
@ -1373,7 +1383,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassNonRequiredToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'required' => false,
'choices' => $this->choices,
));
@ -1384,7 +1394,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassMultipleToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'choices' => $this->choices,
));
@ -1395,7 +1405,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassExpandedToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => $this->choices,
));
@ -1406,7 +1416,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassChoiceTranslationDomainToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
));
$view = $form->createView();
@ -1416,7 +1426,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testChoiceTranslationDomainWithTrueValueToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
'choice_translation_domain' => true,
));
@ -1427,7 +1437,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testDefaultChoiceTranslationDomainIsSameAsTranslationDomainToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
'translation_domain' => 'foo',
));
@ -1439,10 +1449,10 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testInheritChoiceTranslationDomainFromParent()
{
$view = $this->factory
->createNamedBuilder('parent', 'form', null, array(
->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'translation_domain' => 'domain',
))
->add('child', 'choice')
->add('child', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType')
->getForm()
->createView();
@ -1451,7 +1461,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPlaceholderIsNullByDefaultIfRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'required' => true,
'choices' => $this->choices,
@ -1463,7 +1473,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPlaceholderIsEmptyStringByDefaultIfNotRequired()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'required' => false,
'choices' => $this->choices,
@ -1478,7 +1488,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testPassPlaceholderToView($multiple, $expanded, $required, $placeholder, $viewValue)
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => $multiple,
'expanded' => $expanded,
'required' => $required,
@ -1496,7 +1506,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testPassEmptyValueBC($multiple, $expanded, $required, $placeholder, $viewValue)
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => $multiple,
'expanded' => $expanded,
'required' => $required,
@ -1516,7 +1526,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
*/
public function testDontPassPlaceholderIfContainedInChoices($multiple, $expanded, $required, $placeholder, $viewValue)
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => $multiple,
'expanded' => $expanded,
'required' => $required,
@ -1576,7 +1586,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassChoicesToView()
{
$choices = array('a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D');
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $choices,
));
$view = $form->createView();
@ -1592,7 +1602,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassPreferredChoicesToView()
{
$choices = array('a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D');
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $choices,
'preferred_choices' => array('b', 'd'),
));
@ -1610,7 +1620,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPassHierarchicalChoicesToView()
{
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->groupedChoices,
'preferred_choices' => array('b', 'd'),
));
@ -1641,7 +1651,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$obj2 = (object) array('value' => 'b', 'label' => 'B');
$obj3 = (object) array('value' => 'c', 'label' => 'C');
$obj4 = (object) array('value' => 'd', 'label' => 'D');
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array($obj1, $obj2, $obj3, $obj4),
'choices_as_values' => true,
'choice_label' => 'label',
@ -1659,7 +1669,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testAdjustFullNameForMultipleNonExpanded()
{
$form = $this->factory->createNamed('name', 'choice', null, array(
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@ -1672,7 +1682,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// https://github.com/symfony/symfony/issues/3298
public function testInitializeWithEmptyChoices()
{
$this->factory->createNamed('name', 'choice', null, array(
$this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array(),
));
}
@ -1684,7 +1694,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$obj3 = (object) array('value' => 'c', 'label' => 'C');
$obj4 = (object) array('value' => 'd', 'label' => 'D');
$form = $this->factory->create('choice', null, array(
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array($obj1, $obj2, $obj3, $obj4),
'choices_as_values' => true,
'choice_label' => 'label',

View File

@ -17,10 +17,22 @@ use Symfony\Component\Form\Tests\Fixtures\AuthorType;
class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
{
/**
* @group legacy
*/
public function testLegacyName()
{
$form = $this->factory->create('collection', array(
'type' => 'text',
));
$this->assertSame('collection', $form->getConfig()->getType()->getName());
}
public function testContainsNoChildByDefault()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertCount(0, $form);
@ -28,8 +40,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testSetDataAdjustsSize()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'options' => array(
'attr' => array('maxlength' => 20),
),
@ -57,8 +69,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testThrowsExceptionIfObjectIsNotTraversable()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$form->setData(new \stdClass());
@ -66,8 +78,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testNotResizedIfSubmittedWithMissingData()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$form->setData(array('foo@foo.com', 'bar@bar.com'));
$form->submit(array('foo@bar.com'));
@ -80,8 +92,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testResizedDownIfSubmittedWithMissingDataAndAllowDelete()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_delete' => true,
));
$form->setData(array('foo@foo.com', 'bar@bar.com'));
@ -95,8 +107,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testResizedDownIfSubmittedWithEmptyDataAndDeleteEmpty()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_delete' => true,
'delete_empty' => true,
));
@ -112,8 +124,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testDontAddEmptyDataIfDeleteEmpty()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_add' => true,
'delete_empty' => true,
));
@ -129,8 +141,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testNoDeleteEmptyIfDeleteNotAllowed()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_delete' => false,
'delete_empty' => true,
));
@ -144,8 +156,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testResizedDownIfSubmittedWithCompoundEmptyDataAndDeleteEmpty()
{
$form = $this->factory->create('collection', null, array(
'type' => new AuthorType(),
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Tests\Fixtures\AuthorType',
// If the field is not required, no new Author will be created if the
// form is completely empty
'options' => array('required' => false),
@ -167,8 +179,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testNotResizedIfSubmittedWithExtraData()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$form->setData(array('foo@bar.com'));
$form->submit(array('foo@foo.com', 'bar@bar.com'));
@ -180,8 +192,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testResizedUpIfSubmittedWithExtraDataAndAllowAdd()
{
$form = $this->factory->create('collection', null, array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_add' => true,
));
$form->setData(array('foo@bar.com'));
@ -196,8 +208,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testAllowAddButNoPrototype()
{
$form = $this->factory->create('collection', null, array(
'type' => 'form',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
'allow_add' => true,
'prototype' => false,
));
@ -208,8 +220,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPrototypeMultipartPropagation()
{
$form = $this->factory
->create('collection', null, array(
'type' => 'file',
->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'allow_add' => true,
'prototype' => true,
))
@ -220,8 +232,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testGetDataDoesNotContainsPrototypeNameBeforeDataAreSet()
{
$form = $this->factory->create('collection', array(), array(
'type' => 'file',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'prototype' => true,
'allow_add' => true,
));
@ -232,8 +244,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
{
$form = $this->factory->create('collection', array(), array(
'type' => 'file',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'allow_add' => true,
'prototype' => true,
));
@ -245,16 +257,16 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPrototypeNameOption()
{
$form = $this->factory->create('collection', null, array(
'type' => 'form',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
'prototype' => true,
'allow_add' => true,
));
$this->assertSame('__name__', $form->getConfig()->getAttribute('prototype')->getName(), '__name__ is the default');
$form = $this->factory->create('collection', null, array(
'type' => 'form',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
'prototype' => true,
'allow_add' => true,
'prototype_name' => '__test__',
@ -265,8 +277,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPrototypeDefaultLabel()
{
$form = $this->factory->create('collection', array(), array(
'type' => 'file',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'allow_add' => true,
'prototype' => true,
'prototype_name' => '__test__',
@ -277,8 +289,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
public function testPrototypeData()
{
$form = $this->factory->create('collection', array(), array(
'type' => 'text',
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_add' => true,
'prototype' => true,
'prototype_data' => 'foo',

View File

@ -24,9 +24,19 @@ class CountryTypeTest extends TestCase
parent::setUp();
}
public function testCountriesAreSelectable()
/**
* @group legacy
*/
public function testLegacyName()
{
$form = $this->factory->create('country');
$this->assertSame('country', $form->getConfig()->getType()->getName());
}
public function testCountriesAreSelectable()
{
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CountryType');
$view = $form->createView();
$choices = $view->vars['choices'];
@ -40,7 +50,7 @@ class CountryTypeTest extends TestCase
public function testUnknownCountryIsNotIncluded()
{
$form = $this->factory->create('country', 'country');
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CountryType', 'Symfony\Component\Form\Extension\Core\Type\CountryType');
$view = $form->createView();
$choices = $view->vars['choices'];

Some files were not shown because too many files have changed in this diff Show More