Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Fixed wrong usages of the "text" type #16677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ public function add($child, $type = null, array $options = array())
$options['auto_initialize'] = false;

if (null === $type && null === $this->config->getDataClass()) {
$type = 'text';
$type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes me think we are not covering this in the testsuite, as it would have triggered a deprecation warning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, since this is mocked out. The test suite explicitly tests for text.

}

if (null === $type) {
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/Form/Tests/CompoundFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ public function testAddUsingNameAndType()

$this->factory->expects($this->once())
->method('createNamed')
->with('foo', 'text', null, array(
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'bar' => 'baz',
'auto_initialize' => false,
))
->will($this->returnValue($child));

$this->form->add('foo', 'text', array('bar' => 'baz'));
$this->form->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('bar' => 'baz'));

$this->assertTrue($this->form->has('foo'));
$this->assertSame($this->form, $child->getParent());
Expand All @@ -191,14 +191,14 @@ public function testAddUsingIntegerNameAndType()

$this->factory->expects($this->once())
->method('createNamed')
->with('0', 'text', null, array(
->with('0', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'bar' => 'baz',
'auto_initialize' => false,
))
->will($this->returnValue($child));

// in order to make casting unnecessary
$this->form->add(0, 'text', array('bar' => 'baz'));
$this->form->add(0, 'Symfony\Component\Form\Extension\Core\Type\TextType', array('bar' => 'baz'));

$this->assertTrue($this->form->has(0));
$this->assertSame($this->form, $child->getParent());
Expand All @@ -211,7 +211,7 @@ public function testAddWithoutType()

$this->factory->expects($this->once())
->method('createNamed')
->with('foo', 'text')
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->will($this->returnValue($child));

$this->form->add('foo');
Expand Down