Skip to content

Commit 2d03ee8

Browse files
committed
[Debug] fix resource type test on HHVM
1 parent 92d80c9 commit 2d03ee8

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public function flattenDataProvider()
193193
public function testArguments()
194194
{
195195
$dh = opendir(__DIR__);
196+
$fh = tmpfile();
196197

197198
$incomplete = unserialize('O:14:"BogusTestClass":0:{}');
198199

@@ -201,6 +202,7 @@ public function testArguments()
201202
new NotFoundHttpException(),
202203
$incomplete,
203204
$dh,
205+
$fh,
204206
function() {},
205207
array(1, 2),
206208
array('foo' => 123),
@@ -221,23 +223,29 @@ function() {},
221223
$array = $args[0][1];
222224

223225
closedir($dh);
226+
fclose($fh);
224227

225228
$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));
229+
$this->assertSame(array('object', 'stdClass'), $array[$i++]);
230+
$this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]);
231+
$this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]);
232+
$this->assertSame(array('resource', defined('HHVM_VERSION') ? 'Directory' : 'stream'), $array[$i++]);
233+
$this->assertSame(array('resource', 'stream'), $array[$i++]);
234+
235+
$args = $array[$i++];
236+
$this->assertSame($args[0], 'object');
237+
$this->assertTrue('Closure' === $args[1] || is_subclass_of($args[1], '\Closure'), 'Expect object class name to be Closure or a subclass of Closure.');
238+
239+
$this->assertSame(array('array', array(array('integer', 1), array('integer', 2))), $array[$i++]);
240+
$this->assertSame(array('array', array('foo' => array('integer', 123))), $array[$i++]);
241+
$this->assertSame(array('null', null), $array[$i++]);
242+
$this->assertSame(array('boolean', true), $array[$i++]);
243+
$this->assertSame(array('boolean', false), $array[$i++]);
244+
$this->assertSame(array('integer', 0), $array[$i++]);
245+
$this->assertSame(array('float', 0.0), $array[$i++]);
246+
$this->assertSame(array('string', '0'), $array[$i++]);
247+
$this->assertSame(array('string', ''), $array[$i++]);
248+
$this->assertSame(array('float', INF), $array[$i++]);
241249

242250
// assertEquals() does not like NAN values.
243251
$this->assertEquals($array[$i][0], 'float');

0 commit comments

Comments
 (0)