0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-14 17:38:42 +00:00
phpv8/tests/issue_410_basic.phpt

50 lines
850 B
Plaintext
Raw Normal View History

2019-06-22 16:59:41 +00:00
--TEST--
Test V8::executeString() : Method access from multiple derived classes
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
class BaseClass {
public function bla() {
printf('print bla, called class: %s' . PHP_EOL, get_called_class());
}
}
class Foo extends BaseClass {}
class Bar extends BaseClass {}
$v8 = new V8Js('PHP');
$v8->Foo = new Foo();
$v8->Bar = new Bar();
$code = <<<EOT
var_dump(PHP.Foo);
PHP.Foo.bla();
var_dump(PHP.Bar);
PHP.Bar.bla();
EOT;
$v8->executeString($code);
?>
===EOF===
--EXPECTF--
object(Foo)#%d (1) {
["bla"] =>
object(Closure)#%d {
function () { [native code] }
}
}
print bla, called class: Foo
object(Bar)#%d (1) {
["bla"] =>
object(Closure)#%d {
function () { [native code] }
}
}
print bla, called class: Bar
===EOF===