fix constructor argument type declaration

This commit is contained in:
Christian Flothmann 2019-12-13 09:10:41 +01:00
parent 5e75edf578
commit 201af4f31d
2 changed files with 17 additions and 1 deletions

View File

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

View File

@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\Lock\LockFactory; use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\LockInterface; use Symfony\Component\Lock\LockInterface;
use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\StoreInterface; use Symfony\Component\Lock\StoreInterface;
/** /**
@ -23,6 +24,21 @@ use Symfony\Component\Lock\StoreInterface;
class LockFactoryTest extends TestCase class LockFactoryTest extends TestCase
{ {
public function testCreateLock() 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(); $store = $this->getMockBuilder(StoreInterface::class)->getMock();
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $logger = $this->getMockBuilder(LoggerInterface::class)->getMock();