Skip to content

Commit

Permalink
add reproducer to show broken behavior with integer form children
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Oct 23, 2023
1 parent 080b32f commit 812d73a
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormError;
Expand Down Expand Up @@ -236,6 +238,23 @@ public function testMergeParamsAndFiles($method)
$this->assertSame($file, $form->get('field2')->getData());
}

public function testIntegerChildren(): void
{
$form = $this->createForm('root', 'POST', true);
$form->add('0', TextType::class);
$form->add('1', TextType::class);

$this->setRequestData('POST', [
'root' => [
1 => 'bar',
]
]);

$this->requestHandler->handleRequest($form, $this->request);

$this->assertNull($form->get('0')->getData());
$this->assertSame('bar', $form->get('1')->getData());
}
/**
* @dataProvider methodExceptGetProvider
*/
Expand Down

0 comments on commit 812d73a

Please sign in to comment.