function_call.phpt 455 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Test V8::executeString() : Call passed-back function (directly)
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $v8 = new V8Js();
  8. $JS = <<< EOT
  9. (function(exports) {
  10. // begin module code
  11. exports.hello = function() { return 'hello'; };
  12. // end module code
  13. return exports;
  14. })({})
  15. EOT;
  16. $exports = $v8->executeString($JS, 'basic.js');
  17. echo $exports->hello()."\n";
  18. ?>
  19. ===EOF===
  20. --EXPECT--
  21. hello
  22. ===EOF===