Conditions | 1 |
Paths | 1 |
Total Lines | 24 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 21 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
35 | 2 | public function setUp() |
|
|
|||
36 | 2 | { |
|
37 | 2 | $_SERVER['SCRIPT_NAME'] = '/index.php'; |
|
38 | 2 | $_SERVER['PHWOOLCON_PHALCON_VERSION'] = (int)Version::getId(); |
|
39 | 2 | /* @var Di $di */ |
|
40 | 2 | $di = $this->di = Di::getDefault(); |
|
41 | 2 | Events::register($di); |
|
42 | 2 | DiFix::fix($di); |
|
43 | 2 | Db::register($di); |
|
44 | 2 | Cache::register($di); |
|
45 | 2 | Log::register($di); |
|
46 | 2 | $this->reloadConfig(); |
|
47 | 2 | Counter::register($this->di); |
|
48 | 2 | Aliases::register($di); |
|
49 | I18n::register($di); |
||
50 | 2 | Cookies::register($di); |
|
51 | 2 | Session::register($di); |
|
52 | 2 | Clearer::clear(); |
|
53 | 2 | parent::setUp(); |
|
54 | |||
55 | 2 | $class = get_class($this); |
|
56 | Log::debug("================== Running {$class}::{$this->getName()}() ... =================="); |
||
57 | 2 | Timer::start(); |
|
58 | 2 | } |
|
59 | 2 | ||
67 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: