0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-08 17:48:41 +00:00
phpv8/tests/commonjs_native_basic.phpt
2018-01-05 21:44:40 +01:00

24 lines
435 B
PHP

--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===