get_constructor.phpt 600 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Test V8::executeString() : Get constructor method
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. class Foo {
  8. function Foo() {
  9. echo "called constructor: ";
  10. var_dump(func_get_args());
  11. }
  12. }
  13. $v8 = new V8JS();
  14. $v8->foo = new Foo(23);
  15. $js = <<<EOF
  16. var_dump(PHP.foo.constructor);
  17. c = PHP.foo.constructor;
  18. bar = new c(42);
  19. EOF
  20. ;
  21. $v8->executeString($js);
  22. ?>
  23. ===EOF===
  24. --EXPECTF--
  25. called constructor: array(1) {
  26. [0]=>
  27. int(23)
  28. }
  29. object(Closure)#%d {
  30. function Foo() { [native code] }
  31. }
  32. called constructor: array(1) {
  33. [0]=>
  34. int(42)
  35. }
  36. ===EOF===