Skip to content

Commit

Permalink
bug #34963 [Lock] fix constructor argument type declaration (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.4 branch.

Discussion
----------

[Lock] fix constructor argument type declaration

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34952
| License       | MIT
| Doc PR        |

Commits
-------

201af4f fix constructor argument type declaration
  • Loading branch information
nicolas-grekas committed Dec 13, 2019
2 parents 88ed817 + 201af4f commit 0636177
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Lock/Factory.php
Expand Up @@ -28,7 +28,7 @@ class Factory implements LoggerAwareInterface

private $store;

public function __construct(StoreInterface $store)
public function __construct(PersistingStoreInterface $store)
{
$this->store = $store;

Expand Down
16 changes: 16 additions & 0 deletions src/Symfony/Component/Lock/Tests/LockFactoryTest.php
Expand Up @@ -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;

/**
Expand All @@ -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();
Expand Down

0 comments on commit 0636177

Please sign in to comment.