{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/6978","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/6978/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/6978/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/6978/events","html_url":"https://github.com/yiisoft/yii2/issues/6978","id":55256572,"number":6978,"title":"Dependency Injection Container not reset when destroying application in functional tests","user":{"login":"ivokund","id":2707429,"avatar_url":"https://avatars.githubusercontent.com/u/2707429?v=3","gravatar_id":"","url":"https://api.github.com/users/ivokund","html_url":"https://github.com/ivokund","followers_url":"https://api.github.com/users/ivokund/followers","following_url":"https://api.github.com/users/ivokund/following{/other_user}","gists_url":"https://api.github.com/users/ivokund/gists{/gist_id}","starred_url":"https://api.github.com/users/ivokund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivokund/subscriptions","organizations_url":"https://api.github.com/users/ivokund/orgs","repos_url":"https://api.github.com/users/ivokund/repos","events_url":"https://api.github.com/users/ivokund/events{/privacy}","received_events_url":"https://api.github.com/users/ivokund/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-23T08:30:08Z","updated_at":"2015-01-23T11:19:46Z","closed_at":null,"body":"I use `\\Yii::$container` to override some classes during unit tests. Functional tests run after unit tests and fail, because `\\Yii::$container->get` still returns the temporary PHPUnit Mock objects rather than the real classes. \r\n\r\nShould not `\\yii\\codeception\\TestCase::destroyApplication` also clear the Dependency Injection Container like this? \r\n\r\n```php\r\n    /**\r\n     * Destroys the application instance created by [[mockApplication]].\r\n     */\r\n    protected function destroyApplication()\r\n    {\r\n        Yii::$app = null;\r\n        Yii::$container = new \\yii\\di\\Container()\r\n    }\r\n```\r\nI can provide a pull request if this is the correct way of solving this. "},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/71180115","html_url":"https://github.com/yiisoft/yii2/issues/6978#issuecomment-71180115","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/6978","id":71180115,"user":{"login":"ivokund","id":2707429,"avatar_url":"https://avatars.githubusercontent.com/u/2707429?v=3","gravatar_id":"","url":"https://api.github.com/users/ivokund","html_url":"https://github.com/ivokund","followers_url":"https://api.github.com/users/ivokund/followers","following_url":"https://api.github.com/users/ivokund/following{/other_user}","gists_url":"https://api.github.com/users/ivokund/gists{/gist_id}","starred_url":"https://api.github.com/users/ivokund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivokund/subscriptions","organizations_url":"https://api.github.com/users/ivokund/orgs","repos_url":"https://api.github.com/users/ivokund/repos","events_url":"https://api.github.com/users/ivokund/events{/privacy}","received_events_url":"https://api.github.com/users/ivokund/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T11:19:46Z","updated_at":"2015-01-23T11:19:46Z","body":"Added a fix via: https://github.com/yiisoft/yii2/pull/6981"}}