H
H
HaruAtari2014-03-13 05:46:33
Yii
HaruAtari, 2014-03-13 05:46:33

Unit tests of models, how to prepare the base?

Good afternoon.
There is a project on Yii. I'm trying to set up unit tests. But the question arose, how to reset the base to its original state?
I tried fixtures - they don't fit. there are many selections from 5-8 related tables. Therefore, it would be easier to have a database dump ready and work with it.
Tell me, will it be normal to describe the entire database in the init script (most likely, import from the sql file), and then perform all tests on this copy? At the same time, wrap each test in a transaction so that it does not change anything?
Am I thinking in the right direction? Or should it be done differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vit, 2014-03-13
@HaruAtari

I tried fixtures - they don't fit. There are a lot of selections from 5-8 related tables.

Strangely, fixtures are also suitable for us for a larger number of tables and selections. The most difficult thing was at first to design them and accurately describe them, but then they serve their purposes perfectly and we don’t even think about them almost.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question