You are here

public function FeatureContext::getGroupIdFromTitle in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  2. 8.3 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  3. 8.4 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  4. 8.6 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  5. 8.7 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  6. 8.8 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  7. 10.3.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  8. 10.0.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  9. 10.1.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()
  10. 10.2.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::getGroupIdFromTitle()

Parameters

$group_title:

Return value

null

2 calls to FeatureContext::getGroupIdFromTitle()
FeatureContext::iSelectGroup in tests/behat/features/bootstrap/FeatureContext.php
@When I select group :group
FeatureContext::openGroupStreamPage in tests/behat/features/bootstrap/FeatureContext.php
Opens group stream page.

File

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

Class

FeatureContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function getGroupIdFromTitle($group_title) {
  $query = \Drupal::entityQuery('group')
    ->condition('label', $group_title);
  $group_ids = $query
    ->execute();
  $groups = entity_load_multiple('group', $group_ids);
  if (count($groups) > 1) {
    return NULL;
  }
  else {
    $group = reset($groups);
    if ($group
      ->id() !== 0) {
      $group_id = $group
        ->id();
    }
  }
  return $group_id;
}