0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-14 07:18:40 +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===