Quellcode durchsuchen

Change the way we enable/disable the safety catch to run the test suite.

Now we check for the presence of the file "test/enable.tests" to enable the
test suite instead of relying on the value of a constant defined in PHP. In
this way we can prevent commiting an enabled test suite by mistake since the
above mentioned file is not tracked by Git (see .gitignore)..
Daniele Alessandri vor 13 Jahren
Ursprung
Commit
4251664095
2 geänderte Dateien mit 5 neuen und 8 gelöschten Zeilen
  1. 1 0
      .gitignore
  2. 4 8
      test/PredisShared.php

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 experiments/
+test/enable.tests

+ 4 - 8
test/PredisShared.php

@@ -1,14 +1,10 @@
 <?php
-// -------------------------------------------------------------------------- //
 
-define('I_AM_AWARE_OF_THE_DESTRUCTIVE_POWER_OF_THIS_TEST_SUITE', false);
-
-// -------------------------------------------------------------------------- //
-
-if (I_AM_AWARE_OF_THE_DESTRUCTIVE_POWER_OF_THIS_TEST_SUITE !== true) {
+if (!file_exists(__DIR__.'/enable.tests')) {
     exit(
-        "Please set the I_AM_AWARE_OF_THE_DESTRUCTIVE_POWER_OF_THIS_TEST_SUITE " .
-        "constant to TRUE in PredisShared.php if you want to proceed.\n"
+        "Please create an empty file named 'enabled.tests' inside the test directory ".
+        "in order to proceed.\n\n*** DO NOT *** run this test suite against servers in ".
+        "a production environment or containing data you are interested in!\n"
     );
 }