issue_185_basic.phpt 540 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Test V8::executeString() : Issue #185 Wrong this on V8Object method invocation
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $v8 = new V8Js();
  8. $JS = <<<EOT
  9. function Bar(i) {
  10. this.theValue = i;
  11. }
  12. Bar.prototype.tell = function() {
  13. var_dump(this.theValue);
  14. };
  15. var inst = new Bar(23);
  16. inst.tell();
  17. EOT;
  18. $v8->executeString($JS);
  19. // now fetch `inst` from V8 and call method from PHP
  20. $inst = $v8->executeString('(inst)');
  21. $inst->tell();
  22. ?>
  23. ===EOF===
  24. --EXPECT--
  25. int(23)
  26. int(23)
  27. ===EOF===