A
A
anonimizer_me2013-04-29 13:03:57
Yii
anonimizer_me, 2013-04-29 13:03:57

Reset the state of the database before the test?

Hello! Faced such a problem.
Tests change values ​​in the database, and fixtures are rolled only once. Because of this, in some tests, I get the wrong values ​​that I expect - due to the fact that some other test changed the value in the table.
How to roll fixtures before each test?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
K
kirksa, 2013-04-29
@kirksa

Use phpunit database extension (PHPUnit_Extensions_Database_TestCase).
The DB will be set (data) from the fixtures for each test.

A
akral, 2013-04-29
@akral

Don't test the base .

S
sirko_el, 2013-04-29
@sirko_el

Look for a description of Continuous Integration for Yii.
Here is an example: Continuous Integration Part I

A
Alexander, 2013-05-08
@kryoz

Use a separate database for tests if the tests are not integration ones. For each case, generate its own set of test data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question