mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-14 17:38:42 +00:00
24 lines
435 B
Plaintext
24 lines
435 B
Plaintext
|
--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===
|