You are here

public function FeatureContext::getGroupContentIdFromGroupTitle in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.1.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupContentIdFromGroupTitle()
  2. 10.2.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupContentIdFromGroupTitle()

Parameters

$group_title:

$mail:

Return value

null

1 call to FeatureContext::getGroupContentIdFromGroupTitle()
FeatureContext::openRegisterPageDestinationGroup in tests/behat/features/bootstrap/FeatureContext.php
Opens register page with destination to invited group.

File

tests/behat/features/bootstrap/FeatureContext.php, line 652

Class

FeatureContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function getGroupContentIdFromGroupTitle($group_title, $mail) {
  $properties = [
    'gid' => $this
      ->getGroupIdFromTitle($group_title),
    'invitation_status' => 0,
    'invitee_mail' => $mail,
  ];
  $loader = \Drupal::service('ginvite.invitation_loader');
  $invitations = $loader
    ->loadByProperties($properties);
  if ($invitations > 0) {
    $invitation = reset($invitations);
    if ($invitation instanceof GroupInvitationWrapper) {
      $group_content = $invitation
        ->getGroupContent();
      return $group_content
        ->id();
    }
  }
}