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