@@ -12,10 +12,8 @@ require '.v8-helpers.php';
1212$ v8_helper = new PhpV8Helpers ($ helper );
1313
1414$ isolate = new \V8 \Isolate ();
15- $ global_template1 = new V8 \ObjectTemplate ($ isolate );
16-
17- $ global_template1 ->Set (new \V8 \StringValue ($ isolate , 'print ' ), $ v8_helper ->getPrintFunctionTemplate ($ isolate ), \V8 \PropertyAttribute::DontDelete);
18- $ context = new V8 \Context ($ isolate , $ global_template1 );
15+ $ context = new V8 \Context ($ isolate );
16+ $ v8_helper ->injectConsoleLog ($ context );
1917
2018$ value = new V8 \ArrayObject ($ context );
2119
@@ -48,18 +46,16 @@ $value->Set($context, new \V8\StringValue($isolate, 'test'), new \V8\StringValue
4846
4947$ context ->GlobalObject ()->Set ($ context , new \V8 \StringValue ($ isolate , 'arr ' ), $ value );
5048
51- $ source1 = '
52- print ("typeof arr: ", typeof arr, "\n" );
53- print ("arr: ", arr, "\n" );
54- print ("arr.length: ", arr.length, "\n" );
55- print ("arr[0]: ", arr[0], "\n" );
56- print ("arr.test: ", arr.test, "\n" );
57- print ("arr.slice(1): ", arr.slice(1), "\n" );
49+ $ source = '
50+ console.log ("typeof arr: ", typeof arr);
51+ console.log ("arr: ", arr);
52+ console.log ("arr.length: ", arr.length);
53+ console.log ("arr[0]: ", arr[0]);
54+ console.log ("arr.test: ", arr.test);
55+ console.log ("arr.slice(1): ", arr.slice(1));
5856 ' ;
59- $ file_name1 = 'test.js ' ;
6057
61- $ script1 = new V8 \Script ($ context , new \V8 \StringValue ($ isolate , $ source1 ), new \V8 \ScriptOrigin ($ file_name1 ));
62- $ res1 = $ script1 ->Run ($ context );
58+ $ v8_helper ->CompileRun ($ context , $ source );
6359
6460?>
6561--EXPECT--
@@ -80,7 +76,7 @@ object(V8\ArrayObject)#6 (2) {
8076 bool(false)
8177 }
8278 ["context":"V8\ObjectValue":private]=>
83- object(V8\Context)#5 (1) {
79+ object(V8\Context)#4 (1) {
8480 ["isolate":"V8\Context":private]=>
8581 object(V8\Isolate)#3 (5) {
8682 ["snapshot":"V8\Isolate":private]=>
@@ -166,7 +162,7 @@ V8\ArrayObject(V8\Value)->IsProxy(): bool(false)
166162Converters:
167163-----------
168164V8\ArrayObject(V8\Value)->ToBoolean():
169- object(V8\BooleanValue)#119 (1) {
165+ object(V8\BooleanValue)#118 (1) {
170166 ["isolate":"V8\Value":private]=>
171167 object(V8\Isolate)#3 (5) {
172168 ["snapshot":"V8\Isolate":private]=>
@@ -182,7 +178,7 @@ V8\ArrayObject(V8\Value)->ToBoolean():
182178 }
183179 }
184180V8\ArrayObject(V8\Value)->ToNumber():
185- object(V8\Int32Value)#119 (1) {
181+ object(V8\Int32Value)#118 (1) {
186182 ["isolate":"V8\Value":private]=>
187183 object(V8\Isolate)#3 (5) {
188184 ["snapshot":"V8\Isolate":private]=>
@@ -198,7 +194,7 @@ V8\ArrayObject(V8\Value)->ToNumber():
198194 }
199195 }
200196V8\ArrayObject(V8\Value)->ToString():
201- object(V8\StringValue)#119 (1) {
197+ object(V8\StringValue)#118 (1) {
202198 ["isolate":"V8\Value":private]=>
203199 object(V8\Isolate)#3 (5) {
204200 ["snapshot":"V8\Isolate":private]=>
@@ -214,7 +210,7 @@ V8\ArrayObject(V8\Value)->ToString():
214210 }
215211 }
216212V8\ArrayObject(V8\Value)->ToDetailString():
217- object(V8\StringValue)#119 (1) {
213+ object(V8\StringValue)#118 (1) {
218214 ["isolate":"V8\Value":private]=>
219215 object(V8\Isolate)#3 (5) {
220216 ["snapshot":"V8\Isolate":private]=>
@@ -245,7 +241,7 @@ V8\ArrayObject(V8\Value)->ToObject():
245241 bool(false)
246242 }
247243 ["context":"V8\ObjectValue":private]=>
248- object(V8\Context)#5 (1) {
244+ object(V8\Context)#4 (1) {
249245 ["isolate":"V8\Context":private]=>
250246 object(V8\Isolate)#3 (5) {
251247 ["snapshot":"V8\Isolate":private]=>
@@ -262,7 +258,7 @@ V8\ArrayObject(V8\Value)->ToObject():
262258 }
263259 }
264260V8\ArrayObject(V8\Value)->ToInteger():
265- object(V8\Int32Value)#119 (1) {
261+ object(V8\Int32Value)#118 (1) {
266262 ["isolate":"V8\Value":private]=>
267263 object(V8\Isolate)#3 (5) {
268264 ["snapshot":"V8\Isolate":private]=>
@@ -278,7 +274,7 @@ V8\ArrayObject(V8\Value)->ToInteger():
278274 }
279275 }
280276V8\ArrayObject(V8\Value)->ToUint32():
281- object(V8\Int32Value)#119 (1) {
277+ object(V8\Int32Value)#118 (1) {
282278 ["isolate":"V8\Value":private]=>
283279 object(V8\Isolate)#3 (5) {
284280 ["snapshot":"V8\Isolate":private]=>
@@ -294,7 +290,7 @@ V8\ArrayObject(V8\Value)->ToUint32():
294290 }
295291 }
296292V8\ArrayObject(V8\Value)->ToInt32():
297- object(V8\Int32Value)#119 (1) {
293+ object(V8\Int32Value)#118 (1) {
298294 ["isolate":"V8\Value":private]=>
299295 object(V8\Isolate)#3 (5) {
300296 ["snapshot":"V8\Isolate":private]=>
0 commit comments