5c64df38e07cc9dcb470b52472aa6a2b9076aba2
[yaffs-website] / web / core / tests / Drupal / TestSite / Commands / TestSiteReleaseLocksCommand.php
1 <?php
2
3 namespace Drupal\TestSite\Commands;
4
5 use Drupal\Core\Test\TestDatabase;
6 use Symfony\Component\Console\Command\Command;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
9
10 /**
11  * Command to release all test site database prefix locks.
12  *
13  * Note that this command can't be safely tested by DrupalCI without potentially
14  * causing random failures.
15  *
16  * @internal
17  */
18 class TestSiteReleaseLocksCommand extends Command {
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function configure() {
24     $this->setName('release-locks')
25       ->setDescription('Releases all test site locks')
26       ->setHelp('The locks ensure test site database prefixes are not reused.');
27   }
28
29   /**
30    * {@inheritdoc}
31    */
32   protected function execute(InputInterface $input, OutputInterface $output) {
33     TestDatabase::releaseAllTestLocks();
34     $output->writeln('<info>Successfully released all the test database locks</info>');
35   }
36
37 }