Skip to content

Commit

Permalink
[Lock] rename and deprecate Factory into LockFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Simperfit committed Jul 9, 2019
1 parent d779e48 commit a48ab14
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Factory.php
Expand Up @@ -19,6 +19,8 @@
* Factory provides method to create locks.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*
* @deprecated "Symfony\Component\Lock\Factory" is deprecated since Symfony 4.4 and will be removed in 5.0 use "Symfony\Component\Lock\LockFactory" instead
*/
class Factory implements LoggerAwareInterface
{
Expand Down
22 changes: 22 additions & 0 deletions LockFactory.php
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Lock;

/**
* Factory provides method to create locks.
*
* @author Jérémy Derussé <jeremy@derusse.com>
* @author Hamza Amrouche <hamza.simperfit@gmail.com>
*/
class LockFactory extends Factory
{
}
36 changes: 36 additions & 0 deletions Tests/LockFactoryTest.php
@@ -0,0 +1,36 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Lock\Tests;

use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\LockInterface;
use Symfony\Component\Lock\StoreInterface;

/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class LockFactoryTest extends TestCase
{
public function testCreateLock()
{
$store = $this->getMockBuilder(StoreInterface::class)->getMock();
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$factory = new LockFactory($store);
$factory->setLogger($logger);

$lock = $factory->createLock('foo');

$this->assertInstanceOf(LockInterface::class, $lock);
}
}

0 comments on commit a48ab14

Please sign in to comment.