Browse Source

Add test verifying you can disable cache fallbacks

Andy Dawson 8 years ago
parent
commit
21f088e6df
1 changed files with 21 additions and 0 deletions
  1. 21 0
      tests/TestCase/Cache/CacheTest.php

+ 21 - 0
tests/TestCase/Cache/CacheTest.php

@@ -97,6 +97,27 @@ class CacheTest extends TestCase
     }
 
     /**
+     * tests you can disable Cache::engine() fallback
+     *
+     * @return void
+     */
+    public function testCacheEngineFallbackDisabled()
+    {
+        $this->expectException(Error::class);
+
+        $filename = tempnam(TMP, 'tmp_');
+
+        Cache::setConfig('tests', [
+            'engine' => 'File',
+            'path' => $filename,
+            'prefix' => 'test_',
+            'fallback' => false
+        ]);
+
+        $engine = Cache::engine('tests');
+    }
+
+    /**
      * tests handling misconfiguration of fallback
      *
      * @return void