exception.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. --TEST--
  2. Test V8::executeString() : V8JsException
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $JS = <<< EOT
  8. this_function_does_not_exist();
  9. EOT;
  10. $v8 = new V8Js();
  11. try {
  12. $v8->executeString($JS, 'exception.js');
  13. } catch (V8JsException $e) {
  14. var_dump($e);
  15. }
  16. ?>
  17. ===EOF===
  18. --EXPECTF--
  19. object(V8JsException)#2 (11) {
  20. ["message":protected]=>
  21. string(75) "exception.js:1: ReferenceError: this_function_does_not_exist is not defined"
  22. ["string":"Exception":private]=>
  23. string(0) ""
  24. ["code":protected]=>
  25. int(0)
  26. ["file":protected]=>
  27. string(%d) "%s"
  28. ["line":protected]=>
  29. int(10)
  30. ["trace":"Exception":private]=>
  31. array(1) {
  32. [0]=>
  33. array(6) {
  34. ["file"]=>
  35. string(%d) "%s"
  36. ["line"]=>
  37. int(10)
  38. ["function"]=>
  39. string(13) "executeString"
  40. ["class"]=>
  41. string(4) "V8Js"
  42. ["type"]=>
  43. string(2) "->"
  44. ["args"]=>
  45. array(2) {
  46. [0]=>
  47. string(31) "this_function_does_not_exist();"
  48. [1]=>
  49. string(12) "exception.js"
  50. }
  51. }
  52. }
  53. ["previous":"Exception":private]=>
  54. NULL
  55. ["JsFileName":protected]=>
  56. string(12) "exception.js"
  57. ["JsLineNumber":protected]=>
  58. int(1)
  59. ["JsSourceLine":protected]=>
  60. string(31) "this_function_does_not_exist();"
  61. ["JsTrace":protected]=>
  62. string(83) "ReferenceError: this_function_does_not_exist is not defined
  63. at exception.js:1:1"
  64. }
  65. ===EOF===