0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-10 02:38:42 +00:00

Deprecate V8Js::checkString() in favour of compileString() and add tests.

This commit is contained in:
Taneli Leppa 2014-05-27 10:41:32 +03:00
parent bd7d649d90
commit 7310c93c1e
3 changed files with 26 additions and 2 deletions

View File

@ -15,7 +15,10 @@ try {
} }
?> ?>
===EOF=== ===EOF===
--EXPECT-- --EXPECTF--
Deprecated: Function V8Js::checkString() is deprecated in %s on line %d
bool(true) bool(true)
Deprecated: Function V8Js::checkString() is deprecated in %s on line %d
string(60) "V8Js::checkString():1: SyntaxError: Unexpected token ILLEGAL" string(60) "V8Js::checkString():1: SyntaxError: Unexpected token ILLEGAL"
===EOF=== ===EOF===

View File

@ -0,0 +1,21 @@
--TEST--
Test V8::executeString() : Script validator test using compileString
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$v8 = new V8Js();
var_dump($v8->compileString('print("Hello World!");'));
try {
var_dump($v8->compileString('print("Hello World!);'));
} catch (V8JsScriptException $e) {
var_dump($e->getMessage());
}
?>
===EOF===
--EXPECTF--
resource(%d) of type (V8Js script)
string(62) "V8Js::compileString():1: SyntaxError: Unexpected token ILLEGAL"
===EOF===

View File

@ -1732,7 +1732,7 @@ static const zend_function_entry v8js_methods[] = { /* {{{ */
PHP_ME(V8Js, executeString, arginfo_v8js_executestring, ZEND_ACC_PUBLIC) PHP_ME(V8Js, executeString, arginfo_v8js_executestring, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, compileString, arginfo_v8js_compilestring, ZEND_ACC_PUBLIC) PHP_ME(V8Js, compileString, arginfo_v8js_compilestring, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, executeScript, arginfo_v8js_executescript, ZEND_ACC_PUBLIC) PHP_ME(V8Js, executeScript, arginfo_v8js_executescript, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, checkString, arginfo_v8js_checkstring, ZEND_ACC_PUBLIC) PHP_ME(V8Js, checkString, arginfo_v8js_checkstring, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
PHP_ME(V8Js, getPendingException, arginfo_v8js_getpendingexception, ZEND_ACC_PUBLIC) PHP_ME(V8Js, getPendingException, arginfo_v8js_getpendingexception, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, setModuleLoader, arginfo_v8js_setmoduleloader, ZEND_ACC_PUBLIC) PHP_ME(V8Js, setModuleLoader, arginfo_v8js_setmoduleloader, ZEND_ACC_PUBLIC)
PHP_ME(V8Js, registerExtension, arginfo_v8js_registerextension, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(V8Js, registerExtension, arginfo_v8js_registerextension, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)