forked from magento/magento2-functional-testing-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCodeceptRunCommand.php
61 lines (54 loc) · 1.66 KB
/
CodeceptRunCommand.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
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types = 1);
namespace Magento\FunctionalTestingFramework\Console;
use Codeception\Command\Run;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Magento\FunctionalTestingFramework\Console\Codecept\CodeceptCommandUtil;
class CodeceptRunCommand extends Run
{
/**
* Configures the current command
*
* @return void
*/
protected function configure()
{
$this->setName('codecept:run')
->setDescription(
"Wrapper command to vendor/bin/codecept:run. See https://codeception.com/docs/reference/Commands#Run"
);
parent::configure();
}
/**
* Executes the current command
*
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
* @throws \Exception
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
$commandUtil = new CodeceptCommandUtil();
$commandUtil->setup($input);
$commandUtil->setCodeceptCwd();
try {
$exitCode = parent::execute($input, $output);
} catch (\Exception $e) {
throw new TestFrameworkException(
'Make sure cest files are generated before running bin/mftf '
. $this->getName()
. PHP_EOL
. $e->getMessage()
);
}
$commandUtil->restoreCwd();
return $exitCode;
}
}