Feature use existing fixture for member with the given id if found, rather than always creating a new

This commit is contained in:
Christopher Joe 2017-10-30 16:35:49 +13:00
parent 493ccb05cd
commit 1d3da4cd2f

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);
}