Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit c93acbd

Browse files
committed
Fix tests to run on both PHP 7.0 and 7.1
1 parent 9f68ff8 commit c93acbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+504
-504
lines changed

tests/.testsuite.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function exception_error_handler($errno, $errstr, $errfile, $errline)
2525

2626
class PhpV8Testsuite
2727
{
28+
private $dumper = 'var_dump';
29+
2830
public function header($title)
2931
{
3032
echo $title, ':', PHP_EOL;
@@ -82,7 +84,7 @@ public function method_export($object, $method, array $args = [])
8284
public function to_dump($value, $level = 1, $initial_nl = true)
8385
{
8486
ob_start();
85-
debug_zval_dump($value);
87+
var_dump($value);
8688
$res = ob_get_clean();
8789

8890
$maybe_strings = explode(PHP_EOL, $res);

tests/V8ArrayObject.phpt

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $context = new v8\Context($isolate, $extensions1, $global_template1);
2222
$value = new v8\ArrayObject($context);
2323

2424
$helper->header('Object representation');
25-
debug_zval_dump($value);
25+
$helper->dump($value);
2626
$helper->space();
2727

2828
$helper->assert('ArrayObject extends ObjectValue', $value instanceof \v8\ObjectValue);
@@ -64,26 +64,26 @@ $res1 = $script1->Run();
6464
--EXPECT--
6565
Object representation:
6666
----------------------
67-
object(v8\ArrayObject)#6 (2) refcount(2){
67+
object(v8\ArrayObject)#6 (2) {
6868
["isolate":"v8\Value":private]=>
69-
object(v8\Isolate)#3 (1) refcount(4){
69+
object(v8\Isolate)#3 (1) {
7070
["snapshot":"v8\Isolate":private]=>
7171
NULL
7272
}
7373
["context":"v8\ObjectValue":private]=>
74-
object(v8\Context)#5 (4) refcount(2){
74+
object(v8\Context)#5 (4) {
7575
["isolate":"v8\Context":private]=>
76-
object(v8\Isolate)#3 (1) refcount(4){
76+
object(v8\Isolate)#3 (1) {
7777
["snapshot":"v8\Isolate":private]=>
7878
NULL
7979
}
8080
["extensions":"v8\Context":private]=>
81-
array(0) refcount(2){
81+
array(0) {
8282
}
8383
["global_template":"v8\Context":private]=>
84-
object(v8\ObjectTemplate)#4 (1) refcount(2){
84+
object(v8\ObjectTemplate)#4 (1) {
8585
["isolate":"v8\Template":private]=>
86-
object(v8\Isolate)#3 (1) refcount(4){
86+
object(v8\Isolate)#3 (1) {
8787
["snapshot":"v8\Isolate":private]=>
8888
NULL
8989
}
@@ -106,58 +106,58 @@ v8\ArrayObject::CreationContext() matches expected value
106106
Converters:
107107
-----------
108108
v8\ArrayObject(v8\Value)->ToBoolean():
109-
object(v8\BooleanValue)#91 (1) refcount(5){
109+
object(v8\BooleanValue)#91 (1) {
110110
["isolate":"v8\Value":private]=>
111-
object(v8\Isolate)#3 (1) refcount(5){
111+
object(v8\Isolate)#3 (1) {
112112
["snapshot":"v8\Isolate":private]=>
113113
NULL
114114
}
115115
}
116116
v8\ArrayObject(v8\Value)->ToNumber():
117-
object(v8\NumberValue)#91 (1) refcount(5){
117+
object(v8\NumberValue)#91 (1) {
118118
["isolate":"v8\Value":private]=>
119-
object(v8\Isolate)#3 (1) refcount(5){
119+
object(v8\Isolate)#3 (1) {
120120
["snapshot":"v8\Isolate":private]=>
121121
NULL
122122
}
123123
}
124124
v8\ArrayObject(v8\Value)->ToString():
125-
object(v8\StringValue)#91 (1) refcount(5){
125+
object(v8\StringValue)#91 (1) {
126126
["isolate":"v8\Value":private]=>
127-
object(v8\Isolate)#3 (1) refcount(5){
127+
object(v8\Isolate)#3 (1) {
128128
["snapshot":"v8\Isolate":private]=>
129129
NULL
130130
}
131131
}
132132
v8\ArrayObject(v8\Value)->ToDetailString():
133-
object(v8\StringValue)#91 (1) refcount(5){
133+
object(v8\StringValue)#91 (1) {
134134
["isolate":"v8\Value":private]=>
135-
object(v8\Isolate)#3 (1) refcount(5){
135+
object(v8\Isolate)#3 (1) {
136136
["snapshot":"v8\Isolate":private]=>
137137
NULL
138138
}
139139
}
140140
v8\ArrayObject(v8\Value)->ToObject():
141-
object(v8\ArrayObject)#6 (2) refcount(7){
141+
object(v8\ArrayObject)#6 (2) {
142142
["isolate":"v8\Value":private]=>
143-
object(v8\Isolate)#3 (1) refcount(4){
143+
object(v8\Isolate)#3 (1) {
144144
["snapshot":"v8\Isolate":private]=>
145145
NULL
146146
}
147147
["context":"v8\ObjectValue":private]=>
148-
object(v8\Context)#5 (4) refcount(3){
148+
object(v8\Context)#5 (4) {
149149
["isolate":"v8\Context":private]=>
150-
object(v8\Isolate)#3 (1) refcount(4){
150+
object(v8\Isolate)#3 (1) {
151151
["snapshot":"v8\Isolate":private]=>
152152
NULL
153153
}
154154
["extensions":"v8\Context":private]=>
155-
array(0) refcount(2){
155+
array(0) {
156156
}
157157
["global_template":"v8\Context":private]=>
158-
object(v8\ObjectTemplate)#4 (1) refcount(2){
158+
object(v8\ObjectTemplate)#4 (1) {
159159
["isolate":"v8\Template":private]=>
160-
object(v8\Isolate)#3 (1) refcount(4){
160+
object(v8\Isolate)#3 (1) {
161161
["snapshot":"v8\Isolate":private]=>
162162
NULL
163163
}
@@ -167,25 +167,25 @@ v8\ArrayObject(v8\Value)->ToObject():
167167
}
168168
}
169169
v8\ArrayObject(v8\Value)->ToInteger():
170-
object(v8\NumberValue)#91 (1) refcount(5){
170+
object(v8\NumberValue)#91 (1) {
171171
["isolate":"v8\Value":private]=>
172-
object(v8\Isolate)#3 (1) refcount(5){
172+
object(v8\Isolate)#3 (1) {
173173
["snapshot":"v8\Isolate":private]=>
174174
NULL
175175
}
176176
}
177177
v8\ArrayObject(v8\Value)->ToUint32():
178-
object(v8\NumberValue)#91 (1) refcount(5){
178+
object(v8\NumberValue)#91 (1) {
179179
["isolate":"v8\Value":private]=>
180-
object(v8\Isolate)#3 (1) refcount(5){
180+
object(v8\Isolate)#3 (1) {
181181
["snapshot":"v8\Isolate":private]=>
182182
NULL
183183
}
184184
}
185185
v8\ArrayObject(v8\Value)->ToInt32():
186-
object(v8\NumberValue)#91 (1) refcount(5){
186+
object(v8\NumberValue)#91 (1) {
187187
["isolate":"v8\Value":private]=>
188-
object(v8\Isolate)#3 (1) refcount(5){
188+
object(v8\Isolate)#3 (1) {
189189
["snapshot":"v8\Isolate":private]=>
190190
NULL
191191
}

tests/V8Boolean.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $v8_helper = new PhpV8Helpers($helper);
1919
// Tests:
2020

2121
$helper->header('Object representation');
22-
debug_zval_dump($value);
22+
$helper->dump($value);
2323
$helper->space();
2424

2525
$helper->assert('BooleanValue extends PrimitiveValue', $value instanceof \v8\PrimitiveValue);
@@ -46,17 +46,17 @@ $helper->space();
4646

4747
$helper->header(get_class($value) .'::ToString() converting');
4848
$string = $value->ToString($context);
49-
debug_zval_dump($string->Value());
49+
$helper->dump($string->Value());
5050
$helper->space();
5151

5252

5353
?>
5454
--EXPECT--
5555
Object representation:
5656
----------------------
57-
object(v8\BooleanValue)#2 (1) refcount(2){
57+
object(v8\BooleanValue)#2 (1) {
5858
["isolate":"v8\Value":private]=>
59-
object(v8\Isolate)#1 (1) refcount(2){
59+
object(v8\Isolate)#1 (1) {
6060
["snapshot":"v8\Isolate":private]=>
6161
NULL
6262
}
@@ -105,4 +105,4 @@ v8\BooleanValue(v8\Value)->NumberValue(): float(1)
105105

106106
v8\BooleanValue::ToString() converting:
107107
---------------------------------------
108-
string(4) "true" refcount(1)
108+
string(4) "true"

tests/V8BooleanObject.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $context1 = new v8\Context($isolate1, $extensions1, $global_template1);
2525
$value = new v8\BooleanObject($context1, true);
2626

2727
$helper->header('Object representation');
28-
debug_zval_dump($value);
28+
$helper->dump($value);
2929
$helper->space();
3030

3131
$helper->assert('BooleanObject extends ObjectValue', $value instanceof \v8\ObjectValue);
@@ -58,26 +58,26 @@ $v8_helper->run_checks($res1, 'Checkers on boxed from script');
5858
--EXPECT--
5959
Object representation:
6060
----------------------
61-
object(v8\BooleanObject)#8 (2) refcount(2){
61+
object(v8\BooleanObject)#8 (2) {
6262
["isolate":"v8\Value":private]=>
63-
object(v8\Isolate)#3 (1) refcount(5){
63+
object(v8\Isolate)#3 (1) {
6464
["snapshot":"v8\Isolate":private]=>
6565
NULL
6666
}
6767
["context":"v8\ObjectValue":private]=>
68-
object(v8\Context)#7 (4) refcount(2){
68+
object(v8\Context)#7 (4) {
6969
["isolate":"v8\Context":private]=>
70-
object(v8\Isolate)#3 (1) refcount(5){
70+
object(v8\Isolate)#3 (1) {
7171
["snapshot":"v8\Isolate":private]=>
7272
NULL
7373
}
7474
["extensions":"v8\Context":private]=>
75-
array(0) refcount(2){
75+
array(0) {
7676
}
7777
["global_template":"v8\Context":private]=>
78-
object(v8\ObjectTemplate)#4 (1) refcount(2){
78+
object(v8\ObjectTemplate)#4 (1) {
7979
["isolate":"v8\Template":private]=>
80-
object(v8\Isolate)#3 (1) refcount(5){
80+
object(v8\Isolate)#3 (1) {
8181
["snapshot":"v8\Isolate":private]=>
8282
NULL
8383
}

tests/V8Data.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ $helper = require '.testsuite.php';
1616
// Tests:
1717

1818
$helper->header('Object representation');
19-
debug_zval_dump($value);
19+
$helper->dump($value);
2020
$helper->space();
2121

2222
?>
2323
--EXPECT--
2424
Object representation:
2525
----------------------
26-
object(v8\Data)#2 (0) refcount(2){
26+
object(v8\Data)#2 (0) {
2727
}

tests/V8DateObject.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $test_time = 1445444940000.0;
3232
$value = new v8\DateObject($context1, $test_time);
3333

3434
$helper->header('Object representation');
35-
debug_zval_dump($value);
35+
$helper->dump($value);
3636
$helper->space();
3737

3838
$helper->assert('DateObject extends ObjectValue', $value instanceof \v8\ObjectValue);
@@ -116,26 +116,26 @@ putenv("TZ={$old_tz}"); // Go back
116116
--EXPECT--
117117
Object representation:
118118
----------------------
119-
object(v8\DateObject)#8 (2) refcount(2){
119+
object(v8\DateObject)#8 (2) {
120120
["isolate":"v8\Value":private]=>
121-
object(v8\Isolate)#3 (1) refcount(5){
121+
object(v8\Isolate)#3 (1) {
122122
["snapshot":"v8\Isolate":private]=>
123123
NULL
124124
}
125125
["context":"v8\ObjectValue":private]=>
126-
object(v8\Context)#7 (4) refcount(2){
126+
object(v8\Context)#7 (4) {
127127
["isolate":"v8\Context":private]=>
128-
object(v8\Isolate)#3 (1) refcount(5){
128+
object(v8\Isolate)#3 (1) {
129129
["snapshot":"v8\Isolate":private]=>
130130
NULL
131131
}
132132
["extensions":"v8\Context":private]=>
133-
array(0) refcount(2){
133+
array(0) {
134134
}
135135
["global_template":"v8\Context":private]=>
136-
object(v8\ObjectTemplate)#4 (1) refcount(2){
136+
object(v8\ObjectTemplate)#4 (1) {
137137
["isolate":"v8\Template":private]=>
138-
object(v8\Isolate)#3 (1) refcount(5){
138+
object(v8\Isolate)#3 (1) {
139139
["snapshot":"v8\Isolate":private]=>
140140
NULL
141141
}

tests/V8Exception_CreateMessage.phpt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ $helper->line();
7171

7272
$v8_helper->run_checks($res);
7373
?>
74-
--EXPECTF--
74+
--EXPECT--
7575
Can create message when out of context: ok
7676

7777
exception: '[object Object]'
@@ -81,18 +81,18 @@ Exception passed: ok
8181

8282
Message created from thrown value:
8383
----------------------------------
84-
v8\Message->Get(): string(18) "Uncaught #<Object>" refcount(%d)
85-
v8\Message->GetSourceLine(): string(24) " test(exception);" refcount(%d)
84+
v8\Message->Get(): string(18) "Uncaught #<Object>"
85+
v8\Message->GetSourceLine(): string(24) " test(exception);"
8686
v8\Message->GetScriptOrigin():
87-
object(v8\ScriptOrigin)#22 (6) refcount(6){
87+
object(v8\ScriptOrigin)#22 (6) {
8888
["resource_name":"v8\ScriptOrigin":private]=>
89-
string(7) "test.js" refcount(1)
89+
string(7) "test.js"
9090
["resource_line_offset":"v8\ScriptOrigin":private]=>
9191
int(0)
9292
["resource_column_offset":"v8\ScriptOrigin":private]=>
9393
int(0)
9494
["options":"v8\ScriptOrigin":private]=>
95-
object(v8\ScriptOriginOptions)#18 (3) refcount(1){
95+
object(v8\ScriptOriginOptions)#18 (3) {
9696
["is_embedder_debug_script":"v8\ScriptOriginOptions":private]=>
9797
bool(false)
9898
["is_shared_cross_origin":"v8\ScriptOriginOptions":private]=>
@@ -101,11 +101,11 @@ v8\Message->GetScriptOrigin():
101101
bool(false)
102102
}
103103
["script_id":"v8\ScriptOrigin":private]=>
104-
int(33)
104+
int(38)
105105
["source_map_url":"v8\ScriptOrigin":private]=>
106-
string(0) "" refcount(%d)
106+
string(0) ""
107107
}
108-
v8\Message->GetScriptResourceName(): string(7) "test.js" refcount(6)
108+
v8\Message->GetScriptResourceName(): string(7) "test.js"
109109
v8\Message->GetStackTrace(): NULL
110110
v8\Message->GetLineNumber(): int(11)
111111
v8\Message->GetStartPosition(): int(227)
@@ -117,18 +117,18 @@ v8\Message->IsOpaque(): bool(false)
117117

118118
Message created from created value:
119119
-----------------------------------
120-
v8\Message->Get(): string(13) "Uncaught test" refcount(%d)
121-
v8\Message->GetSourceLine(): string(24) " test(exception);" refcount(%d)
120+
v8\Message->Get(): string(13) "Uncaught test"
121+
v8\Message->GetSourceLine(): string(24) " test(exception);"
122122
v8\Message->GetScriptOrigin():
123-
object(v8\ScriptOrigin)#36 (6) refcount(6){
123+
object(v8\ScriptOrigin)#36 (6) {
124124
["resource_name":"v8\ScriptOrigin":private]=>
125-
string(7) "test.js" refcount(1)
125+
string(7) "test.js"
126126
["resource_line_offset":"v8\ScriptOrigin":private]=>
127127
int(0)
128128
["resource_column_offset":"v8\ScriptOrigin":private]=>
129129
int(0)
130130
["options":"v8\ScriptOrigin":private]=>
131-
object(v8\ScriptOriginOptions)#35 (3) refcount(1){
131+
object(v8\ScriptOriginOptions)#35 (3) {
132132
["is_embedder_debug_script":"v8\ScriptOriginOptions":private]=>
133133
bool(false)
134134
["is_shared_cross_origin":"v8\ScriptOriginOptions":private]=>
@@ -137,11 +137,11 @@ v8\Message->GetScriptOrigin():
137137
bool(false)
138138
}
139139
["script_id":"v8\ScriptOrigin":private]=>
140-
int(33)
140+
int(38)
141141
["source_map_url":"v8\ScriptOrigin":private]=>
142-
string(0) "" refcount(%d)
142+
string(0) ""
143143
}
144-
v8\Message->GetScriptResourceName(): string(7) "test.js" refcount(%d)
144+
v8\Message->GetScriptResourceName(): string(7) "test.js"
145145
v8\Message->GetStackTrace(): NULL
146146
v8\Message->GetLineNumber(): int(11)
147147
v8\Message->GetStartPosition(): int(227)

0 commit comments

Comments
 (0)