Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04eed54

Browse filesBrowse files
committed
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 ------- 1f66e7b Fix Lock test suite
2 parents 76906ab + 1f66e7b commit 04eed54
Copy full SHA for 04eed54

File tree

Expand file treeCollapse file tree

2 files changed

+14
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-8
lines changed

‎src/Symfony/Component/Lock/Store/StoreFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/StoreFactory.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function createStore($connection)
5858
return new FlockStore(substr($connection, 8));
5959
case 'semaphore' === $connection:
6060
return new SemaphoreStore();
61-
case preg_match('#^[a-z]++://#', $connection):
61+
case \class_exists(AbstractAdapter::class) && preg_match('#^[a-z]++://#', $connection):
6262
return static::createStore(AbstractAdapter::createConnection($connection));
6363
default:
6464
throw new InvalidArgumentException(sprintf('Unsupported Connection: %s.', $connection));

‎src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php
+13-7Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Lock\Tests\Store;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1516
use Symfony\Component\Cache\Traits\RedisProxy;
1617
use Symfony\Component\Lock\Store\FlockStore;
1718
use Symfony\Component\Lock\Store\MemcachedStore;
@@ -40,19 +41,24 @@ public function validConnections()
4041
if (\class_exists(\Redis::class)) {
4142
yield [$this->createMock(\Redis::class), RedisStore::class];
4243
}
43-
yield [$this->createMock(RedisProxy::class), RedisStore::class];
44-
yield [$this->createMock(\Predis\Client::class), RedisStore::class];
44+
if (\class_exists(RedisProxy::class)) {
45+
yield [$this->createMock(RedisProxy::class), RedisStore::class];
46+
}
47+
yield [new \Predis\Client(), RedisStore::class];
4548
if (\class_exists(\Memcached::class)) {
46-
yield [$this->createMock(\Memcached::class), MemcachedStore::class];
49+
yield [new \Memcached(), MemcachedStore::class];
4750
}
4851
if (\class_exists(\Zookeeper::class)) {
4952
yield [$this->createMock(\Zookeeper::class), ZookeeperStore::class];
5053
}
51-
yield ['flock', FlockStore::class];
52-
yield ['flock:///tmp', FlockStore::class];
53-
yield ['semaphore', SemaphoreStore::class];
54-
if (\class_exists(\Memcached::class)) {
54+
if (\extension_loaded('sysvsem')) {
55+
yield ['semaphore', SemaphoreStore::class];
56+
}
57+
if (\class_exists(\Memcached::class) && \class_exists(AbstractAdapter::class)) {
5558
yield ['memcached://server.com', MemcachedStore::class];
5659
}
60+
61+
yield ['flock', FlockStore::class];
62+
yield ['flock://'.sys_get_temp_dir(), FlockStore::class];
5763
}
5864
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.