forked from Codeception/Codeception
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
80 lines (68 loc) · 1.66 KB
/
functions.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
78
79
80
<?php
// function not autoloaded in PHP, thus its a good place for them
use Codeception\Extension\Logger;
function codecept_debug($data)
{
\Codeception\Util\Debug::debug($data);
}
/**
* Executes interactive pause in ths place
*
* @param array $vars
* @return void
*/
function codecept_pause(array $vars = []): void
{
\Codeception\Util\Debug::pause($vars);
}
function codecept_root_dir($appendPath = '')
{
return \Codeception\Configuration::projectDir() . $appendPath;
}
function codecept_output_dir($appendPath = '')
{
return \Codeception\Configuration::outputDir() . $appendPath;
}
function codecept_log_dir($appendPath = '')
{
return \Codeception\Configuration::outputDir() . $appendPath;
}
function codecept_data_dir($appendPath = '')
{
return \Codeception\Configuration::dataDir() . $appendPath;
}
function codecept_relative_path($path)
{
return \Codeception\Util\PathResolver::getRelativeDir(
$path,
\Codeception\Configuration::projectDir(),
DIRECTORY_SEPARATOR
);
}
/**
* If $path is absolute, it will be returned without changes.
* If $path is relative, it will be passed to `codecept_root_dir()` function
* to make it absolute.
*
* @param string $path
* @return string the absolute path
*/
function codecept_absolute_path($path)
{
return codecept_is_path_absolute($path) ? $path : codecept_root_dir($path);
}
/**
* Check whether the given $path is absolute.
*
* @param string $path
* @return bool
* @since 2.4.4
*/
function codecept_is_path_absolute($path)
{
return \Codeception\Util\PathResolver::isPathAbsolute($path);
}
function codecept_log(): \Monolog\Logger
{
return Logger::getLogger();
}