From a2604e27499e2c5c7c3f80521355578a02a6795f Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Sun, 19 Oct 2014 15:15:20 +0000 Subject: [PATCH] Add test on php_v8js_v8_unset_property. --- tests/v8_unset_property.phpt | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/v8_unset_property.phpt diff --git a/tests/v8_unset_property.phpt b/tests/v8_unset_property.phpt new file mode 100644 index 0000000..c69f095 --- /dev/null +++ b/tests/v8_unset_property.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test V8::executeString() : unset property on V8Object +--SKIPIF-- + +--FILE-- +executeString('var a = { bla: 23 }; a'); +var_dump($a); + +// properties on $a should be unset'able +unset($a->bla); +var_dump($a); + +$v8->executeString('print(a.bla + "\\n");'); + +unset($v8); + +try { + // unset not valid, if $v8 object is disposed + unset($a->bla); +} +catch(V8JsScriptException $e) { + var_dump($e->getMessage()); +} +?> +===EOF=== +--EXPECTF-- +object(V8Object)#%d (1) { + ["bla"]=> + int(23) +} +object(V8Object)#%d (0) { +} +undefined +string(55) "Can't access V8Object after V8Js instance is destroyed!" +===EOF===