mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #13 from halkyon/existing_group_permissions
Don't create a group in iAmLoggedInWithPermissions if already exists.
This commit is contained in:
commit
7ae16ae06c
@ -74,7 +74,11 @@ class LoginContext extends BehatContext
|
|||||||
function iAmLoggedInWithPermissions($permCode)
|
function iAmLoggedInWithPermissions($permCode)
|
||||||
{
|
{
|
||||||
if (!isset($this->cache_generatedMembers[$permCode])) {
|
if (!isset($this->cache_generatedMembers[$permCode])) {
|
||||||
$group = \Injector::inst()->create('Group');
|
$group = \Group::get()->filter('Title', "$permCode group")->first();
|
||||||
|
if (!$group) {
|
||||||
|
$group = \Injector::inst()->create('Group');
|
||||||
|
}
|
||||||
|
|
||||||
$group->Title = "$permCode group";
|
$group->Title = "$permCode group";
|
||||||
$group->write();
|
$group->write();
|
||||||
|
|
||||||
@ -98,7 +102,6 @@ class LoginContext extends BehatContext
|
|||||||
$this->cache_generatedMembers[$permCode] = $member;
|
$this->cache_generatedMembers[$permCode] = $member;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->cache_generatedMembers[$permCode]->logIn();
|
|
||||||
return new Step\Given(sprintf('I log in with "%s" and "%s"', "$permCode@example.org", 'secret'));
|
return new Step\Given(sprintf('I log in with "%s" and "%s"', "$permCode@example.org", 'secret'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user