From c1f2407236bde86e1770aaad00973847beb82412 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Thu, 28 Jan 2016 16:20:48 +0100 Subject: [PATCH 1/2] fix types --- cookbook/form/unit_testing.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index f23b78e4a9b..52d88850358 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -52,7 +52,7 @@ The simplest ``TypeTestCase`` implementation looks like the following:: 'test2' => 'test2', ); - $type = new TestedType(); + $type = TestedType::CLASS; $form = $this->factory->create($type); $object = TestObject::fromArray($formData); @@ -78,7 +78,7 @@ First you verify if the ``FormType`` compiles. This includes basic class inheritance, the ``buildForm`` function and options resolution. This should be the first test you write:: - $type = new TestedType(); + $type = TestedType::CLASS; $form = $this->factory->create($type); This test checks that none of your data transformers used by the form @@ -139,7 +139,7 @@ before creating the parent form using the ``PreloadedExtension`` class:: { protected function getExtensions() { - $childType = new TestChildType(); + $childType = TestChildType::CLASS; return array(new PreloadedExtension(array( $childType->getName() => $childType, @@ -148,7 +148,7 @@ before creating the parent form using the ``PreloadedExtension`` class:: public function testSubmitValidData() { - $type = new TestedType(); + $type = TestedType::CLASS; $form = $this->factory->create($type); // ... your test From 040b4f36e3b829f6116480b19bf2ae2c8125f6c7 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Sat, 30 Jan 2016 20:24:28 +0100 Subject: [PATCH 2/2] fix ::class case --- cookbook/form/unit_testing.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 52d88850358..f68e874eb86 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -52,7 +52,7 @@ The simplest ``TypeTestCase`` implementation looks like the following:: 'test2' => 'test2', ); - $type = TestedType::CLASS; + $type = TestedType::class; $form = $this->factory->create($type); $object = TestObject::fromArray($formData); @@ -78,7 +78,7 @@ First you verify if the ``FormType`` compiles. This includes basic class inheritance, the ``buildForm`` function and options resolution. This should be the first test you write:: - $type = TestedType::CLASS; + $type = TestedType::class; $form = $this->factory->create($type); This test checks that none of your data transformers used by the form @@ -139,7 +139,7 @@ before creating the parent form using the ``PreloadedExtension`` class:: { protected function getExtensions() { - $childType = TestChildType::CLASS; + $childType = TestChildType::class; return array(new PreloadedExtension(array( $childType->getName() => $childType, @@ -148,7 +148,7 @@ before creating the parent form using the ``PreloadedExtension`` class:: public function testSubmitValidData() { - $type = TestedType::CLASS; + $type = TestedType::class; $form = $this->factory->create($type); // ... your test