minor #32562 [Lock] remove usage of the StoreInterface (Simperfit)
This PR was merged into the 4.4 branch.
Discussion
----------
[Lock] remove usage of the StoreInterface
| Q | A
| ------------- | ---
| Branch? |4.4
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | none <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/roadmap):
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against branch 4.4.
- Legacy code removals go to the master branch.
-->
Followup PR according to the review of @nicolas-grekas in https://github.com/symfony/symfony/pull/32555#discussion_r303749752.
Commits
-------
9988844eb4
[Lock] remove uusage of the StoreInterface
This commit is contained in:
commit
25f180416e
@ -1606,7 +1606,7 @@ class FrameworkExtension extends Extension
|
|||||||
$container->setDefinition($connectionDefinitionId, $connectionDefinition);
|
$container->setDefinition($connectionDefinitionId, $connectionDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
$storeDefinition = new Definition(StoreInterface::class);
|
$storeDefinition = new Definition(PersistStoreInterface::class);
|
||||||
$storeDefinition->setPublic(false);
|
$storeDefinition->setPublic(false);
|
||||||
$storeDefinition->setFactory([StoreFactory::class, 'createStore']);
|
$storeDefinition->setFactory([StoreFactory::class, 'createStore']);
|
||||||
$storeDefinition->setArguments([new Reference($connectionDefinitionId)]);
|
$storeDefinition->setArguments([new Reference($connectionDefinitionId)]);
|
||||||
|
@ -18,7 +18,6 @@ use Symfony\Component\Lock\Exception\LockConflictedException;
|
|||||||
use Symfony\Component\Lock\Key;
|
use Symfony\Component\Lock\Key;
|
||||||
use Symfony\Component\Lock\Lock;
|
use Symfony\Component\Lock\Lock;
|
||||||
use Symfony\Component\Lock\PersistStoreInterface;
|
use Symfony\Component\Lock\PersistStoreInterface;
|
||||||
use Symfony\Component\Lock\StoreInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jérémy Derussé <jeremy@derusse.com>
|
* @author Jérémy Derussé <jeremy@derusse.com>
|
||||||
@ -41,7 +40,7 @@ class LockTest extends TestCase
|
|||||||
public function testAcquireNoBlockingStoreInterface()
|
public function testAcquireNoBlockingStoreInterface()
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store);
|
$lock = new Lock($key, $store);
|
||||||
|
|
||||||
$store
|
$store
|
||||||
@ -59,7 +58,7 @@ class LockTest extends TestCase
|
|||||||
public function testPassingOldStoreInterface()
|
public function testPassingOldStoreInterface()
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store);
|
$lock = new Lock($key, $store);
|
||||||
|
|
||||||
$store
|
$store
|
||||||
@ -86,7 +85,7 @@ class LockTest extends TestCase
|
|||||||
public function testAcquireReturnsFalseStoreInterface()
|
public function testAcquireReturnsFalseStoreInterface()
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store);
|
$lock = new Lock($key, $store);
|
||||||
|
|
||||||
$store
|
$store
|
||||||
@ -121,7 +120,7 @@ class LockTest extends TestCase
|
|||||||
public function testAcquireSetsTtl()
|
public function testAcquireSetsTtl()
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store, 10);
|
$lock = new Lock($key, $store, 10);
|
||||||
|
|
||||||
$store
|
$store
|
||||||
@ -138,7 +137,7 @@ class LockTest extends TestCase
|
|||||||
public function testRefresh()
|
public function testRefresh()
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store, 10);
|
$lock = new Lock($key, $store, 10);
|
||||||
|
|
||||||
$store
|
$store
|
||||||
@ -152,7 +151,7 @@ class LockTest extends TestCase
|
|||||||
public function testRefreshCustom()
|
public function testRefreshCustom()
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store, 10);
|
$lock = new Lock($key, $store, 10);
|
||||||
|
|
||||||
$store
|
$store
|
||||||
@ -201,7 +200,7 @@ class LockTest extends TestCase
|
|||||||
public function testReleaseStoreInterface()
|
public function testReleaseStoreInterface()
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store, 10);
|
$lock = new Lock($key, $store, 10);
|
||||||
|
|
||||||
$store
|
$store
|
||||||
@ -356,7 +355,7 @@ class LockTest extends TestCase
|
|||||||
public function testExpirationStoreInterface($ttls, $expected)
|
public function testExpirationStoreInterface($ttls, $expected)
|
||||||
{
|
{
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$lock = new Lock($key, $store, 10);
|
$lock = new Lock($key, $store, 10);
|
||||||
|
|
||||||
foreach ($ttls as $ttl) {
|
foreach ($ttls as $ttl) {
|
||||||
|
@ -14,7 +14,7 @@ namespace Symfony\Component\Lock\Tests\Store;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Lock\Exception\LockConflictedException;
|
use Symfony\Component\Lock\Exception\LockConflictedException;
|
||||||
use Symfony\Component\Lock\Key;
|
use Symfony\Component\Lock\Key;
|
||||||
use Symfony\Component\Lock\StoreInterface;
|
use Symfony\Component\Lock\PersistStoreInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jérémy Derussé <jeremy@derusse.com>
|
* @author Jérémy Derussé <jeremy@derusse.com>
|
||||||
@ -22,7 +22,7 @@ use Symfony\Component\Lock\StoreInterface;
|
|||||||
abstract class AbstractStoreTest extends TestCase
|
abstract class AbstractStoreTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return StoreInterface
|
* @return PersistStoreInterface
|
||||||
*/
|
*/
|
||||||
abstract protected function getStore();
|
abstract protected function getStore();
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace Symfony\Component\Lock\Tests\Store;
|
|||||||
use Symfony\Component\Lock\Exception\LockConflictedException;
|
use Symfony\Component\Lock\Exception\LockConflictedException;
|
||||||
use Symfony\Component\Lock\Exception\NotSupportedException;
|
use Symfony\Component\Lock\Exception\NotSupportedException;
|
||||||
use Symfony\Component\Lock\Key;
|
use Symfony\Component\Lock\Key;
|
||||||
use Symfony\Component\Lock\StoreInterface;
|
use Symfony\Component\Lock\PersistStoreInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jérémy Derussé <jeremy@derusse.com>
|
* @author Jérémy Derussé <jeremy@derusse.com>
|
||||||
@ -24,7 +24,7 @@ trait BlockingStoreTestTrait
|
|||||||
/**
|
/**
|
||||||
* @see AbstractStoreTest::getStore()
|
* @see AbstractStoreTest::getStore()
|
||||||
*
|
*
|
||||||
* @return StoreInterface
|
* @return PersistStoreInterface
|
||||||
*/
|
*/
|
||||||
abstract protected function getStore();
|
abstract protected function getStore();
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ use Symfony\Component\Lock\Key;
|
|||||||
use Symfony\Component\Lock\PersistStoreInterface;
|
use Symfony\Component\Lock\PersistStoreInterface;
|
||||||
use Symfony\Component\Lock\Store\CombinedStore;
|
use Symfony\Component\Lock\Store\CombinedStore;
|
||||||
use Symfony\Component\Lock\Store\RedisStore;
|
use Symfony\Component\Lock\Store\RedisStore;
|
||||||
use Symfony\Component\Lock\StoreInterface;
|
|
||||||
use Symfony\Component\Lock\Strategy\StrategyInterface;
|
use Symfony\Component\Lock\Strategy\StrategyInterface;
|
||||||
use Symfony\Component\Lock\Strategy\UnanimousStrategy;
|
use Symfony\Component\Lock\Strategy\UnanimousStrategy;
|
||||||
|
|
||||||
@ -268,8 +267,8 @@ class CombinedStoreTest extends AbstractStoreTest
|
|||||||
|
|
||||||
public function testPutOffExpirationIgnoreNonExpiringStorage()
|
public function testPutOffExpirationIgnoreNonExpiringStorage()
|
||||||
{
|
{
|
||||||
$store1 = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store1 = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
$store2 = $this->getMockBuilder(StoreInterface::class)->getMock();
|
$store2 = $this->getMockBuilder(PersistStoreInterface::class)->getMock();
|
||||||
|
|
||||||
$store = new CombinedStore([$store1, $store2], $this->strategy);
|
$store = new CombinedStore([$store1, $store2], $this->strategy);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user