mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Feature use existing fixture for member with the given id if found, rather than always creating a new
This commit is contained in:
parent
493ccb05cd
commit
1d3da4cd2f
@ -526,7 +526,10 @@ class FixtureContext implements Context
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var Member $member */
|
/** @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);
|
$member->Groups()->add($group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,7 +560,10 @@ class FixtureContext implements Context
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var Member $member */
|
/** @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);
|
$member->Groups()->add($group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user