From 7e90439cdf33d926e28a76547c1cd6b43d7f7a10 Mon Sep 17 00:00:00 2001 From: Simon Best Date: Sun, 14 Apr 2013 00:36:31 +0100 Subject: [PATCH] Make sure all tests and samples use the new exception class name V8JsScriptException. --- README.md | 4 ++-- samples/test_call.php | 2 +- samples/test_closure.php | 2 +- samples/test_date.php | 2 +- samples/test_dumper.php | 2 +- samples/test_exception.php | 2 +- samples/test_exception2.php | 2 +- samples/test_extend.php | 2 +- samples/test_method.php | 8 ++++---- test.php | 4 ++-- tests/basic.phpt | 2 +- tests/closures_basic.phpt | 2 +- tests/closures_dynamic.phpt | 2 +- tests/construct.phpt | 2 +- tests/context_preserving.phpt | 10 +++++----- tests/context_separation.phpt | 4 ++-- tests/exception.phpt | 6 +++--- tests/exception_propagation_1.phpt | 2 +- tests/exception_propagation_2.phpt | 4 ++-- tests/exception_propagation_3.phpt | 2 +- tests/execute_flags.phpt | 2 +- tests/execute_flags_args.phpt | 2 +- tests/object_method_call.phpt | 8 ++++---- 23 files changed, 39 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 943d756..ff9ed4e 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ API public mixed V8Js::executeString( string script [, string identifier [, int flags = V8Js::FLAG_NONE]]) // Returns uncaught pending exception or null if there is no pending exception. - public V8JsException V8Js::getPendingException( void ) + public V8JsScriptException V8Js::getPendingException( void ) /** Static methods **/ @@ -56,7 +56,7 @@ API public static array V8Js::getExtensions( void ) } - final class V8JsException extends Exception + final class V8JsScriptException extends Exception { /* Properties */ protected string JsFileName = NULL; diff --git a/samples/test_call.php b/samples/test_call.php index da016b7..c79489c 100644 --- a/samples/test_call.php +++ b/samples/test_call.php @@ -69,6 +69,6 @@ try { $blaa->executeString('PHP.obj.foo(1,2,3);', "call_test1 #8.js"); echo "------------\n"; -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } diff --git a/samples/test_closure.php b/samples/test_closure.php index 9653b6b..89c89a2 100644 --- a/samples/test_closure.php +++ b/samples/test_closure.php @@ -6,6 +6,6 @@ $a->func = function ($a) { echo "Closure..\n"; }; try { $a->executeString("print(PHP.func); PHP.func(1);", "closure_test.js"); $a->executeString("print(PHP.func); PHP.func(1);", "closure_test.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } diff --git a/samples/test_date.php b/samples/test_date.php index f8bb5c9..995ca31 100644 --- a/samples/test_date.php +++ b/samples/test_date.php @@ -4,6 +4,6 @@ $a = new V8Js(); try { var_dump($a->executeString("date = new Date('September 8, 1975 09:00:00'); print(date + '\\n'); date;", "test.js")); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } diff --git a/samples/test_dumper.php b/samples/test_dumper.php index 92f445c..d1365c1 100644 --- a/samples/test_dumper.php +++ b/samples/test_dumper.php @@ -54,6 +54,6 @@ try { $a->executeString("var patt1=/[^a-h]/g; var_dump(patt1);", "call_test5.js"); $a->executeString("var_dump(Math.PI, Infinity, null, undefined);", "call_test6.js"); // $a->executeString($JS); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } diff --git a/samples/test_exception.php b/samples/test_exception.php index 2fac962..c7742eb 100644 --- a/samples/test_exception.php +++ b/samples/test_exception.php @@ -19,7 +19,7 @@ try { $foo = new Foo(); - } catch (V8JsException $e) { + } catch (V8JsScriptException $e) { echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e); } diff --git a/samples/test_exception2.php b/samples/test_exception2.php index 2bc6c0a..7870091 100644 --- a/samples/test_exception2.php +++ b/samples/test_exception2.php @@ -27,7 +27,7 @@ try { $foo = new Foo(); - } catch (V8JsException $e) { + } catch (V8JsScriptException $e) { echo "PHP Exception: ", $e->getMessage(), "\n"; } diff --git a/samples/test_extend.php b/samples/test_extend.php index 8f328cb..e18065b 100644 --- a/samples/test_extend.php +++ b/samples/test_extend.php @@ -18,6 +18,6 @@ echo $a; try { $a->executeString("PHP.mytest(PHP.foo, PHP.my_private, PHP.my_protected);", "test7.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } diff --git a/samples/test_method.php b/samples/test_method.php index 6231791..80a5d54 100644 --- a/samples/test_method.php +++ b/samples/test_method.php @@ -23,13 +23,13 @@ $a->executeString("PHP.myobj.mytest(3.14, 42, null);", "test3.js"); // Invalid parameters try { $a->executeString("PHP.myobj.mytest();", "test4.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } try { $a->executeString("PHP.myobj.mytest('arg1', 'arg2', 'arg3', 'extra_arg');", "test5.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } @@ -37,12 +37,12 @@ try { try { // date_default_timezone_set("UTC"); $a->executeString("date = new Date('September 8, 1975 09:00:00'); PHP.print(date); PHP.myobj.mytest(date, PHP.myobj, new Array(1,2,3));", "test6.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } try { $a->executeString("PHP.myobj.mytest(PHP.myobj, new Array(1,2,3), new Array('foo', 'bar', PHP.myobj));", "test7.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } diff --git a/test.php b/test.php index e42c673..93f6d90 100644 --- a/test.php +++ b/test.php @@ -139,7 +139,7 @@ $a->executeString("bigarray()", "test1.js"); try { echo($a->executeString($jstparser, "test2.js")), "\n"; var_dump($a->executeString($jsontemplate, "test1.js")); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(); } @@ -168,6 +168,6 @@ var_dump($b->executeString("print('foobar\\n');")); try { $b->executeString("foobar; foo();", "extest.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e, $e->getJsFileName(), $e->getJsLineNumber(), $e->getJsSourceLine(), $e->getJsTrace()); } diff --git a/tests/basic.phpt b/tests/basic.phpt index 6bb654d..8d3bdf6 100644 --- a/tests/basic.phpt +++ b/tests/basic.phpt @@ -14,7 +14,7 @@ $v8 = new V8Js(); try { var_dump($v8->executeString($JS, 'basic.js')); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } ?> diff --git a/tests/closures_basic.phpt b/tests/closures_basic.phpt index 0d8014d..acf3357 100644 --- a/tests/closures_basic.phpt +++ b/tests/closures_basic.phpt @@ -10,7 +10,7 @@ $a->func = function ($arg) { echo "Hello {$arg}, I'm Closure!\n"; }; try { $a->executeString('print(PHP.func + "\n"); PHP.func("foobar");', "closure_test.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } ?> diff --git a/tests/closures_dynamic.phpt b/tests/closures_dynamic.phpt index 160a9aa..e74d6d1 100644 --- a/tests/closures_dynamic.phpt +++ b/tests/closures_dynamic.phpt @@ -19,7 +19,7 @@ $a->func = function ($arg) use ($b) { return call_user_func($b, $arg); }; try { $a->executeString('print(PHP.func + "\n"); print(PHP.func("world") + "\n");', "closure_test.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } ?> diff --git a/tests/construct.phpt b/tests/construct.phpt index 729db63..ba7a7fc 100644 --- a/tests/construct.phpt +++ b/tests/construct.phpt @@ -14,7 +14,7 @@ $v8->__construct(); try { $v8->executeString($JS, 'basic.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } ?> diff --git a/tests/context_preserving.phpt b/tests/context_preserving.phpt index 424f1b9..2540d45 100644 --- a/tests/context_preserving.phpt +++ b/tests/context_preserving.phpt @@ -27,7 +27,7 @@ $a->ctx = '#1'; try { echo '1. '; $a->executeString($JS_set, 'set.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } @@ -38,7 +38,7 @@ $b->ctx = '#2'; try { echo '2. '; $b->executeString($JS_change, 'change.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } @@ -46,7 +46,7 @@ try { try { echo '3. '; $a->executeString($JS_read, 'read.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } @@ -54,7 +54,7 @@ try { try { echo '4. '; $a->executeString($JS_change, 'change.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } @@ -62,7 +62,7 @@ try { try { echo '5. '; $a->executeString($JS_read, 'read.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } ?> diff --git a/tests/context_separation.phpt b/tests/context_separation.phpt index d00a73a..20cf217 100644 --- a/tests/context_separation.phpt +++ b/tests/context_separation.phpt @@ -14,7 +14,7 @@ $a->foo = 'from first.js'; try { $a->executeString($JS, 'first.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } @@ -25,7 +25,7 @@ $b->foo = 'from second.js'; try { $b->executeString($JS, 'second.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } diff --git a/tests/exception.phpt b/tests/exception.phpt index 3e0a3ca..aec5cd3 100644 --- a/tests/exception.phpt +++ b/tests/exception.phpt @@ -1,5 +1,5 @@ --TEST-- -Test V8::executeString() : V8JsException +Test V8::executeString() : V8JsScriptException --SKIPIF-- --FILE-- @@ -13,13 +13,13 @@ $v8 = new V8Js(); try { $v8->executeString($JS, 'exception.js'); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } ?> ===EOF=== --EXPECTF-- -object(V8JsException)#2 (11) { +object(V8JsScriptException)#2 (11) { ["message":protected]=> string(75) "exception.js:1: ReferenceError: this_function_does_not_exist is not defined" ["string":"Exception":private]=> diff --git a/tests/exception_propagation_1.phpt b/tests/exception_propagation_1.phpt index 0b38807..cdc7f5f 100644 --- a/tests/exception_propagation_1.phpt +++ b/tests/exception_propagation_1.phpt @@ -27,7 +27,7 @@ class Foo { try { $foo = new Foo(); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e); } ?> diff --git a/tests/exception_propagation_2.phpt b/tests/exception_propagation_2.phpt index ab89012..29496fe 100644 --- a/tests/exception_propagation_2.phpt +++ b/tests/exception_propagation_2.phpt @@ -27,13 +27,13 @@ class Foo { try { $foo = new Foo(); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e); } ?> ===EOF=== --EXPECTF-- -object(V8JsException)#3 (11) { +object(V8JsScriptException)#3 (11) { ["message":protected]=> string(49) "throw_0:1: ReferenceError: fooobar is not defined" ["string":"Exception":private]=> diff --git a/tests/exception_propagation_3.phpt b/tests/exception_propagation_3.phpt index 5015078..622fd3c 100644 --- a/tests/exception_propagation_3.phpt +++ b/tests/exception_propagation_3.phpt @@ -26,7 +26,7 @@ class Foo { try { $foo = new Foo(); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo "PHP Exception: ", $e->getMessage(), "\n"; } ?> diff --git a/tests/execute_flags.phpt b/tests/execute_flags.phpt index fa7c1a6..62640bf 100644 --- a/tests/execute_flags.phpt +++ b/tests/execute_flags.phpt @@ -15,7 +15,7 @@ try { var_dump($v8->executeString($js, 'assoc_no_flags.js')); echo "---\n"; var_dump($v8->executeString($js, 'assoc_force_to_array.js', V8Js::FLAG_FORCE_ARRAY)); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } ?> diff --git a/tests/execute_flags_args.phpt b/tests/execute_flags_args.phpt index 6dbbcc4..6a25d2e 100644 --- a/tests/execute_flags_args.phpt +++ b/tests/execute_flags_args.phpt @@ -17,7 +17,7 @@ try { $v8->executeString($js, 'no_flags.js'); echo "---\n"; $v8->executeString($js, 'force_to_array.js', V8Js::FLAG_FORCE_ARRAY); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); } ?> diff --git a/tests/object_method_call.phpt b/tests/object_method_call.phpt index c103bed..4a7a9c5 100644 --- a/tests/object_method_call.phpt +++ b/tests/object_method_call.phpt @@ -36,13 +36,13 @@ $a->executeString("PHP.myobj.mytest(3.14, 42, null);", "test3.js"); // Invalid parameters try { $a->executeString("PHP.myobj.mytest();", "test4.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } try { $a->executeString("PHP.myobj.mytest('arg1', 'arg2', 'arg3', 'extra_arg');", "test5.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } @@ -50,14 +50,14 @@ try { echo "\nTEST: Javascript Date -> PHP DateTime\n"; echo "======================================\n"; $a->executeString("date = new Date('September 8, 1975 09:00:00 GMT'); print(date.toUTCString() + '\\n'); PHP.myobj.mydatetest(date, 'foo');", "test6.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { echo $e->getMessage(), "\n"; } // Array / Object try { $a->executeString("PHP.myobj.mytest(PHP.myobj, new Array(1,2,3), new Array('foo', 'bar', PHP.myobj));", "test7.js"); -} catch (V8JsException $e) { +} catch (V8JsScriptException $e) { var_dump($e); }