context_separation.phpt 540 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Test V8::executeString() : test context separation
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $JS = <<< EOT
  8. print(PHP.foo);
  9. EOT;
  10. $a = new V8Js();
  11. $a->foo = 'from first.js';
  12. try {
  13. $a->executeString($JS, 'first.js');
  14. } catch (V8JsException $e) {
  15. var_dump($e);
  16. }
  17. echo "\n";
  18. $b = new V8Js();
  19. $b->foo = 'from second.js';
  20. try {
  21. $b->executeString($JS, 'second.js');
  22. } catch (V8JsException $e) {
  23. var_dump($e);
  24. }
  25. echo "\n";
  26. ?>
  27. ===EOF===
  28. --EXPECTF--
  29. from first.js
  30. from second.js
  31. ===EOF===