mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-09-04 08:10:08 +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
71 lines
1.7 KiB
PHP
71 lines
1.7 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 Psr\Cache\CacheItemInterface;
|
|
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
|
use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
|
use Symfony\Component\Cache\CacheItem;
|
|
|
|
/**
|
|
* @group time-sensitive
|
|
*/
|
|
class ProxyAdapterTest extends AdapterTestCase
|
|
{
|
|
protected $skippedTests = array(
|
|
'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.',
|
|
'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.',
|
|
'testPrune' => 'ProxyAdapter just proxies',
|
|
);
|
|
|
|
public function createCachePool($defaultLifetime = 0)
|
|
{
|
|
return new ProxyAdapter(new ArrayAdapter(), '', $defaultLifetime);
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Exception
|
|
* @expectedExceptionMessage OK bar
|
|
*/
|
|
public function testProxyfiedItem()
|
|
{
|
|
$item = new CacheItem();
|
|
$pool = new ProxyAdapter(new TestingArrayAdapter($item));
|
|
|
|
$proxyItem = $pool->getItem('foo');
|
|
|
|
$this->assertNotSame($item, $proxyItem);
|
|
$pool->save($proxyItem->set('bar'));
|
|
}
|
|
}
|
|
|
|
class TestingArrayAdapter extends ArrayAdapter
|
|
{
|
|
private $item;
|
|
|
|
public function __construct(CacheItemInterface $item)
|
|
{
|
|
$this->item = $item;
|
|
}
|
|
|
|
public function getItem($key)
|
|
{
|
|
return $this->item;
|
|
}
|
|
|
|
public function save(CacheItemInterface $item)
|
|
{
|
|
if ($item === $this->item) {
|
|
throw new \Exception('OK '.$item->get());
|
|
}
|
|
}
|
|
}
|