minor #19540 [Cache] Minor cleanup (nicolas-grekas)

This PR was merged into the 3.1 branch.

Discussion
----------

[Cache] Minor cleanup

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

34d9518 [Cache] Minor cleanup
This commit is contained in:
Nicolas Grekas 2016-08-05 10:40:17 +02:00
commit c45b91650c
6 changed files with 9 additions and 18 deletions

View File

@ -270,9 +270,6 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
if (!$item instanceof CacheItem) {
return false;
}
if ($this->deferred) {
$this->commit();
}
$this->deferred[$item->getKey()] = $item;
return $this->commit();

View File

@ -19,10 +19,6 @@ abstract class AbstractRedisAdapterTest extends AdapterTestCase
public function createCachePool($defaultLifetime = 0)
{
if (defined('HHVM_VERSION')) {
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Fails on HHVM';
}
return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}

View File

@ -15,6 +15,15 @@ use Cache\IntegrationTests\CachePoolTest;
abstract class AdapterTestCase extends CachePoolTest
{
protected function setUp()
{
parent::setUp();
if (!array_key_exists('testDeferredSaveWithoutCommit', $this->skippedTests) && defined('HHVM_VERSION')) {
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Destructors are called late on HHVM.';
}
}
public function testDefaultLifeTime()
{
if (isset($this->skippedTests[__FUNCTION__])) {

View File

@ -17,9 +17,6 @@ class ApcuAdapterTest extends AdapterTestCase
{
public function createCachePool($defaultLifetime = 0)
{
if (defined('HHVM_VERSION')) {
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Fails on HHVM';
}
if (!function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) {
$this->markTestSkipped('APCu extension is required.');
}

View File

@ -23,10 +23,6 @@ class ChainAdapterTest extends AdapterTestCase
{
public function createCachePool($defaultLifetime = 0)
{
if (defined('HHVM_VERSION')) {
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Fails on HHVM';
}
return new ChainAdapter(array(new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)), $defaultLifetime);
}

View File

@ -20,10 +20,6 @@ class FilesystemAdapterTest extends AdapterTestCase
{
public function createCachePool($defaultLifetime = 0)
{
if (defined('HHVM_VERSION')) {
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Fails on HHVM';
}
return new FilesystemAdapter('', $defaultLifetime);
}