/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php
71 строка
2 KB
Fabien Potencier
feature #60138 [Lock] DynamoDB store (natepage)
12 сен 2025, 09:21
12 сен 2025, 09:21
0063f39
Код
Авторство
О чём код?
<?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\Lock\Tests\Store; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Symfony\Component\Lock\Exception\InvalidTtlException; use Symfony\Component\Lock\Key; use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\MemcachedStore; use Symfony\Component\Lock\Test\AbstractStoreTestCase; /** * @author Jérémy Derussé <jeremy@derusse.com> */ #[RequiresPhpExtension('memcached')] #[Group('integration')] class MemcachedStoreTest extends AbstractStoreTestCase { use ExpiringStoreTestTrait; public static function setUpBeforeClass(): void { if (version_compare(phpversion('memcached'), '3.1.6', '<')) { self::markTestSkipped('Extension memcached > 3.1.5 required.'); } $memcached = new \Memcached(); $memcached->addServer(getenv('MEMCACHED_HOST'), 11211); $memcached->get('foo'); $code = $memcached->getResultCode(); if (\Memcached::RES_SUCCESS !== $code && \Memcached::RES_NOTFOUND !== $code) { self::markTestSkipped('Unable to connect to the memcache host'); } } protected function getClockDelay(): int { return 1000000; } public function getStore(): PersistingStoreInterface { $memcached = new \Memcached(); $memcached->addServer(getenv('MEMCACHED_HOST'), 11211); return new MemcachedStore($memcached); } public function testAbortAfterExpiration() { $this->markTestSkipped('Memcached expects a TTL greater than 1 sec. Simulating a slow network is too hard'); } public function testInvalidTtl() { $this->expectException(InvalidTtlException::class); $store = $this->getStore(); $store->putOffExpiration(new Key('toto'), 0.1); } }