mirror of
https://github.com/phpv8/v8js.git
synced 2025-01-03 10:21:51 +00:00
Add test with private/protected methods, refs #183
This commit is contained in:
parent
3508f0c8e7
commit
e0f990bfa1
30
tests/issue_183_001.phpt
Normal file
30
tests/issue_183_001.phpt
Normal file
@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Test V8::executeString() : Method access on derived classes (protected)
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo extends \V8Js
|
||||
{
|
||||
protected function hello()
|
||||
{
|
||||
print("Hello World\n");
|
||||
}
|
||||
}
|
||||
|
||||
$JS = <<< EOT
|
||||
PHP.hello();
|
||||
EOT;
|
||||
|
||||
$v8 = new Foo();
|
||||
$v8->executeString($JS);
|
||||
|
||||
?>
|
||||
===EOF===
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'V8JsScriptException' with message 'V8Js::compileString():1: TypeError: PHP.hello is not a function' in %s
|
||||
Stack trace:
|
||||
#0 %s: V8Js->executeString('PHP.hello();')
|
||||
#1 {main}
|
||||
thrown in %s on line 16
|
30
tests/issue_183_002.phpt
Normal file
30
tests/issue_183_002.phpt
Normal file
@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Test V8::executeString() : Method access on derived classes (private)
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo extends \V8Js
|
||||
{
|
||||
private function hello()
|
||||
{
|
||||
print("Hello World\n");
|
||||
}
|
||||
}
|
||||
|
||||
$JS = <<< EOT
|
||||
PHP.hello();
|
||||
EOT;
|
||||
|
||||
$v8 = new Foo();
|
||||
$v8->executeString($JS);
|
||||
|
||||
?>
|
||||
===EOF===
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'V8JsScriptException' with message 'V8Js::compileString():1: TypeError: PHP.hello is not a function' in %s
|
||||
Stack trace:
|
||||
#0 %s: V8Js->executeString('PHP.hello();')
|
||||
#1 {main}
|
||||
thrown in %s on line 16
|
Loading…
Reference in New Issue
Block a user