ソースを参照

[test] Use phpunit to specify the parameters of the server used by the suite.

This is especially handy because users can now easily override them without
modifying the source code of the test suite and just by creating a phpunit.xml
file that is automatically picked up by phpunit over the phpunit.xml.dist file
shipped within the repository.
Daniele Alessandri 13 年 前
コミット
2c1f349925
2 ファイル変更11 行追加4 行削除
  1. 7 0
      phpunit.xml.dist
  2. 4 4
      test/PredisShared.php

+ 7 - 0
phpunit.xml.dist

@@ -12,4 +12,11 @@
             <directory suffix=".php">lib/Predis/</directory>
             <directory suffix=".php">lib/Predis/</directory>
         </whitelist>
         </whitelist>
     </filter>
     </filter>
+
+    <php>
+        <const name="TEST_SERVER_VERSION" value="2.2" />
+        <const name="TEST_SERVER_HOST" value="127.0.0.1" />
+        <const name="TEST_SERVER_PORT" value="6379" />
+        <const name="TEST_SERVER_DBNUM" value="15" />
+    </php>
 </phpunit>
 </phpunit>

+ 4 - 4
test/PredisShared.php

@@ -26,10 +26,10 @@ if (!function_exists('array_union')) {
 
 
 class RC
 class RC
 {
 {
-    const SERVER_VERSION   = '2.2';
-    const SERVER_HOST      = '127.0.0.1';
-    const SERVER_PORT      = 6379;
-    const DEFAULT_DATABASE = 15;
+    const SERVER_VERSION   = TEST_SERVER_VERSION;
+    const SERVER_HOST      = TEST_SERVER_HOST;
+    const SERVER_PORT      = TEST_SERVER_PORT;
+    const DEFAULT_DATABASE = TEST_SERVER_DBNUM;
 
 
     const WIPE_OUT         = 1;
     const WIPE_OUT         = 1;
     const EXCEPTION_WRONG_TYPE     = 'ERR Operation against a key holding the wrong kind of value';
     const EXCEPTION_WRONG_TYPE     = 'ERR Operation against a key holding the wrong kind of value';