From 201af4f31d2ca062dcb8f032ae4b7f038e2490f1 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 13 Dec 2019 09:10:41 +0100 Subject: [PATCH] fix constructor argument type declaration --- src/Symfony/Component/Lock/Factory.php | 2 +- .../Component/Lock/Tests/LockFactoryTest.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Lock/Factory.php b/src/Symfony/Component/Lock/Factory.php index 2bc7d9304bd7f..40e80f39c9f98 100644 --- a/src/Symfony/Component/Lock/Factory.php +++ b/src/Symfony/Component/Lock/Factory.php @@ -28,7 +28,7 @@ class Factory implements LoggerAwareInterface private $store; - public function __construct(StoreInterface $store) + public function __construct(PersistingStoreInterface $store) { $this->store = $store; diff --git a/src/Symfony/Component/Lock/Tests/LockFactoryTest.php b/src/Symfony/Component/Lock/Tests/LockFactoryTest.php index 0ec4fd3976a4f..a867b8cfaefd4 100644 --- a/src/Symfony/Component/Lock/Tests/LockFactoryTest.php +++ b/src/Symfony/Component/Lock/Tests/LockFactoryTest.php @@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface; use Symfony\Component\Lock\LockFactory; use Symfony\Component\Lock\LockInterface; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\StoreInterface; /** @@ -23,6 +24,21 @@ class LockFactoryTest extends TestCase { public function testCreateLock() + { + $store = $this->getMockBuilder(PersistingStoreInterface::class)->getMock(); + $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); + $factory = new LockFactory($store); + $factory->setLogger($logger); + + $lock = $factory->createLock('foo'); + + $this->assertInstanceOf(LockInterface::class, $lock); + } + + /** + * @group legacy + */ + public function testCreateLockWithLegacyStoreImplementation() { $store = $this->getMockBuilder(StoreInterface::class)->getMock(); $logger = $this->getMockBuilder(LoggerInterface::class)->getMock();