Add Behat test for accept/deny invitations to social group - refs #8095

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent a8c216dfaa
commit aec6d4f4b2
  1. 21
      tests/features/bootstrap/FeatureContext.php
  2. 21
      tests/features/socialGroup.feature

@ -3,6 +3,7 @@
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Context\Step,
Behat\Behat\Context\Step\Given,
Behat\Behat\Exception\PendingException,
Behat\Behat\Event\SuiteEvent;
@ -204,13 +205,13 @@ class FeatureContext extends MinkContext
}
/**
* @Given /^I have a friend$/
* @Given /^I have a friend named "([^"]*)" with id "([^"]*)"$/
*/
public function iHaveAFriend()
public function iHaveAFriend($friendUsername, $friendId)
{
$adminId = 1;
$friendId = 11;
$friendUsername = 'fbaggins';
$friendId = $friendId;
$friendUsername = $friendUsername;
$sendInvitationURL = '/main/inc/ajax/message.ajax.php?' . http_build_query([
'a' => 'send_invitation',
@ -261,4 +262,16 @@ class FeatureContext extends MinkContext
new Given('I am on homepage')
];
}
/**
* @When /^I invite to a friend with id "([^"]*)" to a social group with id "([^"]*)"$/
*/
public function iInviteAFrienToASocialGroup($friendId, $groupId)
{
return [
new Step\Given('I am on "/main/social/group_invitation.php?id=' . $groupId . '"'),
new Step\When('I fill in "invitation[]" with "' . $friendId . '"'),
new Step\When('I press "submit"')
];
}
}

@ -14,8 +14,21 @@ Feature: Social Group
Scenario: Invite a friend to group
Given I am a platform administrator
And I have a friend
And I am on "/main/social/group_invitation.php?id=1"
When I fill in "invitation[]" with "11"
And I press "submit"
And I have a friend named "fbaggins" with id "11"
When I invite to a friend with id "11" to a social group with id "1"
Then I should see "Invitation sent"
Scenario: Accept an invitation to social group
Given I am logged as "fbaggins"
And I am on "/main/social/invitations.php"
When I follow "accept-invitation-1"
Then I should see "User is subscribed to this group"
Scenario: Deny an invitation to social group
Given I am a platform administrator
And I have a friend named "sgamgee" with id "13"
And I invite to a friend with id "13" to a social group with id "1"
When I am logged as "sgamgee"
And I am on "/main/social/invitations.php"
And I follow "deny-invitation-1"
Then I should see "Group invitation was denied"

Loading…
Cancel
Save