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:
Fabien Potencier 2019-07-17 09:26:25 +02:00
commit 25f180416e
5 changed files with 15 additions and 17 deletions

View File

@ -1606,7 +1606,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);