瀏覽代碼

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 13 年之前
父節點
當前提交
4251664095
共有 2 個文件被更改,包括 5 次插入8 次删除
  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"
     );
 }