Merge pull request #171 from open-sausages/pulls/recycle-dont-waste

Feature use existing fixture for member with the given id if found
This commit is contained in:
Damian Mooyman 2017-10-30 17:25:41 +13:00 committed by GitHub
commit 4e36ec793e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -526,7 +526,10 @@ class FixtureContext implements Context
}
/** @var Member $member */
$member = $this->getFixtureFactory()->createObject(Member::class, $id);
$member = $this->getFixtureFactory()->get(Member::class, $id);
if (!$member) {
$member = $this->getFixtureFactory()->createObject(Member::class, $id);
}
$member->Groups()->add($group);
}
@ -557,7 +560,10 @@ class FixtureContext implements Context
}
/** @var Member $member */
$member = $this->getFixtureFactory()->createObject(Member::class, $id, $fields);
$member = $this->getFixtureFactory()->get(Member::class, $id);
if (!$member) {
$member = $this->getFixtureFactory()->createObject(Member::class, $id, $fields);
}
$member->Groups()->add($group);
}