0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-09 01:28:41 +00:00
phpv8/tests/compile_string_isolate.phpt

47 lines
950 B
Plaintext
Raw Normal View History

--TEST--
Test V8::compileString() : Check compiled script isolate processing
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$js = <<<'EOT'
var a = { 'hello' : 'world' }; a;
EOT;
$js2 = <<<'EOT'
var a = { 'foo' : 'bar' }; a;
EOT;
$v8 = new V8Js();
$v8two = new V8Js();
try {
$script_a = $v8->compileString($js, 'a.js');
var_dump($script_a);
$script_b = $v8two->compileString($js2, 'b.js');
var_dump($script_b);
var_dump($v8->executeScript($script_a));
var_dump($v8->executeScript($script_b));
var_dump($v8->executeScript($script_a));
} catch (V8JsScriptException $e) {
var_dump($e);
}
?>
===EOF===
--EXPECTF--
resource(%d) of type (V8Js script)
resource(%d) of type (V8Js script)
object(V8Object)#%d (1) {
["hello"]=>
string(5) "world"
}
Warning: Script resource from wrong V8Js object passed in %s on line %d
bool(false)
object(V8Object)#%d (1) {
["hello"]=>
string(5) "world"
}
===EOF===