Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BaseGenerateCommand.php
Go to the documentation of this file.
1 <?php
2 // @codingStandardsIgnoreFile
7 declare(strict_types = 1);
8 
10 
11 use Symfony\Component\Console\Command\Command;
12 use Symfony\Component\Console\Input\InputOption;
13 use Symfony\Component\Console\Output\OutputInterface;
16 
17 class BaseGenerateCommand extends Command
18 {
24  protected function configure()
25  {
26  $this->addOption(
27  'remove',
28  'r',
29  InputOption::VALUE_NONE,
30  'remove previous generated suites and tests'
31  );
32  }
33 
41  protected function removeGeneratedDirectory(OutputInterface $output, bool $verbose)
42  {
43  $generatedDirectory = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . TestGenerator::GENERATED_DIR;
44 
45  if (file_exists($generatedDirectory)) {
46  DirSetupUtil::rmdirRecursive($generatedDirectory);
47  if ($verbose) {
48  $output->writeln("removed files and directory $generatedDirectory");
49  }
50  }
51  }
52 }
removeGeneratedDirectory(OutputInterface $output, bool $verbose)