Skip to content
Permalink
Browse files

Use CACHE folder instead of TMP for cache tests.

This avoids random failures.
  • Loading branch information...
ADmad committed Oct 9, 2018
1 parent 041f672 commit 811000647287600e5ba92602013f79a0f83fd4c2
Showing with 22 additions and 22 deletions.
  1. +22 −22 tests/TestCase/Cache/CacheTest.php
@@ -61,7 +61,7 @@ protected function _configCache()
{
Cache::setConfig('tests', [
'engine' => 'File',
'path' => TMP,
'path' => CACHE,
'prefix' => 'test_'
]);
}
@@ -73,7 +73,7 @@ protected function _configCache()
*/
public function testCacheEngineFallback()
{
$filename = tempnam(TMP, 'tmp_');
$filename = tempnam(CACHE, 'tmp_');
Cache::setConfig('tests', [
'engine' => 'File',
@@ -83,13 +83,13 @@ public function testCacheEngineFallback()
]);
Cache::setConfig('tests_fallback', [
'engine' => 'File',
'path' => TMP,
'path' => CACHE,
'prefix' => 'test_',
]);
$engine = Cache::engine('tests');
$path = $engine->getConfig('path');
$this->assertSame(TMP, $path);
$this->assertSame(CACHE, $path);
Cache::drop('tests');
Cache::drop('tests_fallback');
@@ -105,7 +105,7 @@ public function testCacheEngineFallbackDisabled()
{
$this->expectException(Error::class);
$filename = tempnam(TMP, 'tmp_');
$filename = tempnam(CACHE, 'tmp_');
Cache::setConfig('tests', [
'engine' => 'File',
@@ -124,7 +124,7 @@ public function testCacheEngineFallbackDisabled()
*/
public function testCacheEngineFallbackToSelf()
{
$filename = tempnam(TMP, 'tmp_');
$filename = tempnam(CACHE, 'tmp_');
Cache::setConfig('tests', [
'engine' => 'File',
@@ -154,7 +154,7 @@ public function testCacheEngineFallbackToSelf()
*/
public function testCacheFallbackWithGroups()
{
$filename = tempnam(TMP, 'tmp_');
$filename = tempnam(CACHE, 'tmp_');
Cache::setConfig('tests', [
'engine' => 'File',
@@ -165,7 +165,7 @@ public function testCacheFallbackWithGroups()
]);
Cache::setConfig('tests_fallback', [
'engine' => 'File',
'path' => TMP,
'path' => CACHE,
'prefix' => 'test_',
'groups' => ['group3', 'group1'],
]);
@@ -188,7 +188,7 @@ public function testCacheFallbackWithGroups()
*/
public function testCacheFallbackIntegration()
{
$filename = tempnam(TMP, 'tmp_');
$filename = tempnam(CACHE, 'tmp_');
Cache::setConfig('tests', [
'engine' => 'File',
@@ -204,7 +204,7 @@ public function testCacheFallbackIntegration()
]);
Cache::setConfig('tests_fallback_final', [
'engine' => 'File',
'path' => TMP . 'cake_test' . DS,
'path' => CACHE . 'cake_test' . DS,
'groups' => ['integration_group_3'],
]);
@@ -300,12 +300,12 @@ public function testConfigWithLibAndPluginEngines()
static::setAppNamespace();
Plugin::load('TestPlugin');
$config = ['engine' => 'TestAppCache', 'path' => TMP, 'prefix' => 'cake_test_'];
$config = ['engine' => 'TestAppCache', 'path' => CACHE, 'prefix' => 'cake_test_'];
Cache::setConfig('libEngine', $config);
$engine = Cache::engine('libEngine');
$this->assertInstanceOf('TestApp\Cache\Engine\TestAppCacheEngine', $engine);
$config = ['engine' => 'TestPlugin.TestPluginCache', 'path' => TMP, 'prefix' => 'cake_test_'];
$config = ['engine' => 'TestPlugin.TestPluginCache', 'path' => CACHE, 'prefix' => 'cake_test_'];
$result = Cache::setConfig('pluginLibEngine', $config);
$engine = Cache::engine('pluginLibEngine');
$this->assertInstanceOf('TestPlugin\Cache\Engine\TestPluginCacheEngine', $engine);
@@ -359,12 +359,12 @@ public static function configProvider()
return [
'Array of data using engine key.' => [[
'engine' => 'File',
'path' => TMP . 'tests',
'path' => CACHE . 'tests',
'prefix' => 'cake_test_'
]],
'Array of data using classname key.' => [[
'className' => 'File',
'path' => TMP . 'tests',
'path' => CACHE . 'tests',
'prefix' => 'cake_test_'
]],
'Direct instance' => [new FileEngine()],
@@ -425,7 +425,7 @@ public function testConfigInvalidObject()
public function testConfigErrorOnReconfigure()
{
$this->expectException(\BadMethodCallException::class);
Cache::setConfig('tests', ['engine' => 'File', 'path' => TMP]);
Cache::setConfig('tests', ['engine' => 'File', 'path' => CACHE]);
Cache::setConfig('tests', ['engine' => 'Apc']);
}
@@ -440,7 +440,7 @@ public function testConfigReadCompat()
$this->deprecated(function () {
$config = [
'engine' => 'File',
'path' => TMP,
'path' => CACHE,
'prefix' => 'cake_'
];
Cache::config('tests', $config);
@@ -460,7 +460,7 @@ public function testConfigRead()
{
$config = [
'engine' => 'File',
'path' => TMP,
'path' => CACHE,
'prefix' => 'cake_'
];
Cache::setConfig('tests', $config);
@@ -479,7 +479,7 @@ public function testConfigDottedAlias()
{
Cache::setConfig('cache.dotted', [
'className' => 'File',
'path' => TMP,
'path' => CACHE,
'prefix' => 'cache_value_'
]);
@@ -731,7 +731,7 @@ public function testCacheDisable()
Cache::enable();
Cache::setConfig('test_cache_disable_1', [
'engine' => 'File',
'path' => TMP . 'tests'
'path' => CACHE . 'tests'
]);
$this->assertTrue(Cache::write('key_1', 'hello', 'test_cache_disable_1'));
@@ -751,7 +751,7 @@ public function testCacheDisable()
Cache::disable();
Cache::setConfig('test_cache_disable_2', [
'engine' => 'File',
'path' => TMP . 'tests'
'path' => CACHE . 'tests'
]);
$this->assertNull(Cache::write('key_4', 'hello', 'test_cache_disable_2'));
@@ -779,11 +779,11 @@ public function testClearAll()
{
Cache::setConfig('configTest', [
'engine' => 'File',
'path' => TMP . 'tests'
'path' => CACHE . 'tests'
]);
Cache::setConfig('anotherConfigTest', [
'engine' => 'File',
'path' => TMP . 'tests'
'path' => CACHE . 'tests'
]);
Cache::write('key_1', 'hello', 'configTest');

0 comments on commit 8110006

Please sign in to comment.
You can’t perform that action at this time.