-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathGenerateSuiteCommand.php
77 lines (67 loc) · 2.39 KB
/
GenerateSuiteCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types = 1);
namespace Magento\FunctionalTestingFramework\Console;
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
use Magento\FunctionalTestingFramework\Suite\SuiteGenerator;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class GenerateSuiteCommand extends BaseGenerateCommand
{
/**
* Configures the current command.
*
* @return void
*/
protected function configure()
{
$this->setName('generate:suite')
->setDescription('This command generates a single suite based on declaration in xml')
->addArgument(
'suites',
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
'argument which indicates suite names for generation (separated by space)'
);
parent::configure();
}
/**
* Executes the current command.
*
* @param InputInterface $input
* @param OutputInterface $output
* @return integer|null|void
* @throws \Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$force = $input->getOption('force');
$debug = $input->getOption('debug') ?? MftfApplicationConfig::LEVEL_DEVELOPER; // for backward compatibility
$remove = $input->getOption('remove');
$verbose = $output->isVerbose();
$allowSkipped = $input->getOption('allow-skipped');
// Set application configuration so we can references the user options in our framework
MftfApplicationConfig::create(
$force,
MftfApplicationConfig::GENERATION_PHASE,
$verbose,
$debug,
$allowSkipped
);
// Remove previous GENERATED_DIR if --remove option is used
if ($remove) {
$this->removeGeneratedDirectory($output, $output->isVerbose());
}
$suites = $input->getArgument('suites');
foreach ($suites as $suite) {
SuiteGenerator::getInstance()->generateSuite($suite);
if ($output->isVerbose()) {
$output->writeLn("suite $suite generated");
}
}
$output->writeLn("Suites Generated");
}
}