issue_183_003.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --TEST--
  2. Test V8::executeString() : Method access on derived classes (V8Js methods)
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. class Foo extends \V8Js
  8. {
  9. public function hello()
  10. {
  11. print("Hello World\n");
  12. }
  13. }
  14. $JS = <<< EOT
  15. var_dump(typeof PHP.hello);
  16. var_dump(typeof PHP.executeString);
  17. var_dump(typeof PHP.compileString);
  18. var_dump(typeof PHP.executeScript);
  19. var_dump(typeof PHP.checkString);
  20. var_dump(typeof PHP.setModuleNormaliser);
  21. var_dump(typeof PHP.setModuleLoader);
  22. var_dump(typeof PHP.registerExtension);
  23. var_dump(typeof PHP.getExtensions);
  24. var_dump(typeof PHP.setTimeLimit);
  25. var_dump(typeof PHP.setMemoryLimit);
  26. try {
  27. PHP.setTimeLimit(100);
  28. }
  29. catch(e) {
  30. var_dump('caught');
  31. }
  32. EOT;
  33. $v8 = new Foo();
  34. $v8->executeString($JS);
  35. ?>
  36. ===EOF===
  37. --EXPECTF--
  38. string(8) "function"
  39. string(9) "undefined"
  40. string(9) "undefined"
  41. string(9) "undefined"
  42. string(9) "undefined"
  43. string(9) "undefined"
  44. string(9) "undefined"
  45. string(9) "undefined"
  46. string(9) "undefined"
  47. string(9) "undefined"
  48. string(9) "undefined"
  49. string(6) "caught"
  50. ===EOF===