mirror of
https://github.com/phpv8/v8js.git
synced 2025-03-23 21:17:03 +00:00
Add test on constructor get-accessor.
This commit is contained in:
parent
9ead20823f
commit
50fdfc5c88
42
tests/get_constructor.phpt
Normal file
42
tests/get_constructor.phpt
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
--TEST--
|
||||||
|
Test V8::executeString() : Get constructor method
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
function Foo() {
|
||||||
|
echo "called constructor: ";
|
||||||
|
var_dump(func_get_args());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$v8 = new V8JS();
|
||||||
|
$v8->foo = new Foo(23);
|
||||||
|
|
||||||
|
$js = <<<EOF
|
||||||
|
var_dump(PHP.foo.constructor);
|
||||||
|
|
||||||
|
c = PHP.foo.constructor;
|
||||||
|
bar = new c(42);
|
||||||
|
|
||||||
|
EOF
|
||||||
|
;
|
||||||
|
$v8->executeString($js);
|
||||||
|
|
||||||
|
?>
|
||||||
|
===EOF===
|
||||||
|
--EXPECTF--
|
||||||
|
called constructor: array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(23)
|
||||||
|
}
|
||||||
|
object(Closure)#%d {
|
||||||
|
function Foo() { [native code] }
|
||||||
|
}
|
||||||
|
called constructor: array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(42)
|
||||||
|
}
|
||||||
|
===EOF===
|
Loading…
x
Reference in New Issue
Block a user