mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 19:51:51 +00:00
27 lines
446 B
Plaintext
27 lines
446 B
Plaintext
|
--TEST--
|
||
|
Test V8Js::setModuleLoader : Assign result multiple times
|
||
|
--SKIPIF--
|
||
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||
|
--FILE--
|
||
|
<?php
|
||
|
|
||
|
$JS = <<< EOT
|
||
|
var foo = require("test");
|
||
|
var bar = require("test");
|
||
|
var_dump(foo.bar);
|
||
|
var_dump(bar.bar);
|
||
|
EOT;
|
||
|
|
||
|
$v8 = new V8Js();
|
||
|
$v8->setModuleLoader(function($module) {
|
||
|
return 'exports.bar = 23;';
|
||
|
});
|
||
|
|
||
|
$v8->executeString($JS, 'module.js');
|
||
|
?>
|
||
|
===EOF===
|
||
|
--EXPECT--
|
||
|
int(23)
|
||
|
int(23)
|
||
|
===EOF===
|