[Lock] remove uusage of the StoreInterface

This commit is contained in:
Amrouche Hamza 2019-07-16 08:55:46 +02:00
parent 52e9fb91ff
commit 9988844eb4
No known key found for this signature in database
GPG Key ID: E45A3DA456145BC1
5 changed files with 15 additions and 17 deletions

View File

@ -1600,7 +1600,7 @@ class FrameworkExtension extends Extension
$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)]);

View File

@ -18,7 +18,6 @@ use Symfony\Component\Lock\Exception\LockConflictedException;
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>
@ -41,7 +40,7 @@ class LockTest extends TestCase
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
@ -59,7 +58,7 @@ class LockTest extends TestCase
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
@ -86,7 +85,7 @@ class LockTest extends TestCase
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
@ -121,7 +120,7 @@ class LockTest extends TestCase
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
@ -138,7 +137,7 @@ class LockTest extends TestCase
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
@ -152,7 +151,7 @@ class LockTest extends TestCase
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
@ -201,7 +200,7 @@ class LockTest extends TestCase
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
@ -356,7 +355,7 @@ class LockTest extends TestCase
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) {

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Lock\Tests\Store;
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>
@ -22,7 +22,7 @@ use Symfony\Component\Lock\StoreInterface;
abstract class AbstractStoreTest extends TestCase
{
/**
* @return StoreInterface
* @return PersistStoreInterface
*/
abstract protected function getStore();

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Lock\Tests\Store;
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>
@ -24,7 +24,7 @@ trait BlockingStoreTestTrait
/**
* @see AbstractStoreTest::getStore()
*
* @return StoreInterface
* @return PersistStoreInterface
*/
abstract protected function getStore();

View File

@ -17,7 +17,6 @@ use Symfony\Component\Lock\Key;
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;
@ -268,8 +267,8 @@ class CombinedStoreTest extends AbstractStoreTest
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);