-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathcommonjs_exception_002.phpt
38 lines (34 loc) · 1.18 KB
/
commonjs_exception_002.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--TEST--
Test V8Js::setModuleNormaliser : Forward exceptions
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$JS = <<< EOT
var foo = require("./test");
EOT;
$v8 = new V8Js();
$v8->setModuleNormaliser(function($module) {
throw new Exception('some exception');
});
$v8->setModuleLoader(function($module) {
echo 'dummy ...';
});
$v8->executeString($JS, 'module.js', V8Js::FLAG_PROPAGATE_PHP_EXCEPTIONS);
?>
===EOF===
--EXPECTF--
Fatal error: Uncaught Exception: some exception in %s%ecommonjs_exception_002.php:9
Stack trace:
#0 [internal function]: {closur%s}('', './test')
#1 %s%ecommonjs_exception_002.php(15): V8Js->executeString('var foo = requi...', 'module.js', 4)
#2 {main}
Next V8JsScriptException: module.js:1: Exception: some exception in %s%ecommonjs_exception_002.php:9
Stack trace:
#0 [internal function]: {closur%s}('', './test')
#1 %s%ecommonjs_exception_002.php(15): V8Js->executeString('var foo = requi...', 'module.js', 4)
#2 {main} in %s%ecommonjs_exception_002.php:15
Stack trace:
#0 %s%ecommonjs_exception_002.php(15): V8Js->executeString('var foo = requi...', 'module.js', 4)
#1 {main}
thrown in %s%ecommonjs_exception_002.php on line 15