mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-23 18:31:51 +00:00
24 lines
435 B
PHP
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===
|