0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 15:11:53 +00:00

add test, refs #410

This commit is contained in:
Stefan Siegl 2019-06-22 18:59:41 +02:00
parent 754d29d5e1
commit 5f7bf9900b
No known key found for this signature in database
GPG Key ID: 73942AF5642F3DDA

View File

@ -0,0 +1,49 @@
--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===