* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Lock\Factory; use Symfony\Component\Lock\Store\FlockStore; use Symfony\Component\Lock\Store\SemaphoreStore; class LockableTraitTest extends TestCase { protected static $fixturesPath; public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/../Fixtures/'; require_once self::$fixturesPath.'/FooLockCommand.php'; require_once self::$fixturesPath.'/FooLock2Command.php'; } public function testLockIsReleased() { $command = new \FooLockCommand(); $tester = new CommandTester($command); $this->assertSame(2, $tester->execute(array())); $this->assertSame(2, $tester->execute(array())); } public function testLockReturnsFalseIfAlreadyLockedByAnotherCommand() { $command = new \FooLockCommand(); if (SemaphoreStore::isSupported(false)) { $store = new SemaphoreStore(); } else { $store = new FlockStore(); } $lock = (new Factory($store))->createLock($command->getName()); $lock->acquire(); $tester = new CommandTester($command); $this->assertSame(1, $tester->execute(array())); $lock->release(); $this->assertSame(2, $tester->execute(array())); } public function testMultipleLockCallsThrowLogicException() { $command = new \FooLock2Command(); $tester = new CommandTester($command); $this->assertSame(1, $tester->execute(array())); } } __halt_compiler();----SIGNATURE:----RaIlvFt8KetgG6Qnqui/o2cbwOc+hf/GHVOdpO6Zg9dXBO15Fv0U23I1qgmEJEj6PYwxBlDNBeN6LN4tt79JGBxeHQ0gd5pVIatA429dG93Zkb9GC5DAOBAj0KvjEOzkLjEf5MCfvCmGBkSU48NGlY1EZZD+DIb0jA0YNxCQCf42pCk8dcVgJsQ6FQh0HqntEh2SUMiY4PQr/YLpxz20jtJ4bGcMzuWMo4LTRcL5j2mY5NEdSsTJG7Yz3Xmkp1XCNi6QLizt+AffAgpeVgdcfRaoZjxbB7RMTiumrxlOAjK9fgS7cIUYvT3bfwF7BiiyM2/rvPLY/xW5+9otHp/hPq00l5CPZtlxsDnHULdV6Si553l3f8UZYiXCrfoapkOxeOYJV8nW5GBm4KPuUMyTQjxwkW9QIFT6e12mcJSDTBHrZeFAx6ciuJKbZd+KMqnwVf0gBbq4nGjX+YdpQiLaVQGjwhZRKUUO8eol7xwHLEtsvfMGAmXk6ahMtfIwNGdXaD6kkboRu4SBAMzOfChO6Mj8XiL7gG9ZYuv04QXTDBMyeltiv4wioWoCN+XVf8F7gS8KXSewmAB4NIfRLf3Mpj86X0Q7nPGVwFIvjCYYD+dXRT2UglOyNnMnpenJvaO264S0KuhXTsyuxgCnr8TR+PAuhvg6CnX/7d0Q6cg+4xI=----ATTACHMENT:----MzEwOTEzNDY2NTM2MzM1OSA4NjAxMjU3NTY5MDk2NDcwIDQ1Mzg3NTg4MjM5OTE2MjI=