| Conditions | 1 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 22 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 46 | 2 | public function setUp() |
|
|
|
|||
| 47 | { |
||
| 48 | 2 | $this->prepareTestRoot(); |
|
| 49 | |||
| 50 | 2 | $_SERVER['SCRIPT_NAME'] = '/index.php'; |
|
| 51 | 2 | $_SERVER['PHWOOLCON_PHALCON_VERSION'] = (int)Version::getId(); |
|
| 52 | /* @var Di $di */ |
||
| 53 | 2 | $di = $this->di = Di::getDefault(); |
|
| 54 | 2 | Events::register($di); |
|
| 55 | 2 | DiFix::fix($di); |
|
| 56 | 2 | Db::register($di); |
|
| 57 | 2 | Cache::register($di); |
|
| 58 | 2 | Log::register($di); |
|
| 59 | 2 | $this->reloadConfig(); |
|
| 60 | 2 | Counter::register($this->di); |
|
| 61 | 2 | Aliases::register($di); |
|
| 62 | 2 | I18n::register($di); |
|
| 63 | 2 | Cookies::register($di); |
|
| 64 | 2 | Session::register($di); |
|
| 65 | 2 | Clearer::clear(); |
|
| 66 | 2 | parent::setUp(); |
|
| 67 | |||
| 68 | 2 | $class = get_class($this); |
|
| 69 | 2 | Log::debug("================== Running {$class}::{$this->getName()}() ... =================="); |
|
| 70 | 2 | Timer::start(); |
|
| 71 | 2 | } |
|
| 72 | |||
| 80 |
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: