mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 09:21:52 +00:00
add test, refs #410
This commit is contained in:
parent
754d29d5e1
commit
5f7bf9900b
49
tests/issue_410_basic.phpt
Normal file
49
tests/issue_410_basic.phpt
Normal 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===
|
||||
|
Loading…
Reference in New Issue
Block a user