* * 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:----g3M8qmwtBaAWbt7tQRnukCyY80F3aUL0oJzrbcU5oTNKoXatmBh3ZzO3udeNvlDD0vYw2y738cOGUE+Sf1nXM0FlWFgRTCsa3D2KCHEDrae301H2Zm7spL8lD5sMdnvumga7I7gisR2uzHvfdSvoW1v7AOb8fPKCs499b996RjSsE0CnnoSQxG4dz2U1Xd/fhGQTJts23MivUO8zsbvwEUS/38AYiDZbfT4A9RrDZ1mBRlbovFD1artPSkwnld4W/LyHm69viNbSH2+fHd+Ka6Rc/9g40kozUe9TGmchvXbr8ho40wqqGeaASeuAJbnkFC1cqI7eQuh3sjlxI+EBKv4RKwRAA+mH0CuNrCThGp2x7TYtXUP3REYQZia8c0Ca28LCvQYJm3AuSGSBr2xohq0gZhDdGJQnlyRO1cFgp1AsbecmSFRNMlCF+GnmdcRChNUWuFjICeU+x51+JPOzF1K066ZZxdpa/K9SQb5WdyPPBS939pQbQefk8/sI3A8iNBw+mG1pCmbiAtDKvXHvdy/NxU76Svb8BWuSjvfzbEP4hHqN65qhZi/8crgZDHR3YQmU4y3OjJQgNYKxAiXDIWfUj9eGfWbqn6CUCHYdJusXiNLw0eMau81N4lUBPCaMkblMdiIUiK4VYlAxTgE/+POKCkIa8qsdI/IZ0EE5dfM=----ATTACHMENT:----MjAxNjc3MDExNzM3NDYxMiA4NjEzMTUwMjU3ODQyNDEzIDI4MzU2NzA0MjAzMzUxNTI=