diff options
| author | jvoisin | 2020-11-19 18:53:57 +0100 |
|---|---|---|
| committer | jvoisin | 2020-11-20 16:41:19 +0100 |
| commit | 1cb80ae6a095d360bc2988a82468f3d38a876218 (patch) | |
| tree | 5d778732110fe1580e32a70890ad330dd75ed285 /src/tests | |
| parent | e134c87a9a7850d1db30cfe10eb0f521b27953a5 (diff) | |
Add some tests for the strict mode
Diffstat (limited to 'src/tests')
4 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/strict_mode/config/config_strict_mode_disabled.ini b/src/tests/strict_mode/config/config_strict_mode_disabled.ini new file mode 100644 index 0000000..2e68471 --- /dev/null +++ b/src/tests/strict_mode/config/config_strict_mode_disabled.ini | |||
| @@ -0,0 +1 @@ | |||
| sp.global_strict.disable(); | |||
diff --git a/src/tests/strict_mode/config/config_strict_mode_enabled.ini b/src/tests/strict_mode/config/config_strict_mode_enabled.ini new file mode 100644 index 0000000..2dc11fc --- /dev/null +++ b/src/tests/strict_mode/config/config_strict_mode_enabled.ini | |||
| @@ -0,0 +1 @@ | |||
| sp.global_strict.enable(); | |||
diff --git a/src/tests/strict_mode/strict_mode_disabled.phpt b/src/tests/strict_mode/strict_mode_disabled.phpt new file mode 100644 index 0000000..105f43c --- /dev/null +++ b/src/tests/strict_mode/strict_mode_disabled.phpt | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | --TEST-- | ||
| 2 | Strict mode disabled | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php | ||
| 5 | if (!extension_loaded("snuffleupagus")) print "skip snuffleupagus extension missing"; | ||
| 6 | ?> | ||
| 7 | --INI-- | ||
| 8 | sp.configuration_file={PWD}/config/config_strict_mode_disabled.ini | ||
| 9 | --FILE-- | ||
| 10 | <?php | ||
| 11 | ini_set('display_errors', 1); | ||
| 12 | ?> | ||
| 13 | --EXPECTF-- | ||
diff --git a/src/tests/strict_mode/strict_mode_enabled.phpt b/src/tests/strict_mode/strict_mode_enabled.phpt new file mode 100644 index 0000000..c511f9a --- /dev/null +++ b/src/tests/strict_mode/strict_mode_enabled.phpt | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --TEST-- | ||
| 2 | Strict mode enabled | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php | ||
| 5 | if (!extension_loaded("snuffleupagus")) print "skip snuffleupagus extension missing"; | ||
| 6 | ?> | ||
| 7 | --INI-- | ||
| 8 | sp.configuration_file={PWD}/config/config_strict_mode_enabled.ini | ||
| 9 | --FILE-- | ||
| 10 | <?php | ||
| 11 | ini_set('display_errors', 1); | ||
| 12 | ?> | ||
| 13 | --EXPECTF-- | ||
| 14 | Fatal error: Uncaught TypeError: ini_set() expects parameter 2 to be string, %s given in %s/tests/strict_mode/strict_mode_enabled.php:%d | ||
| 15 | Stack trace: | ||
| 16 | #0 %s/tests/strict_mode/strict_mode_enabled.php(2): ini_set('display_errors', 1) | ||
| 17 | #1 {main} | ||
| 18 | thrown in %s/tests/strict_mode/strict_mode_enabled.php on line 2 | ||
