{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-codeception/issues/7","labels_url":"https://api.github.com/repos/yiisoft/yii2-codeception/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-codeception/issues/7/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-codeception/issues/7/events","html_url":"https://github.com/yiisoft/yii2-codeception/issues/7","id":103239923,"number":7,"title":"unit test won't clean up db after running","user":{"login":"hesna","id":2319368,"avatar_url":"https://avatars.githubusercontent.com/u/2319368?v=3","gravatar_id":"","url":"https://api.github.com/users/hesna","html_url":"https://github.com/hesna","followers_url":"https://api.github.com/users/hesna/followers","following_url":"https://api.github.com/users/hesna/following{/other_user}","gists_url":"https://api.github.com/users/hesna/gists{/gist_id}","starred_url":"https://api.github.com/users/hesna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hesna/subscriptions","organizations_url":"https://api.github.com/users/hesna/orgs","repos_url":"https://api.github.com/users/hesna/repos","events_url":"https://api.github.com/users/hesna/events{/privacy}","received_events_url":"https://api.github.com/users/hesna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-26T11:10:44Z","updated_at":"2015-10-28T07:29:07Z","closed_at":null,"body":"It's same as [this issue](https://github.com/yiisoft/yii2/issues/9522) from framework main repo. seems like here is a better place for it:\r\n\r\nI'm using Yii2 module: (note that `cleanup` is enabled) \r\n```yml\r\nclass_name: UnitTester\r\nmodules:\r\n    enabled:\r\n        - Yii2:\r\n            part: ORM\r\n    config:\r\n        Yii2:\r\n            cleanup: true\r\n            configFile: '../config/backend/unit.php'\r\n```\r\n\r\nworking with `haveRecord()` and `seeRecord()` methods:\r\n```php\r\n    public function testWebsiteInsertion()\r\n    {\r\n        $this->tester->haveRecord(\r\n            Website::className(),\r\n            [\r\n                'title' => 'test site',\r\n                'language' => 'fa',\r\n                'subdomain' => 'test',\r\n                'themeId' => 1\r\n            ]\r\n        );\r\n\r\n        $this->tester->seeRecord(\r\n            Website::className(),\r\n            ['subdomain' => 'test']\r\n        );\r\n    }\r\n```\r\nIt does not clean up db after running! I traced it down to here `Codeception\\Module\\Yii2::_after()` :\r\n```php\r\n        if ($this->transaction && $this->config['cleanup']) {\r\n            $this->transaction->rollback();\r\n        }\r\n```\r\nThe `if` condition is true and transaction does rollback, but inserted rows do not get removed! I even traced Transaction class in framework core and there were no errors. I'm really stuck, did I miss something? are there other configurations? "},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2-codeception/issues/comments/151751402","html_url":"https://github.com/yiisoft/yii2-codeception/issues/7#issuecomment-151751402","issue_url":"https://api.github.com/repos/yiisoft/yii2-codeception/issues/7","id":151751402,"user":{"login":"kaiserfedor","id":7402851,"avatar_url":"https://avatars.githubusercontent.com/u/7402851?v=3","gravatar_id":"","url":"https://api.github.com/users/kaiserfedor","html_url":"https://github.com/kaiserfedor","followers_url":"https://api.github.com/users/kaiserfedor/followers","following_url":"https://api.github.com/users/kaiserfedor/following{/other_user}","gists_url":"https://api.github.com/users/kaiserfedor/gists{/gist_id}","starred_url":"https://api.github.com/users/kaiserfedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaiserfedor/subscriptions","organizations_url":"https://api.github.com/users/kaiserfedor/orgs","repos_url":"https://api.github.com/users/kaiserfedor/repos","events_url":"https://api.github.com/users/kaiserfedor/events{/privacy}","received_events_url":"https://api.github.com/users/kaiserfedor/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T07:29:07Z","updated_at":"2015-10-28T07:29:07Z","body":"@samdark  Yes, of course. This is part of my composer.lock:\r\n```\r\n\"name\": \"codeception/codeception\",\r\n            \"version\": \"2.1.x-dev\",\r\n            \"source\": {\r\n                \"type\": \"git\",\r\n                \"url\": \"https://github.com/Codeception/Codeception.git\",\r\n                \"reference\": \"c90ace2b69ee2332740018ff0489399ed7c89ada\"\r\n            },\r\n```\r\nIs it OK?"}}