Renrhaf
Renrhaf

Reputation: 659

Symfony functional test transaction issue

I'm developing some functional tests for a symfony2 app.

I am facing a problem: when executing a test alone it works fine and leave the database in it's initial state.

But if I execute the whole serie, this test will not be isolated anymore as the database transaction seems to fail to rollback the modifications.

I initialize my tests with fixtures, and then for each tests, if I do some modifications I just use a transaction to rollback them at the end of the test.

Upvotes: 0

Views: 778

Answers (2)

Renrhaf
Renrhaf

Reputation: 659

I just found out that I was setting a memory limit in my tested code somewhere. Sorry and thanks for your help.

Upvotes: 0

pazulx
pazulx

Reputation: 2379

You shouldn't use transaction in your functional tests. Functional test often manage to perform complicated flows that require more then one request. Transactions are best if you want to rollback chenges performed only by one request.

You should implement some sort of database clear and load procedure before/after each scenario.

Upvotes: 2

Related Questions