Skip to content

[Lock] remove usage of the StoreInterface #32562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
$container->setDefinition($connectionDefinitionId, $connectionDefinition);
}

$storeDefinition = new Definition(StoreInterface::class);
$storeDefinition = new Definition(PersistStoreInterface::class);
$storeDefinition->setPublic(false);
$storeDefinition->setFactory([StoreFactory::class, 'createStore']);
$storeDefinition->setArguments([new Reference($connectionDefinitionId)]);
Expand Down
17 changes: 8 additions & 9 deletions src/Symfony/Component/Lock/Tests/LockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Lock;
use Symfony\Component\Lock\PersistStoreInterface;
use Symfony\Component\Lock\StoreInterface;

/**
* @author Jérémy Derussé <jeremy@derusse.com>
Expand All @@ -41,7 +40,7 @@ public function testAcquireNoBlocking()
public function testAcquireNoBlockingStoreInterface()
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store);

$store
Expand All @@ -59,7 +58,7 @@ public function testAcquireNoBlockingStoreInterface()
public function testPassingOldStoreInterface()
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store);

$store
Expand All @@ -86,7 +85,7 @@ public function testAcquireReturnsFalse()
public function testAcquireReturnsFalseStoreInterface()
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store);

$store
Expand Down Expand Up @@ -121,7 +120,7 @@ public function testAcquireBlocking()
public function testAcquireSetsTtl()
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);

$store
Expand All @@ -138,7 +137,7 @@ public function testAcquireSetsTtl()
public function testRefresh()
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);

$store
Expand All @@ -152,7 +151,7 @@ public function testRefresh()
public function testRefreshCustom()
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);

$store
Expand Down Expand Up @@ -201,7 +200,7 @@ public function testRelease()
public function testReleaseStoreInterface()
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);

$store
Expand Down Expand Up @@ -356,7 +355,7 @@ public function testExpiration($ttls, $expected)
public function testExpirationStoreInterface($ttls, $expected)
{
$key = new Key(uniqid(__METHOD__, true));
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$lock = new Lock($key, $store, 10);

foreach ($ttls as $ttl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\StoreInterface;
use Symfony\Component\Lock\PersistStoreInterface;

/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
abstract class AbstractStoreTest extends TestCase
{
/**
* @return StoreInterface
* @return PersistStoreInterface
*/
abstract protected function getStore();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\NotSupportedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\StoreInterface;
use Symfony\Component\Lock\PersistStoreInterface;

/**
* @author Jérémy Derussé <jeremy@derusse.com>
Expand All @@ -24,7 +24,7 @@ trait BlockingStoreTestTrait
/**
* @see AbstractStoreTest::getStore()
*
* @return StoreInterface
* @return PersistStoreInterface
*/
abstract protected function getStore();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Lock\PersistStoreInterface;
use Symfony\Component\Lock\Store\CombinedStore;
use Symfony\Component\Lock\Store\RedisStore;
use Symfony\Component\Lock\StoreInterface;
use Symfony\Component\Lock\Strategy\StrategyInterface;
use Symfony\Component\Lock\Strategy\UnanimousStrategy;

Expand Down Expand Up @@ -268,8 +267,8 @@ public function testputOffExpirationAbortWhenStrategyCantBeMet()

public function testPutOffExpirationIgnoreNonExpiringStorage()
{
$store1 = $this->getMockBuilder(StoreInterface::class)->getMock();
$store2 = $this->getMockBuilder(StoreInterface::class)->getMock();
$store1 = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
$store2 = $this->getMockBuilder(PersistStoreInterface::class)->getMock();

$store = new CombinedStore([$store1, $store2], $this->strategy);

Expand Down