This repository was archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathBuild.php
More file actions
53 lines (45 loc) · 1.74 KB
/
Build.php
File metadata and controls
53 lines (45 loc) · 1.74 KB
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
<?php
namespace Cake\Codeception\Command;
use Cake\Codeception\Lib\Generator\Actor as ActorGenerator;
class Build extends \Codeception\Command\Build
{
/**
* Generates the actors (*Tester class) files.
*
* @param string $configFile Path to YAML configuration to use.
*/
protected function buildActorsForConfig($configFile)
{
$config = $this->getGlobalConfig($configFile);
$suites = $this->getSuites($configFile);
$path = pathinfo($configFile);
$dir = isset($path['dirname']) ? $path['dirname'] : getcwd();
foreach ($config['include'] as $subConfig) {
$this->output->writeln("<comment>Included Configuration: $subConfig</comment>");
$this->buildActorsForConfig($dir . DIRECTORY_SEPARATOR . $subConfig);
}
if (!empty($suites)) {
$this->output->writeln(sprintf(
'<info>Building Actor classes for suites: %s</info>',
implode(', ', $suites)
));
}
foreach ($suites as $suite) {
$settings = $this->getSuiteConfig($suite, $configFile);
$gen = new ActorGenerator($settings);
$this->output->writeln(sprintf(
'<info>%s</info> includes modules: %s',
$gen->getActorName(),
implode(', ', $gen->getModules())
));
$contents = $gen->produce();
@mkdir($settings['path'], 0755, true);
$file = $settings['path'].$this->getClassName($settings['class_name']).'.php';
$this->save($file, $contents, true);
$this->output->writeln(sprintf(
'%s.php generated succesfully',
$settings['class_name']
));
}
}
}