@@ -108,7 +108,7 @@ public function testTransformNull()
108108 /**
109109 * @param mixed $value
110110 *
111- * @dataProvider providerTransformNoObject
111+ * @dataProvider providerNoObject
112112 *
113113 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
114114 * @expectedExceptionMessage Expected an object.
@@ -120,22 +120,6 @@ public function testTransformNoObject($value)
120120 $ transformer ->transform ($ value );
121121 }
122122
123- /**
124- * @return array[]
125- */
126- public function providerTransformNoObject ()
127- {
128- return array (
129- 'bool ' => array (true ),
130- 'int ' => array (1 ),
131- 'float ' => array (1.2 ),
132- 'string ' => array ('foo ' ),
133- 'array ' => array (array ('foo ' , 'bar ' )),
134- 'resource ' => array (tmpfile ()),
135- 'callable ' => array (function () {})
136- );
137- }
138-
139123 /**
140124 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
141125 * @expectedExceptionMessage Expected entity DarkWebDesign\SymfonyAddon\Transformer\Tests\Models\City.
@@ -181,7 +165,7 @@ public function testReverseTransformEmptyString()
181165 /**
182166 * @param mixed $value
183167 *
184- * @dataProvider providerReverseTransformNoScalar
168+ * @dataProvider providerNoScalar
185169 *
186170 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
187171 * @expectedExceptionMessage Expected a scalar.
@@ -193,29 +177,45 @@ public function testReverseTransformNoScalar($value)
193177 $ transformer ->reverseTransform ($ value );
194178 }
195179
180+ /**
181+ * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
182+ * @expectedExceptionMessage Entity DarkWebDesign\SymfonyAddon\Transformer\Tests\Models\City with identifier "123" not found.
183+ */
184+ public function testReverseTransformEntityNotFound ()
185+ {
186+ $ transformer = new EntityToIdentifierTransformer ($ this ->entityManager , $ this ->className );
187+
188+ $ this ->repository ->method ('find ' )->willReturn (null );
189+
190+ $ transformer ->reverseTransform ($ this ->identifier );
191+ }
192+
196193 /**
197194 * @return array[]
198195 */
199- public function providerReverseTransformNoScalar ()
196+ public function providerNoObject ()
200197 {
201198 return array (
199+ 'bool ' => array (true ),
200+ 'int ' => array (1 ),
201+ 'float ' => array (1.2 ),
202+ 'string ' => array ('foo ' ),
202203 'array ' => array (array ('foo ' , 'bar ' )),
203- 'object ' => array (new stdClass ()),
204204 'resource ' => array (tmpfile ()),
205- 'callable ' => array (function () {}),
205+ 'callable ' => array (function () {})
206206 );
207207 }
208208
209209 /**
210- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
211- * @expectedExceptionMessage Entity DarkWebDesign\SymfonyAddon\Transformer\Tests\Models\City with identifier "123" not found.
210+ * @return array[]
212211 */
213- public function testReverseTransformEntityNotFound ()
212+ public function providerNoScalar ()
214213 {
215- $ transformer = new EntityToIdentifierTransformer ($ this ->entityManager , $ this ->className );
216-
217- $ this ->repository ->method ('find ' )->willReturn (null );
218-
219- $ transformer ->reverseTransform ($ this ->identifier );
214+ return array (
215+ 'array ' => array (array ('foo ' , 'bar ' )),
216+ 'object ' => array (new stdClass ()),
217+ 'resource ' => array (tmpfile ()),
218+ 'callable ' => array (function () {}),
219+ );
220220 }
221221}
0 commit comments