ソースを参照

Set apc.use_request_time to 0

otherwise ttl checking tests fail
Andy Dawson 8 年 前
コミット
7234374492
1 ファイル変更28 行追加0 行削除
  1. 28 0
      tests/TestCase/Cache/Engine/ApcuEngineTest.php

+ 28 - 0
tests/TestCase/Cache/Engine/ApcuEngineTest.php

@@ -23,6 +23,34 @@ use Cake\TestSuite\TestCase;
  */
 class ApcuEngineTest extends TestCase
 {
+    /**
+     * useRequestTime original value
+     *
+     * @var bool
+     */
+    static protected $useRequestTime = null;
+
+    /**
+     * Ensure use_request_time is turned off
+     *
+     * If use_request_time is on, all cache entries are inserted with the same
+     * timestamp and ttl comparisons within the same request are effectively
+     * meaningless
+     */
+    public static function setUpBeforeClass()
+    {
+        static::$useRequestTime = ini_get('apc.use_request_time');
+        ini_set('apc.use_request_time', 0);
+    }
+
+    /**
+     * Reset apc.user_request_time to original value
+     *
+     */
+    public static function teardownAfterClass()
+    {
+        ini_set('apc.use_request_time', static::$useRequestTime);
+    }
 
     /**
      * setUp method