mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-02 06:58:49 +02:00
Updating Symfony lib and dependencies:
Package operations: 2 installs, 23 updates, 0 removals - Updating psr/log (1.1.0 => 1.1.2) - Updating symfony/debug (v3.4.30 => v3.4.35) - Updating symfony/console (v3.4.30 => v3.4.35) - Updating symfony/dotenv (v3.4.30 => v3.4.35) - Updating symfony/routing (v3.4.30 => v3.4.35) - Updating symfony/finder (v3.4.30 => v3.4.35) - Updating symfony/filesystem (v3.4.30 => v3.4.35) - Installing symfony/polyfill-util (v1.12.0) - Installing symfony/polyfill-php56 (v1.12.0) - Updating symfony/http-foundation (v3.4.30 => v3.4.35) - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35) - Updating symfony/http-kernel (v3.4.30 => v3.4.35) - Updating symfony/config (v3.4.30 => v3.4.35) - Updating symfony/dependency-injection (v3.4.30 => v3.4.35) - Updating symfony/class-loader (v3.4.30 => v3.4.35) - Updating symfony/cache (v3.4.30 => v3.4.35) - Updating symfony/framework-bundle (v3.4.30 => v3.4.35) - Updating twig/twig (v1.42.2 => v1.42.4) - Updating symfony/twig-bridge (v3.4.30 => v3.4.35) - Updating symfony/twig-bundle (v3.4.30 => v3.4.35) - Updating symfony/yaml (v3.4.30 => v3.4.35) - Updating symfony/stopwatch (v3.4.30 => v3.4.35) - Updating symfony/var-dumper (v3.4.30 => v3.4.35) - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35) - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
@@ -28,7 +28,7 @@ abstract class AbstractRedisAdapterTest extends AdapterTestCase
|
||||
return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
|
||||
}
|
||||
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!\extension_loaded('redis')) {
|
||||
self::markTestSkipped('Extension redis required.');
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||
use Symfony\Component\Cache\Adapter\ChainAdapter;
|
||||
@@ -29,21 +30,17 @@ class ChainAdapterTest extends AdapterTestCase
|
||||
return new ChainAdapter([new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage At least one adapter must be specified.
|
||||
*/
|
||||
public function testEmptyAdaptersException()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('At least one adapter must be specified.');
|
||||
new ChainAdapter([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage The class "stdClass" does not implement
|
||||
*/
|
||||
public function testInvalidAdapterException()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The class "stdClass" does not implement');
|
||||
new ChainAdapter([new \stdClass()]);
|
||||
}
|
||||
|
||||
@@ -69,7 +66,7 @@ class ChainAdapterTest extends AdapterTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
|
||||
* @return MockObject|PruneableCacheInterface
|
||||
*/
|
||||
private function getPruneableMock()
|
||||
{
|
||||
@@ -86,7 +83,7 @@ class ChainAdapterTest extends AdapterTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
|
||||
* @return MockObject|PruneableCacheInterface
|
||||
*/
|
||||
private function getFailingPruneableMock()
|
||||
{
|
||||
@@ -103,7 +100,7 @@ class ChainAdapterTest extends AdapterTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|AdapterInterface
|
||||
* @return MockObject|AdapterInterface
|
||||
*/
|
||||
private function getNonPruneableMock()
|
||||
{
|
||||
|
||||
@@ -40,6 +40,10 @@ class MaxIdLengthAdapterTest extends TestCase
|
||||
->setConstructorArgs([str_repeat('-', 26)])
|
||||
->getMock();
|
||||
|
||||
$cache
|
||||
->method('doFetch')
|
||||
->willReturn(['2:']);
|
||||
|
||||
$reflectionClass = new \ReflectionClass(AbstractAdapter::class);
|
||||
|
||||
$reflectionMethod = $reflectionClass->getMethod('getId');
|
||||
@@ -56,19 +60,17 @@ class MaxIdLengthAdapterTest extends TestCase
|
||||
$reflectionProperty->setValue($cache, true);
|
||||
|
||||
// Versioning enabled
|
||||
$this->assertEquals('--------------------------:1:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]));
|
||||
$this->assertEquals('--------------------------:2:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]));
|
||||
$this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)])));
|
||||
$this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 23)])));
|
||||
$this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)])));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Namespace must be 26 chars max, 40 given ("----------------------------------------")
|
||||
*/
|
||||
public function testTooLongNamespace()
|
||||
{
|
||||
$cache = $this->getMockBuilder(MaxIdLengthAdapter::class)
|
||||
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Namespace must be 26 chars max, 40 given ("----------------------------------------")');
|
||||
$this->getMockBuilder(MaxIdLengthAdapter::class)
|
||||
->setConstructorArgs([str_repeat('-', 40)])
|
||||
->getMock();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class MemcachedAdapterTest extends AdapterTestCase
|
||||
|
||||
protected static $client;
|
||||
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!MemcachedAdapter::isSupported()) {
|
||||
self::markTestSkipped('Extension memcached >=2.2.0 required.');
|
||||
@@ -63,11 +63,11 @@ class MemcachedAdapterTest extends AdapterTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider provideBadOptions
|
||||
* @expectedException \ErrorException
|
||||
* @expectedExceptionMessage constant(): Couldn't find constant Memcached::
|
||||
*/
|
||||
public function testBadOptions($name, $value)
|
||||
{
|
||||
$this->expectException('ErrorException');
|
||||
$this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::');
|
||||
MemcachedAdapter::createConnection([], [$name => $value]);
|
||||
}
|
||||
|
||||
@@ -93,12 +93,10 @@ class MemcachedAdapterTest extends AdapterTestCase
|
||||
$this->assertSame(1, $client->getOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Cache\Exception\CacheException
|
||||
* @expectedExceptionMessage MemcachedAdapter: "serializer" option must be "php" or "igbinary".
|
||||
*/
|
||||
public function testOptionSerializer()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Cache\Exception\CacheException');
|
||||
$this->expectExceptionMessage('MemcachedAdapter: "serializer" option must be "php" or "igbinary".');
|
||||
if (!\Memcached::HAVE_JSON) {
|
||||
$this->markTestSkipped('Memcached::HAVE_JSON required');
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class PdoAdapterTest extends AdapterTestCase
|
||||
|
||||
protected static $dbFile;
|
||||
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!\extension_loaded('pdo_sqlite')) {
|
||||
self::markTestSkipped('Extension pdo_sqlite required.');
|
||||
|
||||
@@ -24,7 +24,7 @@ class PdoDbalAdapterTest extends AdapterTestCase
|
||||
|
||||
protected static $dbFile;
|
||||
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!\extension_loaded('pdo_sqlite')) {
|
||||
self::markTestSkipped('Extension pdo_sqlite required.');
|
||||
|
||||
@@ -55,7 +55,7 @@ class PhpArrayAdapterTest extends AdapterTestCase
|
||||
|
||||
protected static $file;
|
||||
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
|
||||
|
||||
protected static $file;
|
||||
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ use Symfony\Component\Cache\Adapter\RedisAdapter;
|
||||
|
||||
class PredisAdapterTest extends AbstractRedisAdapterTest
|
||||
{
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setupBeforeClass();
|
||||
parent::setUpBeforeClass();
|
||||
self::$redis = new \Predis\Client(['host' => getenv('REDIS_HOST')]);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
class PredisClusterAdapterTest extends AbstractRedisAdapterTest
|
||||
{
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setupBeforeClass();
|
||||
parent::setUpBeforeClass();
|
||||
self::$redis = new \Predis\Client([['host' => getenv('REDIS_HOST')]]);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest
|
||||
{
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
|
||||
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
|
||||
|
||||
@@ -32,12 +32,10 @@ class ProxyAdapterTest extends AdapterTestCase
|
||||
return new ProxyAdapter(new ArrayAdapter(), '', $defaultLifetime);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage OK bar
|
||||
*/
|
||||
public function testProxyfiedItem()
|
||||
{
|
||||
$this->expectException('Exception');
|
||||
$this->expectExceptionMessage('OK bar');
|
||||
$item = new CacheItem();
|
||||
$pool = new ProxyAdapter(new TestingArrayAdapter($item));
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ use Symfony\Component\Cache\Traits\RedisProxy;
|
||||
|
||||
class RedisAdapterTest extends AbstractRedisAdapterTest
|
||||
{
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setupBeforeClass();
|
||||
parent::setUpBeforeClass();
|
||||
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]);
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ class RedisAdapterTest extends AbstractRedisAdapterTest
|
||||
|
||||
/**
|
||||
* @dataProvider provideFailedCreateConnection
|
||||
* @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Redis connection failed
|
||||
*/
|
||||
public function testFailedCreateConnection($dsn)
|
||||
{
|
||||
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Redis connection failed');
|
||||
RedisAdapter::createConnection($dsn);
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ class RedisAdapterTest extends AbstractRedisAdapterTest
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidCreateConnection
|
||||
* @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Invalid Redis DSN
|
||||
*/
|
||||
public function testInvalidCreateConnection($dsn)
|
||||
{
|
||||
$this->expectException('Symfony\Component\Cache\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Invalid Redis DSN');
|
||||
RedisAdapter::createConnection($dsn);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
class RedisArrayAdapterTest extends AbstractRedisAdapterTest
|
||||
{
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setupBeforeClass();
|
||||
if (!class_exists('RedisArray')) {
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
class RedisClusterAdapterTest extends AbstractRedisAdapterTest
|
||||
{
|
||||
public static function setupBeforeClass()
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!class_exists('RedisCluster')) {
|
||||
self::markTestSkipped('The RedisCluster class is required.');
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Cache\Tests\Adapter;
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Cache\CacheItemInterface;
|
||||
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
||||
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
|
||||
@@ -30,11 +32,9 @@ class TagAwareAdapterTest extends AdapterTestCase
|
||||
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Psr\Cache\InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidTag()
|
||||
{
|
||||
$this->expectException('Psr\Cache\InvalidArgumentException');
|
||||
$pool = $this->createCachePool();
|
||||
$item = $pool->getItem('foo');
|
||||
$item->tag(':');
|
||||
@@ -161,8 +161,119 @@ class TagAwareAdapterTest extends AdapterTestCase
|
||||
$this->assertFalse($cache->prune());
|
||||
}
|
||||
|
||||
public function testKnownTagVersionsTtl()
|
||||
{
|
||||
$itemsPool = new FilesystemAdapter('', 10);
|
||||
$tagsPool = $this
|
||||
->getMockBuilder(AdapterInterface::class)
|
||||
->getMock();
|
||||
|
||||
$pool = new TagAwareAdapter($itemsPool, $tagsPool, 10);
|
||||
|
||||
$item = $pool->getItem('foo');
|
||||
$item->tag(['baz']);
|
||||
$item->expiresAfter(100);
|
||||
|
||||
$tag = $this->getMockBuilder(CacheItemInterface::class)->getMock();
|
||||
$tag->expects(self::exactly(2))->method('get')->willReturn(10);
|
||||
|
||||
$tagsPool->expects(self::exactly(2))->method('getItems')->willReturn([
|
||||
'baz'.TagAwareAdapter::TAGS_PREFIX => $tag,
|
||||
]);
|
||||
|
||||
$pool->save($item);
|
||||
$this->assertTrue($pool->getItem('foo')->isHit());
|
||||
$this->assertTrue($pool->getItem('foo')->isHit());
|
||||
|
||||
sleep(20);
|
||||
|
||||
$this->assertTrue($pool->getItem('foo')->isHit());
|
||||
|
||||
sleep(5);
|
||||
|
||||
$this->assertTrue($pool->getItem('foo')->isHit());
|
||||
}
|
||||
|
||||
public function testTagEntryIsCreatedForItemWithoutTags()
|
||||
{
|
||||
$pool = $this->createCachePool();
|
||||
|
||||
$itemKey = 'foo';
|
||||
$item = $pool->getItem($itemKey);
|
||||
$pool->save($item);
|
||||
|
||||
$adapter = new FilesystemAdapter();
|
||||
$this->assertTrue($adapter->hasItem(TagAwareAdapter::TAGS_PREFIX.$itemKey));
|
||||
}
|
||||
|
||||
public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemTags()
|
||||
{
|
||||
$pool = $this->createCachePool();
|
||||
|
||||
$itemKey = 'foo';
|
||||
$item = $pool->getItem($itemKey);
|
||||
$pool->save($item);
|
||||
|
||||
$anotherPool = $this->createCachePool();
|
||||
|
||||
$adapter = new FilesystemAdapter();
|
||||
$adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX.$itemKey); //simulate item losing tags pair
|
||||
|
||||
$this->assertFalse($anotherPool->hasItem($itemKey));
|
||||
}
|
||||
|
||||
public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemTags()
|
||||
{
|
||||
$pool = $this->createCachePool();
|
||||
|
||||
$itemKey = 'foo';
|
||||
$item = $pool->getItem($itemKey);
|
||||
$pool->save($item);
|
||||
|
||||
$anotherPool = $this->createCachePool();
|
||||
|
||||
$adapter = new FilesystemAdapter();
|
||||
$adapter->deleteItem(TagAwareAdapter::TAGS_PREFIX.$itemKey); //simulate item losing tags pair
|
||||
|
||||
$item = $anotherPool->getItem($itemKey);
|
||||
$this->assertFalse($item->isHit());
|
||||
}
|
||||
|
||||
public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemAndOnlyHasTags()
|
||||
{
|
||||
$pool = $this->createCachePool();
|
||||
|
||||
$itemKey = 'foo';
|
||||
$item = $pool->getItem($itemKey);
|
||||
$pool->save($item);
|
||||
|
||||
$anotherPool = $this->createCachePool();
|
||||
|
||||
$adapter = new FilesystemAdapter();
|
||||
$adapter->deleteItem($itemKey); //simulate losing item but keeping tags
|
||||
|
||||
$this->assertFalse($anotherPool->hasItem($itemKey));
|
||||
}
|
||||
|
||||
public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemAndOnlyHasTags()
|
||||
{
|
||||
$pool = $this->createCachePool();
|
||||
|
||||
$itemKey = 'foo';
|
||||
$item = $pool->getItem($itemKey);
|
||||
$pool->save($item);
|
||||
|
||||
$anotherPool = $this->createCachePool();
|
||||
|
||||
$adapter = new FilesystemAdapter();
|
||||
$adapter->deleteItem($itemKey); //simulate losing item but keeping tags
|
||||
|
||||
$item = $anotherPool->getItem($itemKey);
|
||||
$this->assertFalse($item->isHit());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
|
||||
* @return MockObject|PruneableCacheInterface
|
||||
*/
|
||||
private function getPruneableMock()
|
||||
{
|
||||
@@ -179,7 +290,7 @@ class TagAwareAdapterTest extends AdapterTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|PruneableCacheInterface
|
||||
* @return MockObject|PruneableCacheInterface
|
||||
*/
|
||||
private function getFailingPruneableMock()
|
||||
{
|
||||
@@ -196,7 +307,7 @@ class TagAwareAdapterTest extends AdapterTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|AdapterInterface
|
||||
* @return MockObject|AdapterInterface
|
||||
*/
|
||||
private function getNonPruneableMock()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user