Test Fixtures

Hello Yii-Guys

I’ve got a easy question for you. And a strong one for me.

Is it correct that the fixture should abstract the database connection?

So, I just have to write my fixtures and should then call MyModelName::model()->findAll() to get all fixtures?

Thank you!

You should set up a separate database for testing and put the details and credentials in your test config file. When you run your tests, for each fixture that you’ve specified in your test class, Yii will truncate the appropriate table in the test database and insert the relevant fixture data.

Thank you very much.

Ok. I think I understand now the concept.

The problem was I didn’t know, that the a test database is mandatory for that.

Yes it is!