From 46fba810af1941f2a0a4f7d897824eb2958fd527 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Thu, 7 Jan 2016 23:15:13 +0100 Subject: [PATCH] Add test on PHP exceptions thrown by JS generators --- tests/generators_from_v8_008.phpt | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/generators_from_v8_008.phpt diff --git a/tests/generators_from_v8_008.phpt b/tests/generators_from_v8_008.phpt new file mode 100644 index 0000000..1989ceb --- /dev/null +++ b/tests/generators_from_v8_008.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test V8::executeString() : Generators V8 -> PHP (throw PHP) +--SKIPIF-- + +--FILE-- +getValue = function() { + throw new \Exception('this shall not work'); +}; +$gen = $v8->executeString($js); + +foreach($gen as $a) { + var_dump($a); +} + +?> +===EOF=== +--EXPECTF-- +int(23) + +Fatal error: Uncaught Exception: this shall not work in %s +Stack trace: +#0 [internal function]: {closure}() +#1 [internal function]: Closure->__invoke() +#2 %s: V8Generator->next() +#3 {main} + thrown in %s