1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Bluz PHP Team |
5
|
|
|
* @link https://github.com/bluzphp/bluzman |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Bluzman\Command; |
9
|
|
|
|
10
|
|
|
use Codeception; |
|
|
|
|
11
|
|
|
use Exception; |
12
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
|
|
|
13
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
|
14
|
|
|
use Symfony\Component\Console\Input\StringInput; |
|
|
|
|
15
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class List command |
19
|
|
|
* |
20
|
|
|
* @package Bluzman\Command |
21
|
|
|
* |
22
|
|
|
* @author Pavel Machekhin |
23
|
|
|
* @created 2013-03-28 14:03 |
24
|
|
|
*/ |
25
|
|
|
class TestCommand extends AbstractCommand |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
15 |
|
* Command configuration |
29
|
|
|
*/ |
30
|
|
|
protected function configure() |
31
|
|
|
{ |
32
|
15 |
|
$this |
33
|
|
|
// the name of the command (the part after "bin/bluzman") |
34
|
15 |
|
->setName('test') |
35
|
|
|
// the short description shown while running "php bin/bluzman list" |
36
|
|
|
->setDescription('Run tests') |
37
|
15 |
|
// the full command description shown when running the command with |
38
|
|
|
// the "--help" option |
39
|
|
|
->setHelp('Run codeception tests') |
40
|
15 |
|
; |
41
|
15 |
|
|
42
|
|
|
$this->addModuleArgument(InputArgument::OPTIONAL); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param InputInterface $input |
47
|
|
|
* @param OutputInterface $output |
48
|
|
|
* @return int |
49
|
|
|
* @throws Exception |
50
|
|
|
*/ |
51
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
52
|
|
|
{ |
53
|
|
|
// call `codeception run` command programmatically |
54
|
|
|
$arguments = [ |
55
|
|
|
'run', |
56
|
|
|
'--config ' . PATH_ROOT . DS . 'codeception.yml' |
|
|
|
|
57
|
|
|
]; |
58
|
|
|
|
59
|
|
|
if ($group = $input->getArgument('module')) { |
60
|
|
|
$arguments[] = '--group ' . $group; |
61
|
|
|
} |
62
|
|
|
$codeceptionInput = new StringInput(implode(' ', $arguments)); |
63
|
|
|
$command = $this->getCodeceptionApplication()->find('run'); |
64
|
|
|
|
65
|
|
|
return $command->run($codeceptionInput, $output); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Return CodeceptionApplication |
70
|
|
|
*/ |
71
|
|
|
protected function getCodeceptionApplication(): Codeception\Application |
|
|
|
|
72
|
|
|
{ |
73
|
|
|
// @todo need refactoring this part - move functions to separate files |
74
|
|
|
require_once PATH_VENDOR . DS . 'codeception' . DS . 'codeception' . DS . 'autoload.php'; |
|
|
|
|
75
|
|
|
|
76
|
|
|
$app = new Codeception\Application('Codeception', Codeception\Codecept::VERSION); |
|
|
|
|
77
|
|
|
$app->add(new Codeception\Command\Run('run')); |
|
|
|
|
78
|
|
|
|
79
|
|
|
$app->registerCustomCommands(); |
80
|
|
|
|
81
|
|
|
return $app; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths