From 2b94747ce8dc93091a3e9f7addbe46d9039267ec Mon Sep 17 00:00:00 2001 From: Stuart Grimshaw Date: Fri, 31 May 2013 08:23:34 +0100 Subject: [PATCH] | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.1+ | Fixed tickets | 2485 Fixes the documented example of how to test forms with custom types, as there was no better suggestions than the one put forward by @chrisburgess7 I implemented that in my test case & it worked so I've updated the documentation to match. --- cookbook/form/unit_testing.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 56703f02915..ca4a91cc6c2 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -123,6 +123,7 @@ before creating the parent form:: namespace Acme\TestBundle\Tests\Form\Type; use Acme\TestBundle\Form\Type\TestedType; + use Acme\TestBundle\Form\Forms; use Acme\TestBundle\Model\TestObject; use Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase; @@ -130,10 +131,12 @@ before creating the parent form:: { public function testBindValidData() { - $this->factory->addType(new TestChildType()); - $type = new TestedType(); - $form = $this->factory->create($type); + + $form = Forms::createFormFactoryBuilder() + ->addType(new TestChildType()) + ->getFormFactory() + ->create($type); // ... your test } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy