0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 22:51:51 +00:00
phpv8/tests/commonjs_native_basic.phpt

24 lines
435 B
Plaintext
Raw Normal View History

2018-01-05 20:44:40 +00:00
--TEST--
Test V8Js::setModuleLoader : Native Module basic behaviour
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
class NativeModule {
public function sayHello($name)
{
echo "Hello $name!\n";
}
}
$v8 = new V8Js();
$v8->setModuleLoader(function($module) {
return new NativeModule();
});
$v8->executeString('require("foo").sayHello("World");');
?>
===EOF===
--EXPECT--
Hello World!
===EOF===