minor #19464 [Cache] Use AdapterTestCase for new adapters (nicolas-grekas)
This PR was merged into the 3.2-dev branch.
Discussion
----------
[Cache] Use AdapterTestCase for new adapters
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
cbc1e54
[Cache] Use AdapterTestCase for new adapters
This commit is contained in:
commit
ec3a4ede27
@ -11,12 +11,11 @@
|
||||
|
||||
namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
use Cache\IntegrationTests\CachePoolTest;
|
||||
use Psr\Cache\CacheItemInterface;
|
||||
use Symfony\Component\Cache\Adapter\NullAdapter;
|
||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||
|
||||
class PhpArrayAdapterTest extends CachePoolTest
|
||||
class PhpArrayAdapterTest extends AdapterTestCase
|
||||
{
|
||||
protected $skippedTests = array(
|
||||
'testBasicUsage' => 'PhpArrayAdapter is read-only.',
|
||||
@ -45,6 +44,8 @@ class PhpArrayAdapterTest extends CachePoolTest
|
||||
'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
|
||||
'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
|
||||
'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
|
||||
|
||||
'testDefaultLifeTime' => 'PhpArrayAdapter does not allow configuring a default lifetime.',
|
||||
);
|
||||
|
||||
private static $file;
|
||||
|
@ -11,14 +11,13 @@
|
||||
|
||||
namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
use Cache\IntegrationTests\CachePoolTest;
|
||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||
|
||||
/**
|
||||
* @group time-sensitive
|
||||
*/
|
||||
class PhpArrayAdapterWithFallbackTest extends CachePoolTest
|
||||
class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
|
||||
{
|
||||
protected $skippedTests = array(
|
||||
'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
|
||||
@ -26,6 +25,7 @@ class PhpArrayAdapterWithFallbackTest extends CachePoolTest
|
||||
'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
|
||||
'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
|
||||
'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
|
||||
'testDefaultLifeTime' => 'PhpArrayAdapter does not allow configuring a default lifetime.',
|
||||
);
|
||||
|
||||
private static $file;
|
||||
|
@ -11,14 +11,17 @@
|
||||
|
||||
namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
use Cache\IntegrationTests\CachePoolTest;
|
||||
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
|
||||
|
||||
/**
|
||||
* @group time-sensitive
|
||||
*/
|
||||
class PhpFilesAdapterTest extends CachePoolTest
|
||||
class PhpFilesAdapterTest extends AdapterTestCase
|
||||
{
|
||||
protected $skippedTests = array(
|
||||
'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.',
|
||||
);
|
||||
|
||||
public function createCachePool()
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
|
@ -24,12 +24,12 @@ class TagAwareRedisAdapterTest extends AbstractRedisAdapterTest
|
||||
self::$redis->connect('127.0.0.1');
|
||||
}
|
||||
|
||||
public function createCachePool()
|
||||
public function createCachePool($defaultLifeTime = 0)
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Fails on HHVM';
|
||||
}
|
||||
|
||||
return new TagAwareRedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__));
|
||||
return new TagAwareRedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifeTime);
|
||||
}
|
||||
}
|
||||
|
@ -30,12 +30,12 @@ class TagAwareRedisArrayAdapterTest extends AbstractRedisAdapterTest
|
||||
self::$redis->connect('127.0.0.1');
|
||||
}
|
||||
|
||||
public function createCachePool()
|
||||
public function createCachePool($defaultLifeTime = 0)
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Fails on HHVM';
|
||||
}
|
||||
|
||||
return new TagAwareRedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), 0, new ArrayAdapter());
|
||||
return new TagAwareRedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), 0, new ArrayAdapter($defaultLifeTime));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user