codeception unit test won't clean up db

I asked my question on this github issue but did not get proper answer. hope you guys can help me. here is the situation:

I’m using Yii2 module on top of Codeception’s unit tests: (note that cleanup is enabled)




class_name: UnitTester

modules:

    enabled:

        - Yii2:

            part: ORM

    config:

        Yii2:

            cleanup: true

            configFile: '../config/backend/unit.php'



and working with haveRecord() and seeRecord() methods of Yii2 module:




    public function testWebsiteInsertion()

    {

        $this->tester->haveRecord(

            Website::className(),

            [

                'title' => 'test site',

                'language' => 'fa',

                'subdomain' => 'test',

                'themeId' => 1

            ]

        );


        $this->tester->seeRecord(

            Website::className(),

            ['subdomain' => 'test']

        );

    }



Technically it should erase what it has inserted in db _ in this case website record _ after running the test. the trick is wrapping all the tests in a transaction and then rolling it back when everything is done. you can check Yii2 module’s code that does this job here: https://github.com/Codeception/Codeception/blob/2.1/src/Codeception/Module/Yii2.php#L93

but it is not working for me. I traced it all the way to frameworks Transaction class and there were no errors. also I’m using MySql and innodb engine for my tables. I’m really stuck and out of ideas :unsure:

I know this is old topic, but it seems problem hasn’t been solved yet. I investigated it and reported issue https://github.com/Codeception/Codeception/issues/5599