0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-23 01:51:51 +00:00
phpv8/tests/multi-object.phpt

44 lines
802 B
Plaintext
Raw Normal View History

2013-09-29 21:46:19 +00:00
--TEST--
Test V8::executeString() : Use multiple V8js instances with objects
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
class TestClass {
protected $_instNo;
public function __construct($num) {
$this->_instNo = $num;
}
public function sayHello() {
echo 'Hello World! This is instance '.$this->_instNo."\n";
}
}
$instances = array();
for($i = 0; $i < 5; $i ++) {
$v8 = new V8Js();
$v8->test = new TestClass($i);
$instances[] = $v8;
}
$JS = <<< EOT
2013-10-02 21:38:26 +00:00
PHP.test.sayHello();
2013-09-29 21:46:19 +00:00
EOT;
foreach($instances as $v8) {
$v8->executeString($JS, 'basic.js');
}
?>
===EOF===
--EXPECT--
Hello World! This is instance 0
Hello World! This is instance 1
Hello World! This is instance 2
Hello World! This is instance 3
Hello World! This is instance 4
===EOF===