[Form] Reversed the order of $type and $name in FormFactory::createNamed[Builder]()

This commit is contained in:
Bernhard Schussek 2012-05-23 21:50:13 +02:00
parent 33fecca210
commit 877d8f7195
19 changed files with 247 additions and 229 deletions

View File

@ -700,6 +700,23 @@
}); });
``` ```
* The order of the first two arguments of the methods `createNamed` and
`createNamedBuilder` in `FormFactoryInterface` was reversed to match with
the rest of the component. You should scan your code for occurrences of
these methods and reverse the parameters.
Before:
```
$form = $factory->createNamed('text', 'firstName');
```
After:
```
$form = $factory->createNamed('firstName', 'text');
```
### Validator ### Validator
* The methods `setMessage()`, `getMessageTemplate()` and * The methods `setMessage()`, `getMessageTemplate()` and

View File

@ -108,7 +108,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2)); $this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'required' => false, 'required' => false,
@ -125,7 +125,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2)); $this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'required' => false, 'required' => false,
@ -142,7 +142,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2)); $this->persist(array($entity1, $entity2));
$qb = $this->em->createQueryBuilder()->select('e')->from(self::SINGLE_IDENT_CLASS, 'e'); $qb = $this->em->createQueryBuilder()->select('e')->from(self::SINGLE_IDENT_CLASS, 'e');
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'required' => false, 'required' => false,
@ -158,7 +158,7 @@ class EntityTypeTest extends TypeTestCase
*/ */
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure() public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => new \stdClass(), 'query_builder' => new \stdClass(),
@ -170,7 +170,7 @@ class EntityTypeTest extends TypeTestCase
*/ */
public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder() public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function () { 'query_builder' => function () {
@ -183,7 +183,7 @@ class EntityTypeTest extends TypeTestCase
public function testSetDataSingleNull() public function testSetDataSingleNull()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
@ -196,7 +196,7 @@ class EntityTypeTest extends TypeTestCase
public function testSetDataMultipleExpandedNull() public function testSetDataMultipleExpandedNull()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => true, 'expanded' => true,
'em' => 'default', 'em' => 'default',
@ -210,7 +210,7 @@ class EntityTypeTest extends TypeTestCase
public function testSetDataMultipleNonExpandedNull() public function testSetDataMultipleNonExpandedNull()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -224,7 +224,7 @@ class EntityTypeTest extends TypeTestCase
public function testSubmitSingleExpandedNull() public function testSubmitSingleExpandedNull()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'expanded' => true, 'expanded' => true,
'em' => 'default', 'em' => 'default',
@ -238,7 +238,7 @@ class EntityTypeTest extends TypeTestCase
public function testSubmitSingleNonExpandedNull() public function testSubmitSingleNonExpandedNull()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -252,7 +252,7 @@ class EntityTypeTest extends TypeTestCase
public function testSubmitMultipleNull() public function testSubmitMultipleNull()
{ {
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
@ -270,7 +270,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2)); $this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -292,7 +292,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2)); $this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -316,7 +316,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -341,7 +341,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -372,7 +372,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -398,7 +398,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -428,7 +428,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2)); $this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'expanded' => true, 'expanded' => true,
'em' => 'default', 'em' => 'default',
@ -454,7 +454,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => true, 'expanded' => true,
'em' => 'default', 'em' => 'default',
@ -484,7 +484,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
// not all persisted entities should be displayed // not all persisted entities should be displayed
@ -509,7 +509,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($item1, $item2, $item3, $item4)); $this->persist(array($item1, $item2, $item3, $item4));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::ITEM_GROUP_CLASS, 'class' => self::ITEM_GROUP_CLASS,
'choices' => array($item1, $item2, $item3, $item4), 'choices' => array($item1, $item2, $item3, $item4),
@ -535,7 +535,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'choices' => array($entity1, $entity2), 'choices' => array($entity1, $entity2),
@ -556,7 +556,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::COMPOSITE_IDENT_CLASS, 'class' => self::COMPOSITE_IDENT_CLASS,
'choices' => array($entity1, $entity2), 'choices' => array($entity1, $entity2),
@ -579,7 +579,7 @@ class EntityTypeTest extends TypeTestCase
$repository = $this->em->getRepository(self::SINGLE_IDENT_CLASS); $repository = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => $repository->createQueryBuilder('e') 'query_builder' => $repository->createQueryBuilder('e')
@ -601,7 +601,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS, 'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function ($repository) { 'query_builder' => function ($repository) {
@ -625,7 +625,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1, $entity2, $entity3)); $this->persist(array($entity1, $entity2, $entity3));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'em' => 'default', 'em' => 'default',
'class' => self::COMPOSITE_IDENT_CLASS, 'class' => self::COMPOSITE_IDENT_CLASS,
'query_builder' => function ($repository) { 'query_builder' => function ($repository) {
@ -647,7 +647,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1)); $this->persist(array($entity1));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',
@ -668,7 +668,7 @@ class EntityTypeTest extends TypeTestCase
$this->persist(array($entity1)); $this->persist(array($entity1));
$field = $this->factory->createNamed('entity', 'name', null, array( $field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
'em' => 'default', 'em' => 'default',

View File

@ -69,7 +69,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
public function testThemeBlockInheritanceUsingUse() public function testThemeBlockInheritanceUsingUse()
{ {
$view = $this->factory $view = $this->factory
->createNamed('email', 'name') ->createNamed('name', 'email')
->createView() ->createView()
; ;
@ -84,7 +84,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
public function testThemeBlockInheritanceUsingExtend() public function testThemeBlockInheritanceUsingExtend()
{ {
$view = $this->factory $view = $this->factory
->createNamed('email', 'name') ->createNamed('name', 'email')
->createView() ->createView()
; ;

View File

@ -131,3 +131,5 @@ CHANGELOG
* FormEvents::PRE_BIND now replaces FormEvents::BIND_CLIENT_DATA * FormEvents::PRE_BIND now replaces FormEvents::BIND_CLIENT_DATA
* deprecated FormEvents::SET_DATA, FormEvents::BIND_CLIENT_DATA and * deprecated FormEvents::SET_DATA, FormEvents::BIND_CLIENT_DATA and
FormEvents::BIND_NORM_DATA FormEvents::BIND_NORM_DATA
* [BC BREAK] reversed the order of the first two arguments to `createNamed`
and `createNamedBuilder` in `FormFactoryInterface`

View File

@ -90,7 +90,7 @@ class ResizeFormListener implements EventSubscriberInterface
// Then add all rows again in the correct order // Then add all rows again in the correct order
foreach ($data as $name => $value) { foreach ($data as $name => $value) {
$form->add($this->factory->createNamed($this->type, $name, null, array_replace(array( $form->add($this->factory->createNamed($name, $this->type, null, array_replace(array(
'property_path' => '['.$name.']', 'property_path' => '['.$name.']',
), $this->options))); ), $this->options)));
} }
@ -122,7 +122,7 @@ class ResizeFormListener implements EventSubscriberInterface
if ($this->allowAdd) { if ($this->allowAdd) {
foreach ($data as $name => $value) { foreach ($data as $name => $value) {
if (!$form->has($name)) { if (!$form->has($name)) {
$form->add($this->factory->createNamed($this->type, $name, null, array_replace(array( $form->add($this->factory->createNamed($name, $this->type, null, array_replace(array(
'property_path' => '['.$name.']', 'property_path' => '['.$name.']',
), $this->options))); ), $this->options)));
} }

View File

@ -65,7 +65,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
$factory = $form->getConfig()->getAttribute('csrf_factory'); $factory = $form->getConfig()->getAttribute('csrf_factory');
$data = $options['csrf_provider']->generateCsrfToken($options['intention']); $data = $options['csrf_provider']->generateCsrfToken($options['intention']);
$csrfForm = $factory->createNamed('hidden', $options['csrf_field_name'], $data, array( $csrfForm = $factory->createNamed($options['csrf_field_name'], 'hidden', $data, array(
'property_path' => false, 'property_path' => false,
)); ));

View File

@ -121,7 +121,7 @@ class FormBuilder extends FormConfig implements FormBuilderInterface
} }
if (null !== $type) { if (null !== $type) {
return $this->getFormFactory()->createNamedBuilder($type, $name, null, $options, $this); return $this->getFormFactory()->createNamedBuilder($name, $type, null, $options, $this);
} }
return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options, $this); return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options, $this);

View File

@ -117,9 +117,9 @@ class FormFactory implements FormFactoryInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function createNamed($type, $name, $data = null, array $options = array(), FormBuilder $parent = null) public function createNamed($name, $type, $data = null, array $options = array(), FormBuilder $parent = null)
{ {
return $this->createNamedBuilder($type, $name, $data, $options, $parent)->getForm(); return $this->createNamedBuilder($name, $type, $data, $options, $parent)->getForm();
} }
/** /**
@ -137,13 +137,13 @@ class FormFactory implements FormFactoryInterface
{ {
$name = is_object($type) ? $type->getName() : $type; $name = is_object($type) ? $type->getName() : $type;
return $this->createNamedBuilder($type, $name, $data, $options, $parent); return $this->createNamedBuilder($name, $type, $data, $options, $parent);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function createNamedBuilder($type, $name, $data = null, array $options = array(), FormBuilder $parent = null) public function createNamedBuilder($name, $type, $data = null, array $options = array(), FormBuilder $parent = null)
{ {
if (!array_key_exists('data', $options)) { if (!array_key_exists('data', $options)) {
$options['data'] = $data; $options['data'] = $data;
@ -151,7 +151,6 @@ class FormFactory implements FormFactoryInterface
$builder = null; $builder = null;
$types = array(); $types = array();
$knownOptions = array();
$optionsResolver = new OptionsResolver(); $optionsResolver = new OptionsResolver();
// Bottom-up determination of the type hierarchy // Bottom-up determination of the type hierarchy
@ -281,7 +280,7 @@ class FormFactory implements FormFactoryInterface
$options = array_merge($typeGuess->getOptions(), $options); $options = array_merge($typeGuess->getOptions(), $options);
} }
return $this->createNamedBuilder($type, $property, $data, $options, $parent); return $this->createNamedBuilder($property, $type, $data, $options, $parent);
} }
/** /**

View File

@ -34,8 +34,8 @@ interface FormFactoryInterface
* *
* @see createNamedBuilder() * @see createNamedBuilder()
* *
* @param string|FormTypeInterface $type The type of the form
* @param string $name The name of the form * @param string $name The name of the form
* @param string|FormTypeInterface $type The type of the form
* @param mixed $data The initial data * @param mixed $data The initial data
* @param array $options The options * @param array $options The options
* @param FormBuilder $parent The parent builder * @param FormBuilder $parent The parent builder
@ -44,7 +44,7 @@ interface FormFactoryInterface
* *
* @throws Exception\FormException if any given option is not applicable to the given type * @throws Exception\FormException if any given option is not applicable to the given type
*/ */
function createNamed($type, $name, $data = null, array $options = array(), FormBuilder $parent = null); function createNamed($name, $type, $data = null, array $options = array(), FormBuilder $parent = null);
/** /**
* Returns a form for a property of a class. * Returns a form for a property of a class.
@ -80,8 +80,8 @@ interface FormFactoryInterface
/** /**
* Returns a form builder. * Returns a form builder.
* *
* @param string|FormTypeInterface $type The type of the form
* @param string $name The name of the form * @param string $name The name of the form
* @param string|FormTypeInterface $type The type of the form
* @param mixed $data The initial data * @param mixed $data The initial data
* @param array $options The options * @param array $options The options
* @param FormBuilder $parent The parent builder * @param FormBuilder $parent The parent builder
@ -90,7 +90,7 @@ interface FormFactoryInterface
* *
* @throws Exception\FormException if any given option is not applicable to the given type * @throws Exception\FormException if any given option is not applicable to the given type
*/ */
function createNamedBuilder($type, $name, $data = null, array $options = array(), FormBuilder $parent = null); function createNamedBuilder($name, $type, $data = null, array $options = array(), FormBuilder $parent = null);
/** /**
* Returns a form builder for a property of a class. * Returns a form builder for a property of a class.

View File

@ -17,7 +17,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
{ {
public function testRow() public function testRow()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$form->addError(new FormError('Error!')); $form->addError(new FormError('Error!'));
$view = $form->createView(); $view = $form->createView();
$html = $this->renderRow($view); $html = $this->renderRow($view);
@ -37,7 +37,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRowOverrideVariables() public function testRowOverrideVariables()
{ {
$view = $this->factory->createNamed('text', 'name')->createView(); $view = $this->factory->createNamed('name', 'text')->createView();
$html = $this->renderRow($view, array('label' => 'foo&bar')); $html = $this->renderRow($view, array('label' => 'foo&bar'));
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
@ -52,7 +52,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRepeatedRow() public function testRepeatedRow()
{ {
$form = $this->factory->createNamed('repeated', 'name'); $form = $this->factory->createNamed('name', 'repeated');
$form->addError(new FormError('Error!')); $form->addError(new FormError('Error!'));
$view = $form->createView(); $view = $form->createView();
$html = $this->renderRow($view); $html = $this->renderRow($view);
@ -77,7 +77,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRest() public function testRest()
{ {
$view = $this->factory->createNamedBuilder('form', 'name') $view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text') ->add('field1', 'text')
->add('field2', 'repeated') ->add('field2', 'repeated')
->add('field3', 'text') ->add('field3', 'text')
@ -118,17 +118,17 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestWithChildrenForms() public function testRestWithChildrenForms()
{ {
$child1 = $this->factory->createNamedBuilder('form', 'child1') $child1 = $this->factory->createNamedBuilder('child1', 'form')
->add('field1', 'text') ->add('field1', 'text')
->add('field2', 'text') ->add('field2', 'text')
->getForm(); ->getForm();
$child2 = $this->factory->createNamedBuilder('form', 'child2') $child2 = $this->factory->createNamedBuilder('child2', 'form')
->add('field1', 'text') ->add('field1', 'text')
->add('field2', 'text') ->add('field2', 'text')
->getForm(); ->getForm();
$view = $this->factory->createNamedBuilder('form', 'parent') $view = $this->factory->createNamedBuilder('parent', 'form')
->getForm() ->getForm()
->add($child1) ->add($child1)
->add($child2) ->add($child2)
@ -178,7 +178,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestAndRepeatedWithRow() public function testRestAndRepeatedWithRow()
{ {
$view = $this->factory->createNamedBuilder('form', 'name') $view = $this->factory->createNamedBuilder('name', 'form')
->add('first', 'text') ->add('first', 'text')
->add('password', 'repeated') ->add('password', 'repeated')
->getForm() ->getForm()
@ -204,7 +204,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestAndRepeatedWithRowPerChild() public function testRestAndRepeatedWithRowPerChild()
{ {
$view = $this->factory->createNamedBuilder('form', 'name') $view = $this->factory->createNamedBuilder('name', 'form')
->add('first', 'text') ->add('first', 'text')
->add('password', 'repeated') ->add('password', 'repeated')
->getForm() ->getForm()
@ -232,7 +232,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRestAndRepeatedWithWidgetPerChild() public function testRestAndRepeatedWithWidgetPerChild()
{ {
$view = $this->factory->createNamedBuilder('form', 'name') $view = $this->factory->createNamedBuilder('name', 'form')
->add('first', 'text') ->add('first', 'text')
->add('password', 'repeated') ->add('password', 'repeated')
->getForm() ->getForm()
@ -262,7 +262,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testCollection() public function testCollection()
{ {
$form = $this->factory->createNamed('collection', 'name', array('a', 'b'), array( $form = $this->factory->createNamed('name', 'collection', array('a', 'b'), array(
'type' => 'text', 'type' => 'text',
)); ));
@ -279,7 +279,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testEmptyCollection() public function testEmptyCollection()
{ {
$form = $this->factory->createNamed('collection', 'name', array(), array( $form = $this->factory->createNamed('name', 'collection', array(), array(
'type' => 'text', 'type' => 'text',
)); ));
@ -333,7 +333,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testForm() public function testForm()
{ {
$form = $this->factory->createNamedBuilder('form', 'name') $form = $this->factory->createNamedBuilder('name', 'form')
->add('firstName', 'text') ->add('firstName', 'text')
->add('lastName', 'text') ->add('lastName', 'text')
->getForm(); ->getForm();
@ -361,9 +361,9 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
// https://github.com/symfony/symfony/issues/2308 // https://github.com/symfony/symfony/issues/2308
public function testNestedFormError() public function testNestedFormError()
{ {
$form = $this->factory->createNamedBuilder('form', 'name') $form = $this->factory->createNamedBuilder('name', 'form')
->add($this->factory ->add($this->factory
->createNamedBuilder('form', 'child', null, array('error_bubbling' => false)) ->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
->add('grandChild', 'form') ->add('grandChild', 'form')
) )
->getForm(); ->getForm();
@ -386,11 +386,11 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
->method('generateCsrfToken') ->method('generateCsrfToken')
->will($this->returnValue('foo&bar')); ->will($this->returnValue('foo&bar'));
$form = $this->factory->createNamedBuilder('form', 'name') $form = $this->factory->createNamedBuilder('name', 'form')
->add($this->factory ->add($this->factory
// No CSRF protection on nested forms // No CSRF protection on nested forms
->createNamedBuilder('form', 'child') ->createNamedBuilder('child', 'form')
->add($this->factory->createNamedBuilder('text', 'grandchild')) ->add($this->factory->createNamedBuilder('grandchild', 'text'))
) )
->getForm(); ->getForm();
@ -407,7 +407,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRepeated() public function testRepeated()
{ {
$form = $this->factory->createNamed('repeated', 'name', 'foobar', array( $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
'type' => 'text', 'type' => 'text',
)); ));
@ -433,7 +433,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testRepeatedWithCustomOptions() public function testRepeatedWithCustomOptions()
{ {
$form = $this->factory->createNamed('repeated', 'name', null, array( $form = $this->factory->createNamed('name', 'repeated', null, array(
// the global required value cannot be overriden // the global required value cannot be overriden
'first_options' => array('label' => 'Test', 'required' => false), 'first_options' => array('label' => 'Test', 'required' => false),
'second_options' => array('label' => 'Test2') 'second_options' => array('label' => 'Test2')
@ -461,7 +461,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testSearchInputName() public function testSearchInputName()
{ {
$form = $this->factory->createNamedBuilder('form', 'full') $form = $this->factory->createNamedBuilder('full', 'form')
->add('name', 'search') ->add('name', 'search')
->getForm(); ->getForm();
@ -482,7 +482,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testLabelHasNoId() public function testLabelHasNoId()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$html = $this->renderRow($form->createView()); $html = $this->renderRow($form->createView());
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
@ -501,7 +501,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testThemeBlockInheritance($theme) public function testThemeBlockInheritance($theme)
{ {
$view = $this->factory $view = $this->factory
->createNamed('email', 'name') ->createNamed('name', 'email')
->createView() ->createView()
; ;
@ -518,11 +518,11 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
*/ */
public function testThemeInheritance($parentTheme, $childTheme) public function testThemeInheritance($parentTheme, $childTheme)
{ {
$child = $this->factory->createNamedBuilder('form', 'child') $child = $this->factory->createNamedBuilder('child', 'form')
->add('field', 'text') ->add('field', 'text')
->getForm(); ->getForm();
$view = $this->factory->createNamedBuilder('form', 'parent') $view = $this->factory->createNamedBuilder('parent', 'form')
->add('field', 'text') ->add('field', 'text')
->getForm() ->getForm()
->add($child) ->add($child)

View File

@ -114,7 +114,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testEnctype() public function testEnctype()
{ {
$form = $this->factory->createNamedBuilder('form', 'name') $form = $this->factory->createNamedBuilder('name', 'form')
->add('file', 'file') ->add('file', 'file')
->getForm(); ->getForm();
@ -123,7 +123,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testNoEnctype() public function testNoEnctype()
{ {
$form = $this->factory->createNamedBuilder('form', 'name') $form = $this->factory->createNamedBuilder('name', 'form')
->add('text', 'text') ->add('text', 'text')
->getForm(); ->getForm();
@ -132,7 +132,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabel() public function testLabel()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$view = $form->createView(); $view = $form->createView();
$this->renderWidget($view, array('label' => 'foo')); $this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view); $html = $this->renderLabel($view);
@ -147,7 +147,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabelOnForm() public function testLabelOnForm()
{ {
$form = $this->factory->createNamed('date', 'name'); $form = $this->factory->createNamed('name', 'date');
$view = $form->createView(); $view = $form->createView();
$this->renderWidget($view, array('label' => 'foo')); $this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view); $html = $this->renderLabel($view);
@ -162,7 +162,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabelWithCustomTextPassedAsOption() public function testLabelWithCustomTextPassedAsOption()
{ {
$form = $this->factory->createNamed('text', 'name', null, array( $form = $this->factory->createNamed('name', 'text', null, array(
'label' => 'Custom label', 'label' => 'Custom label',
)); ));
$html = $this->renderLabel($form->createView()); $html = $this->renderLabel($form->createView());
@ -177,7 +177,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabelWithCustomTextPassedDirectly() public function testLabelWithCustomTextPassedDirectly()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$html = $this->renderLabel($form->createView(), 'Custom label'); $html = $this->renderLabel($form->createView(), 'Custom label');
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
@ -190,7 +190,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabelWithCustomTextPassedAsOptionAndDirectly() public function testLabelWithCustomTextPassedAsOptionAndDirectly()
{ {
$form = $this->factory->createNamed('text', 'name', null, array( $form = $this->factory->createNamed('name', 'text', null, array(
'label' => 'Custom label', 'label' => 'Custom label',
)); ));
$html = $this->renderLabel($form->createView(), 'Overridden label'); $html = $this->renderLabel($form->createView(), 'Overridden label');
@ -205,7 +205,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabelDoesNotRenderFieldAttributes() public function testLabelDoesNotRenderFieldAttributes()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$html = $this->renderLabel($form->createView(), null, array( $html = $this->renderLabel($form->createView(), null, array(
'attr' => array( 'attr' => array(
'class' => 'my&class' 'class' => 'my&class'
@ -222,7 +222,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabelWithCustomOptionsPassedDirectly() public function testLabelWithCustomOptionsPassedDirectly()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$html = $this->renderLabel($form->createView(), null, array( $html = $this->renderLabel($form->createView(), null, array(
'label_attr' => array( 'label_attr' => array(
'class' => 'my&class' 'class' => 'my&class'
@ -239,7 +239,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLabelWithCustomTextAndCustomOptionsPassedDirectly() public function testLabelWithCustomTextAndCustomOptionsPassedDirectly()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$html = $this->renderLabel($form->createView(), 'Custom label', array( $html = $this->renderLabel($form->createView(), 'Custom label', array(
'label_attr' => array( 'label_attr' => array(
'class' => 'my&class' 'class' => 'my&class'
@ -257,7 +257,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testErrors() public function testErrors()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$form->addError(new FormError('Error 1')); $form->addError(new FormError('Error 1'));
$form->addError(new FormError('Error 2')); $form->addError(new FormError('Error 2'));
$view = $form->createView(); $view = $form->createView();
@ -276,7 +276,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testWidgetById() public function testWidgetById()
{ {
$form = $this->factory->createNamed('text', 'text_id'); $form = $this->factory->createNamed('text_id', 'text');
$html = $this->renderWidget($form->createView()); $html = $this->renderWidget($form->createView());
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
@ -293,7 +293,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testCheckedCheckbox() public function testCheckedCheckbox()
{ {
$form = $this->factory->createNamed('checkbox', 'name', true); $form = $this->factory->createNamed('name', 'checkbox', true);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -307,7 +307,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testUncheckedCheckbox() public function testUncheckedCheckbox()
{ {
$form = $this->factory->createNamed('checkbox', 'name', false); $form = $this->factory->createNamed('name', 'checkbox', false);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -320,7 +320,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testCheckboxWithValue() public function testCheckboxWithValue()
{ {
$form = $this->factory->createNamed('checkbox', 'name', false, array( $form = $this->factory->createNamed('name', 'checkbox', false, array(
'value' => 'foo&bar', 'value' => 'foo&bar',
)); ));
@ -335,7 +335,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoice() public function testSingleChoice()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
@ -356,7 +356,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceWithPreferred() public function testSingleChoiceWithPreferred()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'), 'preferred_choices' => array('&b'),
'multiple' => false, 'multiple' => false,
@ -380,7 +380,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceWithPreferredAndNoSeparator() public function testSingleChoiceWithPreferredAndNoSeparator()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'), 'preferred_choices' => array('&b'),
'multiple' => false, 'multiple' => false,
@ -402,7 +402,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceWithPreferredAndBlankSeparator() public function testSingleChoiceWithPreferredAndBlankSeparator()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'), 'preferred_choices' => array('&b'),
'multiple' => false, 'multiple' => false,
@ -425,7 +425,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testChoiceWithOnlyPreferred() public function testChoiceWithOnlyPreferred()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&a', '&b'), 'preferred_choices' => array('&a', '&b'),
'multiple' => false, 'multiple' => false,
@ -441,7 +441,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceNonRequired() public function testSingleChoiceNonRequired()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false, 'required' => false,
'multiple' => false, 'multiple' => false,
@ -464,7 +464,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceNonRequiredNoneSelected() public function testSingleChoiceNonRequiredNoneSelected()
{ {
$form = $this->factory->createNamed('choice', 'name', null, array( $form = $this->factory->createNamed('name', 'choice', null, array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false, 'required' => false,
'multiple' => false, 'multiple' => false,
@ -487,7 +487,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceWithNonRequiredEmptyValue() public function testSingleChoiceWithNonRequiredEmptyValue()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
@ -511,7 +511,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceRequiredWithEmptyValue() public function testSingleChoiceRequiredWithEmptyValue()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true, 'required' => true,
'multiple' => false, 'multiple' => false,
@ -535,7 +535,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceRequiredWithEmptyValueViaView() public function testSingleChoiceRequiredWithEmptyValueViaView()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true, 'required' => true,
'multiple' => false, 'multiple' => false,
@ -558,7 +558,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceGrouped() public function testSingleChoiceGrouped()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array( 'choices' => array(
'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'Group&2' => array('&c' => 'Choice&C'), 'Group&2' => array('&c' => 'Choice&C'),
@ -588,7 +588,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testMultipleChoice() public function testMultipleChoice()
{ {
$form = $this->factory->createNamed('choice', 'name', array('&a'), array( $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
@ -609,7 +609,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testMultipleChoiceSkipEmptyValue() public function testMultipleChoiceSkipEmptyValue()
{ {
$form = $this->factory->createNamed('choice', 'name', array('&a'), array( $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
@ -631,7 +631,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testMultipleChoiceNonRequired() public function testMultipleChoiceNonRequired()
{ {
$form = $this->factory->createNamed('choice', 'name', array('&a'), array( $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false, 'required' => false,
'multiple' => true, 'multiple' => true,
@ -653,7 +653,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceExpanded() public function testSingleChoiceExpanded()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false, 'multiple' => false,
'expanded' => true, 'expanded' => true,
@ -675,7 +675,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceExpandedSkipEmptyValue() public function testSingleChoiceExpandedSkipEmptyValue()
{ {
$form = $this->factory->createNamed('choice', 'name', '&a', array( $form = $this->factory->createNamed('name', 'choice', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false, 'multiple' => false,
'expanded' => true, 'expanded' => true,
@ -698,7 +698,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSingleChoiceExpandedWithBooleanValue() public function testSingleChoiceExpandedWithBooleanValue()
{ {
$form = $this->factory->createNamed('choice', 'name', true, array( $form = $this->factory->createNamed('name', 'choice', true, array(
'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'), 'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
'multiple' => false, 'multiple' => false,
'expanded' => true, 'expanded' => true,
@ -720,7 +720,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testMultipleChoiceExpanded() public function testMultipleChoiceExpanded()
{ {
$form = $this->factory->createNamed('choice', 'name', array('&a', '&c'), array( $form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'), 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'multiple' => true, 'multiple' => true,
'expanded' => true, 'expanded' => true,
@ -745,7 +745,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testCountry() public function testCountry()
{ {
$form = $this->factory->createNamed('country', 'name', 'AT'); $form = $this->factory->createNamed('name', 'country', 'AT');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/select '/select
@ -758,7 +758,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testCountryWithEmptyValue() public function testCountryWithEmptyValue()
{ {
$form = $this->factory->createNamed('country', 'name', 'AT', array( $form = $this->factory->createNamed('name', 'country', 'AT', array(
'empty_value' => 'Select&Country', 'empty_value' => 'Select&Country',
'required' => false, 'required' => false,
)); ));
@ -775,7 +775,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateTime() public function testDateTime()
{ {
$form = $this->factory->createNamed('datetime', 'name', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => false, 'with_seconds' => false,
)); ));
@ -814,7 +814,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateTimeWithEmptyValueGlobal() public function testDateTimeWithEmptyValueGlobal()
{ {
$form = $this->factory->createNamed('datetime', 'name', null, array( $form = $this->factory->createNamed('name', 'datetime', null, array(
'input' => 'string', 'input' => 'string',
'empty_value' => 'Change&Me', 'empty_value' => 'Change&Me',
'required' => false, 'required' => false,
@ -854,7 +854,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateTimeWithEmptyValueOnTime() public function testDateTimeWithEmptyValueOnTime()
{ {
$form = $this->factory->createNamed('datetime', 'name', '2011-02-03', array( $form = $this->factory->createNamed('name', 'datetime', '2011-02-03', array(
'input' => 'string', 'input' => 'string',
'empty_value' => array('hour' => 'Change&Me', 'minute' => 'Change&Me'), 'empty_value' => array('hour' => 'Change&Me', 'minute' => 'Change&Me'),
'required' => false, 'required' => false,
@ -894,7 +894,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateTimeWithSeconds() public function testDateTimeWithSeconds()
{ {
$form = $this->factory->createNamed('datetime', 'name', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => true, 'with_seconds' => true,
)); ));
@ -936,7 +936,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateTimeSingleText() public function testDateTimeSingleText()
{ {
$form = $this->factory->createNamed('datetime', 'name', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'date_widget' => 'single_text', 'date_widget' => 'single_text',
'time_widget' => 'single_text', 'time_widget' => 'single_text',
@ -962,7 +962,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateTimeWithWidgetSingleText() public function testDateTimeWithWidgetSingleText()
{ {
$form = $this->factory->createNamed('datetime', 'name', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'widget' => 'single_text', 'widget' => 'single_text',
)); ));
@ -978,7 +978,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets() public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
{ {
$form = $this->factory->createNamed('datetime', 'name', '2011-02-03 04:05:06', array( $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
'input' => 'string', 'input' => 'string',
'date_widget' => 'choice', 'date_widget' => 'choice',
'time_widget' => 'choice', 'time_widget' => 'choice',
@ -996,7 +996,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateChoice() public function testDateChoice()
{ {
$form = $this->factory->createNamed('date', 'name', '2011-02-03', array( $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
'input' => 'string', 'input' => 'string',
'widget' => 'choice', 'widget' => 'choice',
)); ));
@ -1021,7 +1021,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateChoiceWithEmptyValueGlobal() public function testDateChoiceWithEmptyValueGlobal()
{ {
$form = $this->factory->createNamed('date', 'name', null, array( $form = $this->factory->createNamed('name', 'date', null, array(
'input' => 'string', 'input' => 'string',
'widget' => 'choice', 'widget' => 'choice',
'empty_value' => 'Change&Me', 'empty_value' => 'Change&Me',
@ -1048,7 +1048,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateChoiceWithEmptyValueOnYear() public function testDateChoiceWithEmptyValueOnYear()
{ {
$form = $this->factory->createNamed('date', 'name', null, array( $form = $this->factory->createNamed('name', 'date', null, array(
'input' => 'string', 'input' => 'string',
'widget' => 'choice', 'widget' => 'choice',
'required' => false, 'required' => false,
@ -1075,7 +1075,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateText() public function testDateText()
{ {
$form = $this->factory->createNamed('date', 'name', '2011-02-03', array( $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
'input' => 'string', 'input' => 'string',
'widget' => 'text', 'widget' => 'text',
)); ));
@ -1103,7 +1103,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDateSingleText() public function testDateSingleText()
{ {
$form = $this->factory->createNamed('date', 'name', '2011-02-03', array( $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
'input' => 'string', 'input' => 'string',
'widget' => 'single_text', 'widget' => 'single_text',
)); ));
@ -1130,7 +1130,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testBirthDay() public function testBirthDay()
{ {
$form = $this->factory->createNamed('birthday', 'name', '2000-02-03', array( $form = $this->factory->createNamed('name', 'birthday', '2000-02-03', array(
'input' => 'string', 'input' => 'string',
)); ));
@ -1154,7 +1154,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testBirthDayWithEmptyValue() public function testBirthDayWithEmptyValue()
{ {
$form = $this->factory->createNamed('birthday', 'name', '1950-01-01', array( $form = $this->factory->createNamed('name', 'birthday', '1950-01-01', array(
'input' => 'string', 'input' => 'string',
'empty_value' => '', 'empty_value' => '',
'required' => false, 'required' => false,
@ -1183,7 +1183,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testEmail() public function testEmail()
{ {
$form = $this->factory->createNamed('email', 'name', 'foo&bar'); $form = $this->factory->createNamed('name', 'email', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1197,7 +1197,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testEmailWithMaxLength() public function testEmailWithMaxLength()
{ {
$form = $this->factory->createNamed('email', 'name', 'foo&bar', array( $form = $this->factory->createNamed('name', 'email', 'foo&bar', array(
'max_length' => 123, 'max_length' => 123,
)); ));
@ -1213,7 +1213,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testFile() public function testFile()
{ {
$form = $this->factory->createNamed('file', 'name'); $form = $this->factory->createNamed('name', 'file');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1224,7 +1224,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testHidden() public function testHidden()
{ {
$form = $this->factory->createNamed('hidden', 'name', 'foo&bar'); $form = $this->factory->createNamed('name', 'hidden', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1237,7 +1237,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testReadOnly() public function testReadOnly()
{ {
$form = $this->factory->createNamed('text', 'name', null, array( $form = $this->factory->createNamed('name', 'text', null, array(
'read_only' => true, 'read_only' => true,
)); ));
@ -1252,7 +1252,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testDisabled() public function testDisabled()
{ {
$form = $this->factory->createNamed('text', 'name', null, array( $form = $this->factory->createNamed('name', 'text', null, array(
'disabled' => true, 'disabled' => true,
)); ));
@ -1267,7 +1267,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testInteger() public function testInteger()
{ {
$form = $this->factory->createNamed('integer', 'name', 123); $form = $this->factory->createNamed('name', 'integer', 123);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1280,7 +1280,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLanguage() public function testLanguage()
{ {
$form = $this->factory->createNamed('language', 'name', 'de'); $form = $this->factory->createNamed('name', 'language', 'de');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/select '/select
@ -1293,7 +1293,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testLocale() public function testLocale()
{ {
$form = $this->factory->createNamed('locale', 'name', 'de_AT'); $form = $this->factory->createNamed('name', 'locale', 'de_AT');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/select '/select
@ -1306,7 +1306,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testMoney() public function testMoney()
{ {
$form = $this->factory->createNamed('money', 'name', 1234.56, array( $form = $this->factory->createNamed('name', 'money', 1234.56, array(
'currency' => 'EUR', 'currency' => 'EUR',
)); ));
@ -1322,7 +1322,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testNumber() public function testNumber()
{ {
$form = $this->factory->createNamed('number', 'name', 1234.56); $form = $this->factory->createNamed('name', 'number', 1234.56);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1335,7 +1335,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testPassword() public function testPassword()
{ {
$form = $this->factory->createNamed('password', 'name', 'foo&bar'); $form = $this->factory->createNamed('name', 'password', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1347,7 +1347,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testPasswordBoundNotAlwaysEmpty() public function testPasswordBoundNotAlwaysEmpty()
{ {
$form = $this->factory->createNamed('password', 'name', null, array( $form = $this->factory->createNamed('name', 'password', null, array(
'always_empty' => false, 'always_empty' => false,
)); ));
$form->bind('foo&bar'); $form->bind('foo&bar');
@ -1363,7 +1363,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testPasswordWithMaxLength() public function testPasswordWithMaxLength()
{ {
$form = $this->factory->createNamed('password', 'name', 'foo&bar', array( $form = $this->factory->createNamed('name', 'password', 'foo&bar', array(
'max_length' => 123, 'max_length' => 123,
)); ));
@ -1378,7 +1378,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testPercent() public function testPercent()
{ {
$form = $this->factory->createNamed('percent', 'name', 0.1); $form = $this->factory->createNamed('name', 'percent', 0.1);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1392,7 +1392,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testCheckedRadio() public function testCheckedRadio()
{ {
$form = $this->factory->createNamed('radio', 'name', true); $form = $this->factory->createNamed('name', 'radio', true);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1406,7 +1406,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testUncheckedRadio() public function testUncheckedRadio()
{ {
$form = $this->factory->createNamed('radio', 'name', false); $form = $this->factory->createNamed('name', 'radio', false);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1419,7 +1419,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testRadioWithValue() public function testRadioWithValue()
{ {
$form = $this->factory->createNamed('radio', 'name', false, array( $form = $this->factory->createNamed('name', 'radio', false, array(
'value' => 'foo&bar', 'value' => 'foo&bar',
)); ));
@ -1434,7 +1434,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTextarea() public function testTextarea()
{ {
$form = $this->factory->createNamed('textarea', 'name', 'foo&bar', array( $form = $this->factory->createNamed('name', 'textarea', 'foo&bar', array(
'pattern' => 'foo', 'pattern' => 'foo',
)); ));
@ -1449,7 +1449,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testText() public function testText()
{ {
$form = $this->factory->createNamed('text', 'name', 'foo&bar'); $form = $this->factory->createNamed('name', 'text', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1463,7 +1463,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTextWithMaxLength() public function testTextWithMaxLength()
{ {
$form = $this->factory->createNamed('text', 'name', 'foo&bar', array( $form = $this->factory->createNamed('name', 'text', 'foo&bar', array(
'max_length' => 123, 'max_length' => 123,
)); ));
@ -1479,7 +1479,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testSearch() public function testSearch()
{ {
$form = $this->factory->createNamed('search', 'name', 'foo&bar'); $form = $this->factory->createNamed('name', 'search', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1493,7 +1493,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTime() public function testTime()
{ {
$form = $this->factory->createNamed('time', 'name', '04:05:06', array( $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => false, 'with_seconds' => false,
)); ));
@ -1517,7 +1517,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTimeWithSeconds() public function testTimeWithSeconds()
{ {
$form = $this->factory->createNamed('time', 'name', '04:05:06', array( $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
'input' => 'string', 'input' => 'string',
'with_seconds' => true, 'with_seconds' => true,
)); ));
@ -1548,7 +1548,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTimeText() public function testTimeText()
{ {
$form = $this->factory->createNamed('time', 'name', '04:05:06', array( $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
'input' => 'string', 'input' => 'string',
'widget' => 'text', 'widget' => 'text',
)); ));
@ -1578,7 +1578,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTimeSingleText() public function testTimeSingleText()
{ {
$form = $this->factory->createNamed('time', 'name', '04:05:06', array( $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
'input' => 'string', 'input' => 'string',
'widget' => 'single_text', 'widget' => 'single_text',
)); ));
@ -1594,7 +1594,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTimeWithEmptyValueGlobal() public function testTimeWithEmptyValueGlobal()
{ {
$form = $this->factory->createNamed('time', 'name', null, array( $form = $this->factory->createNamed('name', 'time', null, array(
'input' => 'string', 'input' => 'string',
'empty_value' => 'Change&Me', 'empty_value' => 'Change&Me',
'required' => false, 'required' => false,
@ -1619,7 +1619,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTimeWithEmptyValueOnYear() public function testTimeWithEmptyValueOnYear()
{ {
$form = $this->factory->createNamed('time', 'name', null, array( $form = $this->factory->createNamed('name', 'time', null, array(
'input' => 'string', 'input' => 'string',
'required' => false, 'required' => false,
'empty_value' => array('hour' => 'Change&Me'), 'empty_value' => array('hour' => 'Change&Me'),
@ -1655,7 +1655,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTimezone() public function testTimezone()
{ {
$form = $this->factory->createNamed('timezone', 'name', 'Europe/Vienna'); $form = $this->factory->createNamed('name', 'timezone', 'Europe/Vienna');
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/select '/select
@ -1673,7 +1673,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testTimezoneWithEmptyValue() public function testTimezoneWithEmptyValue()
{ {
$form = $this->factory->createNamed('timezone', 'name', null, array( $form = $this->factory->createNamed('name', 'timezone', null, array(
'empty_value' => 'Select&Timezone', 'empty_value' => 'Select&Timezone',
'required' => false, 'required' => false,
)); ));
@ -1690,7 +1690,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testUrl() public function testUrl()
{ {
$url = 'http://www.google.com?foo1=bar1&foo2=bar2'; $url = 'http://www.google.com?foo1=bar1&foo2=bar2';
$form = $this->factory->createNamed('url', 'name', $url); $form = $this->factory->createNamed('name', 'url', $url);
$this->assertWidgetMatchesXpath($form->createView(), array(), $this->assertWidgetMatchesXpath($form->createView(), array(),
'/input '/input
@ -1703,7 +1703,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testCollectionPrototype() public function testCollectionPrototype()
{ {
$form = $this->factory->createNamedBuilder('form', 'name', array('items' => array('one', 'two', 'three'))) $form = $this->factory->createNamedBuilder('name', 'form', array('items' => array('one', 'two', 'three')))
->add('items', 'collection', array('allow_add' => true)) ->add('items', 'collection', array('allow_add' => true))
->getForm() ->getForm()
->createView(); ->createView();
@ -1721,7 +1721,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
public function testEmptyRootFormName() public function testEmptyRootFormName()
{ {
$form = $this->factory->createNamedBuilder('form', '', '') $form = $this->factory->createNamedBuilder('', 'form', '')
->add('child', 'text') ->add('child', 'text')
->getForm(); ->getForm();

View File

@ -17,7 +17,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
{ {
public function testRow() public function testRow()
{ {
$form = $this->factory->createNamed('text', 'name'); $form = $this->factory->createNamed('name', 'text');
$form->addError(new FormError('Error!')); $form->addError(new FormError('Error!'));
$view = $form->createView(); $view = $form->createView();
$html = $this->renderRow($view); $html = $this->renderRow($view);
@ -41,7 +41,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeatedRow() public function testRepeatedRow()
{ {
$form = $this->factory->createNamed('repeated', 'name'); $form = $this->factory->createNamed('name', 'repeated');
$html = $this->renderRow($form->createView()); $html = $this->renderRow($form->createView());
$this->assertMatchesXpath($html, $this->assertMatchesXpath($html,
@ -71,7 +71,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeatedRowWithErrors() public function testRepeatedRowWithErrors()
{ {
$form = $this->factory->createNamed('repeated', 'name'); $form = $this->factory->createNamed('name', 'repeated');
$form->addError(new FormError('Error!')); $form->addError(new FormError('Error!'));
$view = $form->createView(); $view = $form->createView();
$html = $this->renderRow($view); $html = $this->renderRow($view);
@ -107,7 +107,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRest() public function testRest()
{ {
$view = $this->factory->createNamedBuilder('form', 'name') $view = $this->factory->createNamedBuilder('name', 'form')
->add('field1', 'text') ->add('field1', 'text')
->add('field2', 'repeated') ->add('field2', 'repeated')
->add('field3', 'text') ->add('field3', 'text')
@ -154,7 +154,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testCollection() public function testCollection()
{ {
$form = $this->factory->createNamed('collection', 'name', array('a', 'b'), array( $form = $this->factory->createNamed('name', 'collection', array('a', 'b'), array(
'type' => 'text', 'type' => 'text',
)); ));
@ -172,7 +172,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testEmptyCollection() public function testEmptyCollection()
{ {
$form = $this->factory->createNamed('collection', 'name', array(), array( $form = $this->factory->createNamed('name', 'collection', array(), array(
'type' => 'text', 'type' => 'text',
)); ));
@ -186,7 +186,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testForm() public function testForm()
{ {
$view = $this->factory->createNamedBuilder('form', 'name') $view = $this->factory->createNamedBuilder('name', 'form')
->add('firstName', 'text') ->add('firstName', 'text')
->add('lastName', 'text') ->add('lastName', 'text')
->getForm() ->getForm()
@ -223,9 +223,9 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
// https://github.com/symfony/symfony/issues/2308 // https://github.com/symfony/symfony/issues/2308
public function testNestedFormError() public function testNestedFormError()
{ {
$form = $this->factory->createNamedBuilder('form', 'name') $form = $this->factory->createNamedBuilder('name', 'form')
->add($this->factory ->add($this->factory
->createNamedBuilder('form', 'child', null, array('error_bubbling' => false)) ->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
->add('grandChild', 'form') ->add('grandChild', 'form')
) )
->getForm(); ->getForm();
@ -250,11 +250,11 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
->method('generateCsrfToken') ->method('generateCsrfToken')
->will($this->returnValue('foo&bar')); ->will($this->returnValue('foo&bar'));
$form = $this->factory->createNamedBuilder('form', 'name') $form = $this->factory->createNamedBuilder('name', 'form')
->add($this->factory ->add($this->factory
// No CSRF protection on nested forms // No CSRF protection on nested forms
->createNamedBuilder('form', 'child') ->createNamedBuilder('child', 'form')
->add($this->factory->createNamedBuilder('text', 'grandchild')) ->add($this->factory->createNamedBuilder('grandchild', 'text'))
) )
->getForm(); ->getForm();
@ -274,7 +274,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeated() public function testRepeated()
{ {
$form = $this->factory->createNamed('repeated', 'name', 'foobar', array( $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
'type' => 'text', 'type' => 'text',
)); ));
@ -308,7 +308,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testRepeatedWithCustomOptions() public function testRepeatedWithCustomOptions()
{ {
$form = $this->factory->createNamed('repeated', 'name', 'foobar', array( $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
'type' => 'password', 'type' => 'password',
'first_options' => array('label' => 'Test', 'required' => false), 'first_options' => array('label' => 'Test', 'required' => false),
'second_options' => array('label' => 'Test2') 'second_options' => array('label' => 'Test2')

View File

@ -61,11 +61,11 @@ class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase
$this->factory->expects($this->at(0)) $this->factory->expects($this->at(0))
->method('createNamed') ->method('createNamed')
->with('text', 1, null, array('property_path' => '[1]', 'max_length' => 10)) ->with(1, 'text', null, array('property_path' => '[1]', 'max_length' => 10))
->will($this->returnValue($this->getForm('1'))); ->will($this->returnValue($this->getForm('1')));
$this->factory->expects($this->at(1)) $this->factory->expects($this->at(1))
->method('createNamed') ->method('createNamed')
->with('text', 2, null, array('property_path' => '[2]', 'max_length' => 10)) ->with(2, 'text', null, array('property_path' => '[2]', 'max_length' => 10))
->will($this->returnValue($this->getForm('2'))); ->will($this->returnValue($this->getForm('2')));
$data = array(1 => 'string', 2 => 'string'); $data = array(1 => 'string', 2 => 'string');
@ -105,7 +105,7 @@ class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase
$this->factory->expects($this->once()) $this->factory->expects($this->once())
->method('createNamed') ->method('createNamed')
->with('text', 1, null, array('property_path' => '[1]', 'max_length' => 10)) ->with(1, 'text', null, array('property_path' => '[1]', 'max_length' => 10))
->will($this->returnValue($this->getForm('1'))); ->will($this->returnValue($this->getForm('1')));
$data = array(0 => 'string', 1 => 'string'); $data = array(0 => 'string', 1 => 'string');

View File

@ -693,7 +693,7 @@ class ChoiceTypeTest extends TypeTestCase
public function testAdjustFullNameForMultipleNonExpanded() public function testAdjustFullNameForMultipleNonExpanded()
{ {
$form = $this->factory->createNamed('choice', 'name', null, array( $form = $this->factory->createNamed('name', 'choice', null, array(
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
'choices' => $this->choices, 'choices' => $this->choices,
@ -706,7 +706,7 @@ class ChoiceTypeTest extends TypeTestCase
// https://github.com/symfony/symfony/issues/3298 // https://github.com/symfony/symfony/issues/3298
public function testInitializeWithEmptyChoices() public function testInitializeWithEmptyChoices()
{ {
$this->factory->createNamed('choice', 'name', null, array( $this->factory->createNamed('name', 'choice', null, array(
'choices' => array(), 'choices' => array(),
)); ));
} }

View File

@ -102,7 +102,7 @@ class FormTypeTest extends TypeTestCase
public function testPassIdAndNameToView() public function testPassIdAndNameToView()
{ {
$form = $this->factory->createNamed('form', 'name'); $form = $this->factory->createNamed('name', 'form');
$view = $form->createView(); $view = $form->createView();
$this->assertEquals('name', $view->get('id')); $this->assertEquals('name', $view->get('id'));
@ -112,7 +112,7 @@ class FormTypeTest extends TypeTestCase
public function testStripLeadingUnderscoresAndDigitsFromId() public function testStripLeadingUnderscoresAndDigitsFromId()
{ {
$form = $this->factory->createNamed('form', '_09name'); $form = $this->factory->createNamed('_09name', 'form');
$view = $form->createView(); $view = $form->createView();
$this->assertEquals('name', $view->get('id')); $this->assertEquals('name', $view->get('id'));
@ -122,8 +122,8 @@ class FormTypeTest extends TypeTestCase
public function testPassIdAndNameToViewWithParent() public function testPassIdAndNameToViewWithParent()
{ {
$parent = $this->factory->createNamed('form', 'parent'); $parent = $this->factory->createNamed('parent', 'form');
$parent->add($this->factory->createNamed('form', 'child')); $parent->add($this->factory->createNamed('child', 'form'));
$view = $parent->createView(); $view = $parent->createView();
$this->assertEquals('parent_child', $view['child']->get('id')); $this->assertEquals('parent_child', $view['child']->get('id'));
@ -133,9 +133,9 @@ class FormTypeTest extends TypeTestCase
public function testPassIdAndNameToViewWithGrandParent() public function testPassIdAndNameToViewWithGrandParent()
{ {
$parent = $this->factory->createNamed('form', 'parent'); $parent = $this->factory->createNamed('parent', 'form');
$parent->add($this->factory->createNamed('form', 'child')); $parent->add($this->factory->createNamed('child', 'form'));
$parent['child']->add($this->factory->createNamed('form', 'grand_child')); $parent['child']->add($this->factory->createNamed('grand_child', 'form'));
$view = $parent->createView(); $view = $parent->createView();
$this->assertEquals('parent_child_grand_child', $view['child']['grand_child']->get('id')); $this->assertEquals('parent_child_grand_child', $view['child']['grand_child']->get('id'));
@ -145,8 +145,8 @@ class FormTypeTest extends TypeTestCase
public function testNonReadOnlyFormWithReadOnlyParentBeingReadOnly() public function testNonReadOnlyFormWithReadOnlyParentBeingReadOnly()
{ {
$parent = $this->factory->createNamed('form', 'parent', null, array('read_only' => true)); $parent = $this->factory->createNamed('parent', 'form', null, array('read_only' => true));
$child = $this->factory->createNamed('form', 'child'); $child = $this->factory->createNamed('child', 'form');
$view = $parent->add($child)->createView(); $view = $parent->add($child)->createView();
$this->assertTrue($view['child']->get('read_only')); $this->assertTrue($view['child']->get('read_only'));
@ -154,8 +154,8 @@ class FormTypeTest extends TypeTestCase
public function testReadOnlyFormWithNonReadOnlyParentBeingReadOnly() public function testReadOnlyFormWithNonReadOnlyParentBeingReadOnly()
{ {
$parent = $this->factory->createNamed('form', 'parent'); $parent = $this->factory->createNamed('parent', 'form');
$child = $this->factory->createNamed('form', 'child', null, array('read_only' => true)); $child = $this->factory->createNamed('child', 'form', null, array('read_only' => true));
$view = $parent->add($child)->createView(); $view = $parent->add($child)->createView();
$this->assertTrue($view['child']->get('read_only')); $this->assertTrue($view['child']->get('read_only'));
@ -163,8 +163,8 @@ class FormTypeTest extends TypeTestCase
public function testNonReadOnlyFormWithNonReadOnlyParentBeingNonReadOnly() public function testNonReadOnlyFormWithNonReadOnlyParentBeingNonReadOnly()
{ {
$parent = $this->factory->createNamed('form', 'parent'); $parent = $this->factory->createNamed('parent', 'form');
$child = $this->factory->createNamed('form', 'child'); $child = $this->factory->createNamed('child', 'form');
$view = $parent->add($child)->createView(); $view = $parent->add($child)->createView();
$this->assertFalse($view['child']->get('read_only')); $this->assertFalse($view['child']->get('read_only'));
@ -188,7 +188,7 @@ class FormTypeTest extends TypeTestCase
public function testPassDefaultLabelToView() public function testPassDefaultLabelToView()
{ {
$form = $this->factory->createNamed('form', '__test___field'); $form = $this->factory->createNamed('__test___field', 'form');
$view = $form->createView(); $view = $form->createView();
$this->assertSame('Test field', $view->get('label')); $this->assertSame('Test field', $view->get('label'));
@ -196,7 +196,7 @@ class FormTypeTest extends TypeTestCase
public function testPassLabelToView() public function testPassLabelToView()
{ {
$form = $this->factory->createNamed('form', '__test___field', null, array('label' => 'My label')); $form = $this->factory->createNamed('__test___field', 'form', null, array('label' => 'My label'));
$view = $form->createView(); $view = $form->createView();
$this->assertSame('My label', $view->get('label')); $this->assertSame('My label', $view->get('label'));
@ -216,8 +216,8 @@ class FormTypeTest extends TypeTestCase
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'required' => false, 'required' => false,
)); ));
$form->add($this->factory->createNamed('form', 'firstName')); $form->add($this->factory->createNamed('firstName', 'form'));
$form->add($this->factory->createNamed('form', 'lastName')); $form->add($this->factory->createNamed('lastName', 'form'));
$form->setData(null); $form->setData(null);
// partially empty, still an object is created // partially empty, still an object is created
@ -237,8 +237,8 @@ class FormTypeTest extends TypeTestCase
'data' => new Author(), 'data' => new Author(),
'required' => false, 'required' => false,
)); ));
$form->add($this->factory->createNamed('form', 'firstName')); $form->add($this->factory->createNamed('firstName', 'form'));
$form->add($this->factory->createNamed('form', 'lastName')); $form->add($this->factory->createNamed('lastName', 'form'));
$form->setData(null); $form->setData(null);
// partially empty, still an object is created // partially empty, still an object is created
@ -257,7 +257,7 @@ class FormTypeTest extends TypeTestCase
'data_class' => null, 'data_class' => null,
'required' => false, 'required' => false,
)); ));
$form->add($this->factory->createNamed('form', 'firstName')); $form->add($this->factory->createNamed('firstName', 'form'));
$form->setData(null); $form->setData(null);
$form->bind(array('firstName' => 'Bernhard')); $form->bind(array('firstName' => 'Bernhard'));
@ -271,8 +271,8 @@ class FormTypeTest extends TypeTestCase
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'required' => false, 'required' => false,
)); ));
$form->add($this->factory->createNamed('form', 'firstName')); $form->add($this->factory->createNamed('firstName', 'form'));
$form->add($this->factory->createNamed('form', 'lastName')); $form->add($this->factory->createNamed('lastName', 'form'));
$form->setData(null); $form->setData(null);
$form->bind(array('firstName' => '', 'lastName' => '')); $form->bind(array('firstName' => '', 'lastName' => ''));
@ -286,8 +286,8 @@ class FormTypeTest extends TypeTestCase
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'required' => true, 'required' => true,
)); ));
$form->add($this->factory->createNamed('form', 'firstName')); $form->add($this->factory->createNamed('firstName', 'form'));
$form->add($this->factory->createNamed('form', 'lastName')); $form->add($this->factory->createNamed('lastName', 'form'));
$form->setData(null); $form->setData(null);
$form->bind(array('firstName' => '', 'lastName' => '')); $form->bind(array('firstName' => '', 'lastName' => ''));
@ -301,7 +301,7 @@ class FormTypeTest extends TypeTestCase
public function testBindWithEmptyDataStoresArrayIfNoClassAvailable() public function testBindWithEmptyDataStoresArrayIfNoClassAvailable()
{ {
$form = $this->factory->create('form'); $form = $this->factory->create('form');
$form->add($this->factory->createNamed('form', 'firstName')); $form->add($this->factory->createNamed('firstName', 'form'));
$form->setData(null); $form->setData(null);
$form->bind(array('firstName' => 'Bernhard')); $form->bind(array('firstName' => 'Bernhard'));
@ -333,7 +333,7 @@ class FormTypeTest extends TypeTestCase
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author', 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'empty_data' => $author, 'empty_data' => $author,
)); ));
$form->add($this->factory->createNamed('form', 'firstName')); $form->add($this->factory->createNamed('firstName', 'form'));
$form->bind(array('firstName' => 'Bernhard')); $form->bind(array('firstName' => 'Bernhard'));
@ -381,7 +381,7 @@ class FormTypeTest extends TypeTestCase
public function testNameCanBeEmptyString() public function testNameCanBeEmptyString()
{ {
$form = $this->factory->createNamed('form', ''); $form = $this->factory->createNamed('', 'form');
$this->assertEquals('', $form->getName()); $this->assertEquals('', $form->getName());
} }
@ -569,7 +569,7 @@ class FormTypeTest extends TypeTestCase
public function testPropertyPathNullImpliesDefault() public function testPropertyPathNullImpliesDefault()
{ {
$form = $this->factory->createNamed('form', 'name', null, array( $form = $this->factory->createNamed('name', 'form', null, array(
'property_path' => null, 'property_path' => null,
)); ));
@ -580,7 +580,7 @@ class FormTypeTest extends TypeTestCase
// BC // BC
public function testPropertyPathFalseImpliesDefaultNotMapped() public function testPropertyPathFalseImpliesDefaultNotMapped()
{ {
$form = $this->factory->createNamed('form', 'name', null, array( $form = $this->factory->createNamed('name', 'form', null, array(
'property_path' => false, 'property_path' => false,
)); ));

View File

@ -71,7 +71,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
public function testNoCsrfProtectionByDefaultIfNotSingleControlButNotRoot() public function testNoCsrfProtectionByDefaultIfNotSingleControlButNotRoot()
{ {
$view = $this->factory $view = $this->factory
->createNamedBuilder('form', 'root') ->createNamedBuilder('root', 'form')
->add($this->factory ->add($this->factory
->createNamedBuilder('form', 'form', null, array( ->createNamedBuilder('form', 'form', null, array(
'csrf_field_name' => 'csrf', 'csrf_field_name' => 'csrf',
@ -198,7 +198,7 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
->method('isCsrfTokenValid'); ->method('isCsrfTokenValid');
$form = $this->factory $form = $this->factory
->createNamedBuilder('form', 'root') ->createNamedBuilder('root', 'form')
->add($this->factory ->add($this->factory
->createNamedBuilder('form', 'form', null, array( ->createNamedBuilder('form', 'form', null, array(
'csrf_field_name' => 'csrf', 'csrf_field_name' => 'csrf',

View File

@ -82,7 +82,7 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase
{ {
$this->factory->expects($this->once()) $this->factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'foo') ->with('foo', 'text')
->will($this->returnValue(new FormBuilder('foo', null, $this->dispatcher, $this->factory))); ->will($this->returnValue(new FormBuilder('foo', null, $this->dispatcher, $this->factory)));
$this->assertCount(0, $this->builder->all()); $this->assertCount(0, $this->builder->all());
@ -120,7 +120,7 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase
{ {
$this->factory->expects($this->once()) $this->factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'foo', null, array()) ->with('foo', 'text', null, array())
; ;
$builder = $this->builder->create('foo'); $builder = $this->builder->create('foo');
@ -140,7 +140,7 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase
$this->factory->expects($this->once()) $this->factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with($expectedType, $expectedName, null, $expectedOptions) ->with($expectedName, $expectedType, null, $expectedOptions)
->will($this->returnValue($this->getFormBuilder())); ->will($this->returnValue($this->getFormBuilder()));
$this->builder->add($expectedName, $expectedType, $expectedOptions); $this->builder->add($expectedName, $expectedType, $expectedOptions);
@ -192,7 +192,7 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase
$this->factory $this->factory
->expects($this->once()) ->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'bar', null, array(), $this->builder) ->with('bar', 'text', null, array(), $this->builder)
; ;
$this->factory $this->factory

View File

@ -118,7 +118,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$type = new FooType(); $type = new FooType();
$this->extension1->addType($type); $this->extension1->addType($type);
$builder = $this->factory->createNamedBuilder('foo', 'bar'); $builder = $this->factory->createNamedBuilder('bar', 'foo');
$this->assertTrue($builder instanceof FormBuilder); $this->assertTrue($builder instanceof FormBuilder);
$this->assertEquals('bar', $builder->getName()); $this->assertEquals('bar', $builder->getName());
@ -135,7 +135,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$this->extension2->addTypeExtension($ext2); $this->extension2->addTypeExtension($ext2);
$this->extension2->addType($type); $this->extension2->addType($type);
$builder = $this->factory->createNamedBuilder('foo', 'bar'); $builder = $this->factory->createNamedBuilder('bar', 'foo');
$this->assertTrue($builder->hasAttribute('foo')); $this->assertTrue($builder->hasAttribute('foo'));
$this->assertTrue($builder->hasAttribute('bar')); $this->assertTrue($builder->hasAttribute('bar'));
@ -147,7 +147,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$type = new FooType(); $type = new FooType();
$this->extension1->addType($type); $this->extension1->addType($type);
$builder = $this->factory->createNamedBuilder('foo', 'bar', 'xyz'); $builder = $this->factory->createNamedBuilder('bar', 'foo', 'xyz');
// see FooType::buildForm() // see FooType::buildForm()
$this->assertEquals('xyz', $builder->getAttribute('data_option')); $this->assertEquals('xyz', $builder->getAttribute('data_option'));
@ -158,7 +158,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$type = new FooType(); $type = new FooType();
$this->extension1->addType($type); $this->extension1->addType($type);
$builder = $this->factory->createNamedBuilder('foo', 'bar', 'xyz', array( $builder = $this->factory->createNamedBuilder('bar', 'foo', 'xyz', array(
'data' => 'abc', 'data' => 'abc',
)); ));
@ -181,7 +181,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$this->extension1->addType($type); $this->extension1->addType($type);
$this->factory->createNamedBuilder('foo', 'bar'); $this->factory->createNamedBuilder('bar', 'foo');
} }
/** /**
@ -199,7 +199,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$this->extension1->addType($type); $this->extension1->addType($type);
$this->factory->createNamedBuilder('foo', 'bar'); $this->factory->createNamedBuilder('bar', 'foo');
} }
/** /**
@ -217,7 +217,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$this->extension1->addType($type); $this->extension1->addType($type);
$this->factory->createNamedBuilder('foo', 'bar'); $this->factory->createNamedBuilder('bar', 'foo');
} }
/** /**
@ -238,7 +238,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$this->extension1->addType($type); $this->extension1->addType($type);
$this->factory->createNamedBuilder('foo', 'bar'); $this->factory->createNamedBuilder('bar', 'foo');
} }
/** /**
@ -249,7 +249,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$type = new FooType(); $type = new FooType();
$this->extension1->addType($type); $this->extension1->addType($type);
$this->factory->createNamedBuilder('foo', 'bar', null, array( $this->factory->createNamedBuilder('bar', 'foo', null, array(
'invalid' => 'xyz', 'invalid' => 'xyz',
)); ));
} }
@ -262,7 +262,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$type = new FooType(); $type = new FooType();
$this->extension1->addType($type); $this->extension1->addType($type);
$this->factory->createNamedBuilder('foo', 'bar', null, array( $this->factory->createNamedBuilder('bar', 'foo', null, array(
'a_or_b' => 'c', 'a_or_b' => 'c',
)); ));
} }
@ -274,7 +274,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$this->extension1->addTypeExtension(new FooTypeBarExtension()); $this->extension1->addTypeExtension(new FooTypeBarExtension());
// no exception this time // no exception this time
$this->factory->createNamedBuilder('foo', 'bar', null, array( $this->factory->createNamedBuilder('bar', 'foo', null, array(
'a_or_b' => 'c', 'a_or_b' => 'c',
)); ));
} }
@ -284,7 +284,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$type = new FooType(); $type = new FooType();
$this->assertFalse($this->factory->hasType('foo')); $this->assertFalse($this->factory->hasType('foo'));
$builder = $this->factory->createNamedBuilder($type, 'bar'); $builder = $this->factory->createNamedBuilder('bar', $type);
$this->assertTrue($builder instanceof FormBuilder); $this->assertTrue($builder instanceof FormBuilder);
$this->assertTrue($this->factory->hasType('foo')); $this->assertTrue($this->factory->hasType('foo'));
@ -296,7 +296,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
*/ */
public function testCreateNamedBuilderThrowsUnderstandableException() public function testCreateNamedBuilderThrowsUnderstandableException()
{ {
$this->factory->createNamedBuilder(new \StdClass, 'name'); $this->factory->createNamedBuilder('name', new \stdClass());
} }
public function testCreateUsesTypeNameAsName() public function testCreateUsesTypeNameAsName()
@ -333,7 +333,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('password', 'firstName', null, array('max_length' => 7)) ->with('firstName', 'password', null, array('max_length' => 7))
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty('Application\Author', 'firstName'); $builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
@ -352,7 +352,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'firstName') ->with('firstName', 'text')
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty('Application\Author', 'firstName'); $builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
@ -375,7 +375,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'firstName', null, array('max_length' => 11)) ->with('firstName', 'text', null, array('max_length' => 11))
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty( $builder = $factory->createBuilderForProperty(
@ -410,7 +410,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'firstName', null, array('max_length' => 20)) ->with('firstName', 'text', null, array('max_length' => 20))
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty( $builder = $factory->createBuilderForProperty(
@ -443,7 +443,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'firstName', null, array('pattern' => '.{5,}')) ->with('firstName', 'text', null, array('pattern' => '.{5,}'))
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty( $builder = $factory->createBuilderForProperty(
@ -478,7 +478,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'firstName', null, array('pattern' => '.{5,10}')) ->with('firstName', 'text', null, array('pattern' => '.{5,10}'))
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty( $builder = $factory->createBuilderForProperty(
@ -511,7 +511,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'firstName', null, array('required' => false)) ->with('firstName', 'text', null, array('required' => false))
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty( $builder = $factory->createBuilderForProperty(
@ -544,7 +544,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->once()) $factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'firstName', null, array('pattern' => '/[a-zA-Z]/')) ->with('firstName', 'text', null, array('pattern' => '/[a-zA-Z]/'))
->will($this->returnValue('builderInstance')); ->will($this->returnValue('builderInstance'));
$builder = $factory->createBuilderForProperty( $builder = $factory->createBuilderForProperty(
@ -565,7 +565,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
->getMock() ->getMock()
; ;
$builder = $this->factory->createNamedBuilder('foo', 'bar', null, array(), $parentBuilder); $builder = $this->factory->createNamedBuilder('bar', 'foo', null, array(), $parentBuilder);
$this->assertNotEquals($builder, $builder->getParent()); $this->assertNotEquals($builder, $builder->getParent());
$this->assertEquals($parentBuilder, $builder->getParent()); $this->assertEquals($parentBuilder, $builder->getParent());
@ -575,7 +575,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
{ {
$factory = new FormFactory(array(new \Symfony\Component\Form\Extension\Core\CoreExtension())); $factory = new FormFactory(array(new \Symfony\Component\Form\Extension\Core\CoreExtension()));
$form = $factory->createNamedBuilder(new AuthorType(), 'author')->getForm(); $form = $factory->createNamedBuilder('author', new AuthorType())->getForm();
$form->bind(array('firstName' => 'John', 'lastName' => 'Smith')); $form->bind(array('firstName' => 'John', 'lastName' => 'Smith'));
$author = new Author(); $author = new Author();

View File

@ -296,7 +296,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
{ {
$this->factory->expects($this->once()) $this->factory->expects($this->once())
->method('createNamedBuilder') ->method('createNamedBuilder')
->with('text', 'name', null, array()) ->with('name', 'text', null, array())
->will($this->returnValue($this->getBuilder('name'))); ->will($this->returnValue($this->getBuilder('name')));
$form = $this->getBuilder('person') $form = $this->getBuilder('person')