mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-09-04 08:30:14 +00:00
- slim/slim: ^3.1 - symfony/expression-language: ^3.4 - fxp/composer-asset-plugin: ~1.3 - bower-asset/vue: ^2.5 - bower-asset/vue-resource: ^1.5
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Component\Cache\Tests\Adapter;
|
|
|
|
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
|
|
|
/**
|
|
* @group time-sensitive
|
|
*/
|
|
class ArrayAdapterTest extends AdapterTestCase
|
|
{
|
|
protected $skippedTests = array(
|
|
'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.',
|
|
'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.',
|
|
);
|
|
|
|
public function createCachePool($defaultLifetime = 0)
|
|
{
|
|
return new ArrayAdapter($defaultLifetime);
|
|
}
|
|
|
|
public function testGetValuesHitAndMiss()
|
|
{
|
|
/** @var ArrayAdapter $cache */
|
|
$cache = $this->createCachePool();
|
|
|
|
// Hit
|
|
$item = $cache->getItem('foo');
|
|
$item->set('4711');
|
|
$cache->save($item);
|
|
|
|
$fooItem = $cache->getItem('foo');
|
|
$this->assertTrue($fooItem->isHit());
|
|
$this->assertEquals('4711', $fooItem->get());
|
|
|
|
// Miss (should be present as NULL in $values)
|
|
$cache->getItem('bar');
|
|
|
|
$values = $cache->getValues();
|
|
|
|
$this->assertCount(2, $values);
|
|
$this->assertArrayHasKey('foo', $values);
|
|
$this->assertSame(serialize('4711'), $values['foo']);
|
|
$this->assertArrayHasKey('bar', $values);
|
|
$this->assertNull($values['bar']);
|
|
}
|
|
}
|