diff options
| author | jvoisin | 2019-01-14 19:29:25 +0000 |
|---|---|---|
| committer | GitHub | 2019-01-14 19:29:25 +0000 |
| commit | e79f7e3bd992c7f0915ef9afe7afb6d79740527a (patch) | |
| tree | f881c25694eb00da2331a9ab280ec1c24a5662ab /src/tests/eval_blacklist/eval_whitelist_simulation.phpt | |
| parent | c943db586ac46b686b49bdf61d8473e39dd93000 (diff) | |
Reorganize the testsuite
Splitting the testsuite in several components makes it easier to manage and comprehend.
This was also needed some some tests aren't passing on Alpine Linux, but we still want to run
as many of them as we can on this platform.
Diffstat (limited to 'src/tests/eval_blacklist/eval_whitelist_simulation.phpt')
| -rw-r--r-- | src/tests/eval_blacklist/eval_whitelist_simulation.phpt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/eval_blacklist/eval_whitelist_simulation.phpt b/src/tests/eval_blacklist/eval_whitelist_simulation.phpt new file mode 100644 index 0000000..c4a3efa --- /dev/null +++ b/src/tests/eval_blacklist/eval_whitelist_simulation.phpt | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | --TEST-- | ||
| 2 | Eval whitelist simulation | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/eval_whitelist_simulation.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function my_fun($p) { | ||
| 10 | return "my_fun: $p"; | ||
| 11 | } | ||
| 12 | |||
| 13 | function my_other_fun($p) { | ||
| 14 | return "my_other_fun: $p"; | ||
| 15 | } | ||
| 16 | |||
| 17 | $a = my_fun("1337 1337 1337"); | ||
| 18 | echo "Outside of eval: $a\n"; | ||
| 19 | eval('$a = my_fun("1234");'); | ||
| 20 | echo "After allowed eval: $a\n"; | ||
| 21 | eval('$a = my_other_fun("1234");'); | ||
| 22 | echo "After eval: $a\n"; | ||
| 23 | ?> | ||
| 24 | --EXPECTF-- | ||
| 25 | Outside of eval: my_fun: 1337 1337 1337 | ||
| 26 | After allowed eval: my_fun: 1234 | ||
| 27 | |||
| 28 | Warning: [snuffleupagus][Eval_whitelist] The function 'my_other_fun' isn't in the eval whitelist, logging its call. in %a/eval_whitelist_simulation.php on line 7 | ||
| 29 | After eval: my_other_fun: 1234 \ No newline at end of file | ||
