bug #34963 [Lock] fix constructor argument type declaration (xabbuh)

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
-------

201af4f31d fix constructor argument type declaration
This commit is contained in:
Nicolas Grekas 2019-12-13 12:50:28 +01:00
commit 0636177aa6
2 changed files with 17 additions and 1 deletions

View File

@ -28,7 +28,7 @@ class Factory implements LoggerAwareInterface
private $store;
public function __construct(StoreInterface $store)
public function __construct(PersistingStoreInterface $store)
{
$this->store = $store;

View File

@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
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 @@ use Symfony\Component\Lock\StoreInterface;
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();