0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-08 18:58:41 +00:00
phpv8/tests/commonjs_node_compat_001.phpt
2017-11-12 16:20:24 +01:00

29 lines
455 B
PHP

--TEST--
Test V8Js::setModuleLoader : this === module.exports
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$v8 = new V8Js();
$v8->setModuleLoader(function ($moduleName) {
return <<<'EOJS'
var_dump(this === global);
var_dump(this === module.exports);
EOJS
;
});
$v8->executeString(<<<'EOJS'
var result = require('foo');
EOJS
);
?>
===EOF===
--EXPECT--
bool(false)
bool(true)
===EOF===