Closed wapmorgan closed 2 years ago
Also, $loadedFixtures
is public, so changing its structure is a break in BC.
In general I'm not sure of this is the right solution; for me not cleaning up fixtures means my test environment is no longer consistent, combined with random test order this will lead to brittle tests where the causes of failures cannot be easily identified. I always thought it was more of a debug option used for manual inspection in case something went wrong and needed detailed analysis.
That said, if the conclusion is that we want to support this case then we should at least make it clear to everyone that this breaks backwards compatibility, I'm not sure how many people use fixtures I tend to prefer helper functions on actors instead. They mean I can run my tests inside transactions and dependencies are more explicit:
public function testSoftDelete(FunctionalTester $I)
{
$project = $I->haveProject();
$project->delete();
$I->assertFalse(Project::find()->andWhere(['id' => $project->id])->exists());
$I->assertFalse(Project::find()->withDeletedRecords()->andWhere(['id' => $project->id])->exists());
}
But that's a whole other discussion =/
Why does FixturesStore
know about its owner? The public getter is never used, so the owner shouldn't even be passed in...
@wapmorgan what is the plan with this PR?
OK :) Thanks anyway.
Suggestion to fix #11 - Load fixtures by each test case separately.
Shortly: load fixtures and save owner of store. This is used when
cleanup: false
and fixtures is loaded in_fixtures
method (not by callinghaveFixtures()
) and when different test cases load different fixtures