0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-08 17:48:41 +00:00
phpv8/tests/function_passback.phpt

30 lines
524 B
Plaintext
Raw Normal View History

2013-10-02 22:34:50 +00:00
--TEST--
Test V8::executeString() : Call passed-back function
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$v8 = new V8Js();
$JS = <<< EOT
(function(exports) {
// begin module code
exports.hello = function() { return 'hello'; };
// end module code
return exports;
})({})
EOT;
$exports = $v8->executeString($JS, 'basic.js');
2013-10-07 12:55:01 +00:00
$vars = get_object_vars($exports);
$v8->func = $vars['hello'];
2013-10-02 22:34:50 +00:00
echo $v8->executeString('PHP.func();')."\n";
?>
===EOF===
--EXPECT--
hello
===EOF===