@@ -190,6 +190,60 @@ public function flattenDataProvider()
190
190
);
191
191
}
192
192
193
+ public function testArguments ()
194
+ {
195
+ $ dh = opendir (__DIR__ );
196
+
197
+ $ incomplete = unserialize ('O:14:"BogusTestClass":0:{} ' );
198
+
199
+ $ exception = $ this ->createException (array (
200
+ (object ) array ('foo ' => 1 ),
201
+ new NotFoundHttpException (),
202
+ $ incomplete ,
203
+ $ dh ,
204
+ function () {},
205
+ array (1 , 2 ),
206
+ array ('foo ' => 123 ),
207
+ null ,
208
+ true ,
209
+ false ,
210
+ 0 ,
211
+ 0.0 ,
212
+ '0 ' ,
213
+ '' ,
214
+ INF ,
215
+ NAN ,
216
+ ));
217
+
218
+ $ flattened = FlattenException::create ($ exception );
219
+ $ trace = $ flattened ->getTrace ();
220
+ $ args = $ trace [1 ]['args ' ];
221
+ $ array = $ args [0 ][1 ];
222
+
223
+ closedir ($ dh );
224
+
225
+ $ i = 0 ;
226
+ $ this ->assertSame ($ array [$ i ++], array ('object ' , 'stdClass ' ));
227
+ $ this ->assertSame ($ array [$ i ++], array ('object ' , 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException ' ));
228
+ $ this ->assertSame ($ array [$ i ++], array ('incomplete-object ' , 'BogusTestClass ' ));
229
+ $ this ->assertSame ($ array [$ i ++], array ('resource ' , 'stream ' ));
230
+ $ this ->assertSame ($ array [$ i ++], array ('object ' , 'Closure ' ));
231
+ $ this ->assertSame ($ array [$ i ++], array ('array ' , array (array ('integer ' , 1 ), array ('integer ' , 2 ))));
232
+ $ this ->assertSame ($ array [$ i ++], array ('array ' , array ('foo ' => array ('integer ' , 123 ))));
233
+ $ this ->assertSame ($ array [$ i ++], array ('null ' , null ));
234
+ $ this ->assertSame ($ array [$ i ++], array ('boolean ' , true ));
235
+ $ this ->assertSame ($ array [$ i ++], array ('boolean ' , false ));
236
+ $ this ->assertSame ($ array [$ i ++], array ('integer ' , 0 ));
237
+ $ this ->assertSame ($ array [$ i ++], array ('float ' , 0.0 ));
238
+ $ this ->assertSame ($ array [$ i ++], array ('string ' , '0 ' ));
239
+ $ this ->assertSame ($ array [$ i ++], array ('string ' , '' ));
240
+ $ this ->assertSame ($ array [$ i ++], array ('float ' , INF ));
241
+
242
+ // assertEquals() does not like NAN values.
243
+ $ this ->assertEquals ($ array [$ i ][0 ], 'float ' );
244
+ $ this ->assertTrue (is_nan ($ array [$ i ++][1 ]));
245
+ }
246
+
193
247
public function testRecursionInArguments ()
194
248
{
195
249
$ a = array ('foo ' , array (2 , &$ a ));
@@ -216,6 +270,9 @@ public function testTooBigArray()
216
270
217
271
$ flattened = FlattenException::create ($ exception );
218
272
$ trace = $ flattened ->getTrace ();
273
+
274
+ $ this ->assertSame ($ trace [1 ]['args ' ][0 ], array ('array ' , array ('array ' , '*SKIPPED over 10000 entries* ' )));
275
+
219
276
$ serializeTrace = serialize ($ trace );
220
277
221
278
$ this ->assertContains ('*SKIPPED over 10000 entries* ' , $ serializeTrace );
@@ -226,45 +283,4 @@ private function createException($foo)
226
283
{
227
284
return new \Exception ();
228
285
}
229
-
230
- public function testSetTraceIncompleteClass ()
231
- {
232
- $ flattened = FlattenException::create (new \Exception ('test ' , 123 ));
233
- $ flattened ->setTrace (
234
- array (
235
- array (
236
- 'file ' => __FILE__ ,
237
- 'line ' => 123 ,
238
- 'function ' => 'test ' ,
239
- 'args ' => array (
240
- unserialize ('O:14:"BogusTestClass":0:{} ' ),
241
- ),
242
- ),
243
- ),
244
- 'foo.php ' , 123
245
- );
246
-
247
- $ this ->assertEquals (array (
248
- array (
249
- 'message ' => 'test ' ,
250
- 'class ' => 'Exception ' ,
251
- 'trace ' => array (
252
- array (
253
- 'namespace ' => '' , 'short_class ' => '' , 'class ' => '' , 'type ' => '' , 'function ' => '' ,
254
- 'file ' => 'foo.php ' , 'line ' => 123 ,
255
- 'args ' => array (),
256
- ),
257
- array (
258
- 'namespace ' => '' , 'short_class ' => '' , 'class ' => '' , 'type ' => '' , 'function ' => 'test ' ,
259
- 'file ' => __FILE__ , 'line ' => 123 ,
260
- 'args ' => array (
261
- array (
262
- 'incomplete-object ' , 'BogusTestClass ' ,
263
- ),
264
- ),
265
- ),
266
- ),
267
- ),
268
- ), $ flattened ->toArray ());
269
- }
270
286
}
0 commit comments