diff --git a/tests/AcquiaCliApplicationTest.php b/tests/AcquiaCliApplicationTest.php index fb75547..5d93ac4 100644 --- a/tests/AcquiaCliApplicationTest.php +++ b/tests/AcquiaCliApplicationTest.php @@ -8,9 +8,12 @@ use AcquiaCli\Cli\AcquiaCli; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Stopwatch\Stopwatch; +use Symfony\Component\Console\Command\LockableTrait; class AcquiaCliApplicationTest extends AcquiaCliTestCase { + use LockableTrait; + private $root; public function setUp() @@ -49,6 +52,18 @@ public function testVersion() $this->assertContains('AcquiaCli 2', $actualValue); } + public function testLock() + { + // Obtain an identical lock and then attempt to run acquiacli. + $this->lock('acquia-cli-command'); + $command = ['--version']; + $actualValue = $this->execute($command); + $this->assertContains('The command is already running in another process.', $actualValue); + + // Unlock to ensure tests are able to continue. + $this->release(); + } + public function testClientOptions() { $command = ['application:list', '--sort=label', '--filter=label=@*sample*', '--limit=2'];