minor #30944 Fix Lock test suite (jderusse)
This PR was merged into the 4.3-dev branch.
Discussion
----------
Fix Lock test suite
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | na
| License | MIT
| Doc PR | na
Commits
-------
1f66e7b2be
Fix Lock test suite
This commit is contained in:
commit
04eed543af
@ -58,7 +58,7 @@ class StoreFactory
|
||||
return new FlockStore(substr($connection, 8));
|
||||
case 'semaphore' === $connection:
|
||||
return new SemaphoreStore();
|
||||
case preg_match('#^[a-z]++://#', $connection):
|
||||
case \class_exists(AbstractAdapter::class) && preg_match('#^[a-z]++://#', $connection):
|
||||
return static::createStore(AbstractAdapter::createConnection($connection));
|
||||
default:
|
||||
throw new InvalidArgumentException(sprintf('Unsupported Connection: %s.', $connection));
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Lock\Tests\Store;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Cache\Adapter\AbstractAdapter;
|
||||
use Symfony\Component\Cache\Traits\RedisProxy;
|
||||
use Symfony\Component\Lock\Store\FlockStore;
|
||||
use Symfony\Component\Lock\Store\MemcachedStore;
|
||||
@ -40,19 +41,24 @@ class StoreFactoryTest extends TestCase
|
||||
if (\class_exists(\Redis::class)) {
|
||||
yield [$this->createMock(\Redis::class), RedisStore::class];
|
||||
}
|
||||
if (\class_exists(RedisProxy::class)) {
|
||||
yield [$this->createMock(RedisProxy::class), RedisStore::class];
|
||||
yield [$this->createMock(\Predis\Client::class), RedisStore::class];
|
||||
}
|
||||
yield [new \Predis\Client(), RedisStore::class];
|
||||
if (\class_exists(\Memcached::class)) {
|
||||
yield [$this->createMock(\Memcached::class), MemcachedStore::class];
|
||||
yield [new \Memcached(), MemcachedStore::class];
|
||||
}
|
||||
if (\class_exists(\Zookeeper::class)) {
|
||||
yield [$this->createMock(\Zookeeper::class), ZookeeperStore::class];
|
||||
}
|
||||
yield ['flock', FlockStore::class];
|
||||
yield ['flock:///tmp', FlockStore::class];
|
||||
if (\extension_loaded('sysvsem')) {
|
||||
yield ['semaphore', SemaphoreStore::class];
|
||||
if (\class_exists(\Memcached::class)) {
|
||||
}
|
||||
if (\class_exists(\Memcached::class) && \class_exists(AbstractAdapter::class)) {
|
||||
yield ['memcached://server.com', MemcachedStore::class];
|
||||
}
|
||||
|
||||
yield ['flock', FlockStore::class];
|
||||
yield ['flock://'.sys_get_temp_dir(), FlockStore::class];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user