Contao\CoreBundle\Test\Command\AutomatorCommandTest::testLock PHP Method

testLock() public method

Tests the lock.
public testLock ( )
    public function testLock()
    {
        $lock = new LockHandler('contao:automator');
        $lock->lock();
        $command = new AutomatorCommand('contao:automator');
        $command->setApplication($this->getApplication());
        $command->setFramework($this->mockContaoFramework());
        $tester = new CommandTester($command);
        /** @var QuestionHelper $helper */
        $helper = $command->getHelper('question');
        $helper->setInputStream($this->getStreamFromInput("\n"));
        $code = $tester->execute(['command' => $command->getName()]);
        $this->assertEquals(1, $code);
        $this->assertContains('The command is already running in another process.', $tester->getDisplay());
        $lock->release();
    }