mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 15:18:41 +00:00
Add test on property passing on generators
This commit is contained in:
parent
798a87e481
commit
c500d0c21e
32
tests/generators_from_v8_010.phpt
Normal file
32
tests/generators_from_v8_010.phpt
Normal file
@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
Test V8::executeString() : Generators V8 -> PHP (properties)
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$js = <<<EOJS
|
||||
function* TheGen() {
|
||||
yield 23;
|
||||
yield PHP.getValue();
|
||||
}
|
||||
|
||||
var gen = TheGen();
|
||||
gen.foo = 23;
|
||||
gen.bar = function() { var_dump("Hello World"); };
|
||||
|
||||
gen;
|
||||
EOJS;
|
||||
|
||||
$v8 = new V8Js();
|
||||
$gen = $v8->executeString($js);
|
||||
|
||||
var_dump($gen->foo);
|
||||
$gen->bar();
|
||||
|
||||
?>
|
||||
===EOF===
|
||||
--EXPECT--
|
||||
int(23)
|
||||
string(11) "Hello World"
|
||||
===EOF===
|
Loading…
Reference in New Issue
Block a user