mockApplication(); } protected function tearDown() { $this->destroyApplication(); parent::tearDown(); } protected function mockApplication() { $baseConfig = is_array($this->baseConfig) ? $this->baseConfig : require(Yii::getAlias($this->baseConfig)); $config = is_array($this->config)? $this->config : require(Yii::getAlias($this->config)); new $this->appClass(\yii\helpers\ArrayHelper::merge($baseConfig,$config)); } protected function destroyApplication() { \Yii::$app = null; } }