diff options
| author | jvoisin | 2017-12-28 15:14:02 +0100 |
|---|---|---|
| committer | jvoisin | 2017-12-28 15:14:02 +0100 |
| commit | 62c48bf9a85e0294b7b32cea438e904e1cd50669 (patch) | |
| tree | 7c7e88debd8b6873fe444c6ed43a674827cc8c04 /src/tests | |
| parent | b21139d922268251a19dd16f98248551863fe3e5 (diff) | |
Show in the phpinfo() is the config is valid
This should close #39
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/broken_conf_shown_in_phpinfo.phpt | 22 | ||||
| -rw-r--r-- | src/tests/example_configuration.phpt | 12 |
2 files changed, 32 insertions, 2 deletions
diff --git a/src/tests/broken_conf_shown_in_phpinfo.phpt b/src/tests/broken_conf_shown_in_phpinfo.phpt new file mode 100644 index 0000000..61e9512 --- /dev/null +++ b/src/tests/broken_conf_shown_in_phpinfo.phpt | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --TEST-- | ||
| 2 | Broken configuration | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/broken_config_regexp.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | ob_start(); | ||
| 10 | phpinfo(); | ||
| 11 | $info = ob_get_clean(); | ||
| 12 | ob_get_clean(); | ||
| 13 | if (strstr($info, 'Valid config => no') !== FALSE) { | ||
| 14 | echo "win"; | ||
| 15 | } else { | ||
| 16 | echo "lose"; | ||
| 17 | } | ||
| 18 | ?> | ||
| 19 | --EXPECT-- | ||
| 20 | [snuffleupagus][0.0.0.0][config][error] Failed to compile '*.': nothing to repeat on line 1. | ||
| 21 | [snuffleupagus][0.0.0.0][config][error] '.filename_r()' is expecting a valid regexp, and not '"*."' on line 1. | ||
| 22 | win | ||
diff --git a/src/tests/example_configuration.phpt b/src/tests/example_configuration.phpt index b7fec48..74bdb49 100644 --- a/src/tests/example_configuration.phpt +++ b/src/tests/example_configuration.phpt | |||
| @@ -6,7 +6,15 @@ Shipped configuration | |||
| 6 | sp.configuration_file={PWD}/../../config/examples.ini | 6 | sp.configuration_file={PWD}/../../config/examples.ini |
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | <?php | 8 | <?php |
| 9 | echo 0; | 9 | ob_start(); |
| 10 | phpinfo(); | ||
| 11 | $info = ob_get_clean(); | ||
| 12 | ob_get_clean(); | ||
| 13 | if (strstr($info, 'Valid config => yes') !== FALSE) { | ||
| 14 | echo "win"; | ||
| 15 | } else { | ||
| 16 | echo "lose"; | ||
| 17 | } | ||
| 10 | ?> | 18 | ?> |
| 11 | --EXPECTF-- | 19 | --EXPECTF-- |
| 12 | 0 | 20 | win |
