8000 [2.6] Fix tests on HHVM · symfony/symfony@298e72d · GitHub
[go: up one dir, main page]

Skip to content

Commit 298e72d

Browse files
[2.6] Fix tests on HHVM
1 parent 4f833b0 commit 298e72d

File tree

6 files changed

+27
-23
lines changed

6 files changed

+27
-23
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ addons:
99

1010
matrix:
1111
include:
12+
- php: 5.5
1213
- php: hhvm
1314

1415
services: mongodb

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,15 +1242,9 @@ public static function closeOutputBuffers($targetLevel, $flush)
12421242
{
12431243
$status = ob_get_status(true);
12441244
$level = count($status);
1245+
$type = $flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE;
12451246

1246-
while ($level-- > $targetLevel
1247-
&& (!empty($status[$level]['del'])
1248-
|| (isset($status[$level]['flags'])
1249-
&& ($status[$level]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)
1250-
&& ($status[$level]['flags'] & ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE))
1251-
)
1252-
)
1253-
) {
1247+
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE && $s['flags'] & $type) : $s['del'])) {
12541248
if ($flush) {
12551249
ob_end_flush();
12561250
} else {

src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ public function testCastPdo()
4545
'ORACLE_NULLS' => $attr['ORACLE_NULLS'],
4646
'CLIENT_VERSION' => $pdo->getAttribute(\PDO::ATTR_CLIENT_VERSION),
4747
'SERVER_VERSION' => $pdo->getAttribute(\PDO::ATTR_SERVER_VERSION),
48-
'STATEMENT_CLASS' => array(
49-
'PDOStatement',
50-
array($pdo),
51-
),
48+
'STATEMENT_CLASS' => array('PDOStatement'),
5249
'DEFAULT_FETCH_MODE' => $attr['DEFAULT_FETCH_MODE'],
5350
),
5451
);
52+
unset($cast["\0~\0attributes"]['STATEMENT_CLASS'][1]);
5553

5654
$this->assertSame($xCast, $cast);
5755
}

src/Symfony/Component/VarDumper/Tests/CliDumperTest.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testGet()
2828
$cloner = new VarCloner();
2929
$cloner->addCasters(array(
3030
':stream' => function ($res, $a) {
31-
unset($a['uri']);
31+
unset($a['uri'], $a['wrapper_data']);
3232

3333
return $a;
3434
},
@@ -43,6 +43,7 @@ public function testGet()
4343
$res1 = (int) $var['res'];
4444
$res2 = (int) $var[8];
4545

46+
$r = defined('HHVM_VERSION') ? '' : '#%d';
4647
$this->assertStringMatchesFormat(
4748
<<<EOTXT
4849
array:25 [
@@ -74,7 +75,7 @@ public function testGet()
7475
+foo: "foo"
7576
+"bar": "bar"
7677
}
77-
"closure" => Closure {#%d
78+
"closure" => Closure {{$r}
7879
reflection: """
7980
Closure [ <user%S> %s Symfony\Component\VarDumper\Tests\Fixture\{closure} ] {\\n
8081
@@ {$var['file']} {$var['line']} - {$var['line']}\\n
@@ -114,6 +115,13 @@ public function testThrowingCaster()
114115
$dumper = new CliDumper();
115116
$dumper->setColors(false);
116117
$cloner = new VarCloner();
118+
$cloner->addCasters(array(
119+
':stream' => function ($res, $a) {
120+
unset($a['wrapper_data']);
121+
122+
return $a;
123+
},
124+
));
117125
$cloner->addCasters(array(
118126
':stream' => function () {
119127
throw new \Exception('Foobar');
@@ -128,24 +136,25 @@ public function testThrowingCaster()
128136
rewind($out);
129137
$out = stream_get_contents($out);
130138

139+
$r = defined('HHVM_VERSION') ? '' : '#%d';
131140
$this->assertStringMatchesFormat(
132141
<<<EOTXT
133142
stream resource {@{$ref}
134143
wrapper_type: "PHP"
135144
stream_type: "MEMORY"
136-
mode: "w+b"
145+
mode: "%s+b"
137146
unread_bytes: 0
138147
seekable: true
139148
uri: "php://memory"
140149
timed_out: false
141150
blocked: true
142151
eof: false
143152
options: []
144-
⚠: Symfony\Component\VarDumper\Exception\ThrowingCasterException {#%d
153+
⚠: Symfony\Component\VarDumper\Exception\ThrowingCasterException {{$r}
145154
#message: "Unexpected Exception thrown from a caster: Foobar"
146155
trace: array:1 [
147156
0 => array:2 [
148-
"call" => "%s{closure}()"
157+
"call" => "%slosure%s()"
149158
"file" => "{$file}:{$line}"
150159
]
151160
]
@@ -173,9 +182,10 @@ public function testRefsInProperties()
173182
rewind($out);
174183
$out = stream_get_contents($out);
175184

185+
$r = defined('HHVM_VERSION') ? '' : '#%d';
176186
$this->assertStringMatchesFormat(
177187
<<<EOTXT
178-
{#%d
188+
{{$r}
179189
+"foo": &1 "foo"
180190
+"bar": &1 "foo"
181191
}

src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testGet()
2929
$cloner = new VarCloner();
3030
$cloner->addCasters(array(
3131
':stream' => function ($res, $a) {
32-
unset($a['uri']);
32+
unset($a['uri'], $a['wrapper_data']);
3333

3434
return $a;
3535
},
@@ -47,6 +47,7 @@ public function testGet()
4747
$res1 = (int) $var['res'];
4848
$res2 = (int) $var[8];
4949

50+
$r = defined('HHVM_VERSION') ? '' : '<a class=sf-dump-ref>#%d</a>';
5051
$this->assertStringMatchesFormat(
5152
<<<EOTXT
5253
<foo></foo><bar><span class=sf-dump-note>array:25</span> [<samp>
@@ -78,7 +79,7 @@ public function testGet()
7879
+<span class=sf-dump-public title="Public property">foo</span>: "<span class=sf-dump-str title="3 characters">foo</span>"
7980
+"<span class=sf-dump-public title="Runtime added dynamic property">bar</span>": "<span class=sf-dump-str title="3 characters">bar</span>"
8081
</samp>}
81-
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure</span> {<a class=sf-dump-ref>#%d</a><samp>
82+
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure</span> {{$r}<samp>
8283
<span class=sf-dump-meta>reflection</span>: """
8384
<span class=sf-dump-str title="%d characters">Closure [ &lt;user%S&gt; %s Symfony\Component\VarDumper\Tests\Fixture\{closure} ] {</span>\\n
8485
<span class=sf-dump-str title="%d characters"> @@ {$var['file']} {$var['line']} - {$var['line']}</span>\\n

src/Symfony/Component/VarDumper/Tests/VarClonerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testClone()
8181
[class] => stdClass
8282
[value] =>
8383
[cut] => 0
84-
[handle] => %d
84+
[handle] => %i
8585
[refCount] => 0
8686
[position] => 1
8787
)
@@ -96,7 +96,7 @@ public function testClone()
9696
[class] => stdClass
9797
[value] =>
9898
[cut] => 0
99-
[handle] => %d
99+
[handle] => %i
100100
[refCount] => 0
101101
[position] => 2
102102
)
@@ -107,7 +107,7 @@ public function testClone()
107107
[class] => stdClass
108108
[value] =>
109109
[cut] => 0
110-
[handle] => %d
110+
[handle] => %i
111111
[refCount] => 0
112112
[position] => 3
113113
)

0 commit comments

Comments
 (0)
0