Repository navigation
Expand file tree
/
Copy pathExtension.php
More file actions
92 lines (76 loc) · 2.1 KB
/
Copy pathExtension.php
File metadata and controls
92 lines (76 loc) · 2.1 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
namespace Codeception\Platform;
use Codeception\Configuration as Config;
use Codeception\Exception\ModuleRequire;
use Codeception\Subscriber\Shared\StaticEvents;
use Codeception\Lib\Console\Output;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class Extension implements EventSubscriberInterface
{
use StaticEvents;
protected $config = array();
protected $options;
protected $output;
protected $globalConfig;
function __construct($config, $options)
{
$this->config = array_merge($this->config, $config);
$this->options = $options;
$this->output = new Output($options);
$this->_initialize();
}
static $events = array();
/**
* Pass config variables that should be injected into global config.
*
* @param array $config
*/
public function _reconfigure($config = array())
{
if (is_array($config)) {
Config::append($config);
}
}
/**
* You can do all preperations here. No need to override constructor.
* Also you can skip calling `_reconfigure` if you don't need to.
*/
public function _initialize()
{
$this->_reconfigure(); // hook for BC only.
}
protected function write($message)
{
if (!$this->options['silent']) $this->output->write($message);
}
protected function writeln($message)
{
if (!$this->options['silent']) $this->output->writeln($message);
}
public function getModule($name)
{
if (!isset(\Codeception\SuiteManager::$modules[$name]))
throw new ModuleRequire($name, "module is not enabled");
return \Codeception\SuiteManager::$modules[$name];
}
public function getTestsDir()
{
return Config::testsDir();
}
public function getLogDir()
{
return Config::outputDir();
}
public function getDataDir()
{
return Config::dataDir();
}
public function getRootDir()
{
return Config::projectDir();
}
public function getGlobalConfig()
{
return Config::config();
}
}