forked from phpv8/v8js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test with private/protected methods, refs phpv8#183
- Loading branch information
Stefan Siegl
committed
Jan 8, 2016
1 parent
3508f0c
commit e0f990b
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |