New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unloadFixtures() should run after db transaction #4497
Conversation
Makes sense... But makes a little sense to do both in transaction :) |
Fixtures were loaded before transaction (if |
Do you mean all fixtures operation should be done in transaction? @DavertMik |
Not sure. As for me - yes, inside transaction. But maybe Yii community have another opinion @samdark what you think? |
$this->transaction->rollBack(); | ||
$this->debugSection('Database', 'Transaction cancelled; all changes reverted.'); | ||
} | ||
|
||
if ($this->config['cleanup']) { | ||
foreach ($this->loadedFixtures as $fixture) { | ||
$fixture->unloadFixtures(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok but fixtures are cleaned up by rolled back transaction...
and this call may throw an exception...
I don't understand the change. Currently there are two options:
Why should we use both? |
the problem here is that fixtures were loaded before the transaction, and transaction will not reverts them. |
Would this change fix loading fixtures before transaction? |
Maybe I didn't make that clear, or I misunderstood the configuration. I want that fixtures will be unloaded after each test, and transaction on too. Let's see the problem step by step,
Now, we can see that fixtures are not really be unloaded because the transaction has been rollback. |
As far as I remember, sequence was meant to be:
Is is different? |
https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Module/Yii2.php#L187 It doesn't look like that to me 😂 |
Indeed. @DavertMik need your input on original intentions... |
Sorry, you are right. I missed the execution order in _before. Looks like it changed after I looked into it last time. Yes, we need to merge it |
No description provided.