8ec727c1
曹明
初始化代码提交
|
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
|
## Codeception\Util\Autoload
Autoloader, which is fully compatible with PSR-4,
and can be used to autoload your `Helper`, `Page`, and `Step` classes.
#### __construct()
*private* __construct()
[See source](https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Util/Autoload.php#L18)
#### addNamespace()
*public static* addNamespace($prefix, $base_dir, $prepend = null)
Adds a base directory for a namespace prefix.
Example:
```php
<?php
// app\Codeception\UserHelper will be loaded from '/path/to/helpers/UserHelper.php'
Autoload::addNamespace('app\Codeception', '/path/to/helpers');
// LoginPage will be loaded from '/path/to/pageobjects/LoginPage.php'
Autoload::addNamespace('', '/path/to/pageobjects');
Autoload::addNamespace('app\Codeception', '/path/to/controllers');
?>
```
* `param string` $prefix The namespace prefix.
* `param string` $base_dir A base directory for class files in the namespace.
* `param bool` $prepend If true, prepend the base directory to the stack instead of appending it;
this causes it to be searched first rather than last.
* `return` void
[See source](https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Util/Autoload.php#L45)
#### load()
*public static* load($class)
[See source](https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Util/Autoload.php#L88)
#### loadMappedFile()
*protected static* loadMappedFile($prefix, $relative_class)
Load the mapped file for a namespace prefix and relative class.
* `param string` $prefix The namespace prefix.
* `param string` $relative_class The relative class name.
* `return` mixed Boolean false if no mapped file can be loaded, or the name of the mapped file that was loaded.
[See source](https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Util/Autoload.php#L136)
#### register()
*public static* register($namespace, $suffix, $path)
* `deprecated` Use self::addNamespace() instead.
[See source](https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Util/Autoload.php#L75)
#### registerSuffix()
*public static* registerSuffix($suffix, $path)
* `deprecated` Use self::addNamespace() instead.
[See source](https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Util/Autoload.php#L83)
#### requireFile()
*protected static* requireFile($file)
[See source](https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Util/Autoload.php#L156)
<p> </p><div class="alert alert-warning">Reference is taken from the source code. <a href="https://github.com/Codeception/Codeception/blob/2.3/src//Codeception/Util/Autoload.php">Help us to improve documentation. Edit module reference</a></div>
|