0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-08 14:48:40 +00:00
phpv8/tests/generators_from_v8_010.phpt

33 lines
480 B
Plaintext
Raw Normal View History

--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===