@@ -108,7 +108,7 @@ public function testTransformNull()
108
108
/**
109
109
* @param mixed $value
110
110
*
111
- * @dataProvider providerTransformNoObject
111
+ * @dataProvider providerNoObject
112
112
*
113
113
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
114
114
* @expectedExceptionMessage Expected an object.
@@ -120,22 +120,6 @@ public function testTransformNoObject($value)
120
120
$ transformer ->transform ($ value );
121
121
}
122
122
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
-
139
123
/**
140
124
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
141
125
* @expectedExceptionMessage Expected entity DarkWebDesign\SymfonyAddon\Transformer\Tests\Models\City.
@@ -181,7 +165,7 @@ public function testReverseTransformEmptyString()
181
165
/**
182
166
* @param mixed $value
183
167
*
184
- * @dataProvider providerReverseTransformNoScalar
168
+ * @dataProvider providerNoScalar
185
169
*
186
170
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
187
171
* @expectedExceptionMessage Expected a scalar.
@@ -193,29 +177,45 @@ public function testReverseTransformNoScalar($value)
193
177
$ transformer ->reverseTransform ($ value );
194
178
}
195
179
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
+
196
193
/**
197
194
* @return array[]
198
195
*/
199
- public function providerReverseTransformNoScalar ()
196
+ public function providerNoObject ()
200
197
{
201
198
return array (
199
+ 'bool ' => array (true ),
200
+ 'int ' => array (1 ),
201
+ 'float ' => array (1.2 ),
202
+ 'string ' => array ('foo ' ),
202
203
'array ' => array (array ('foo ' , 'bar ' )),
203
- 'object ' => array (new stdClass ()),
204
204
'resource ' => array (tmpfile ()),
205
- 'callable ' => array (function () {}),
205
+ 'callable ' => array (function () {})
206
206
);
207
207
}
208
208
209
209
/**
210
- * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
211
- * @expectedExceptionMessage Entity DarkWebDesign\SymfonyAddon\Transformer\Tests\Models\City with identifier "123" not found.
210
+ * @return array[]
212
211
*/
213
- public function testReverseTransformEntityNotFound ()
212
+ public function providerNoScalar ()
214
213
{
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
+ );
220
220
}
221
221
}
0 commit comments