Conditions | 1 |
Paths | 1 |
Total Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | protected function _before() |
||
|
|||
18 | { |
||
19 | $_SERVER['REQUEST_URI']='index.php'; |
||
20 | $config = require( __DIR__ . "/../_config/test.php"); |
||
21 | $this->model = new SiteController('site', new \yii\web\Application($config)); |
||
22 | \Yii::$app->controller = $this->model; |
||
23 | \Yii::$app->controller->action = new Action('fake', $this->model); |
||
24 | } |
||
25 | |||
36 | } |
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: