You are here

protected function FeatureContext::findTypeByName in Booking and Availability Management Tools for Drupal 8

Same name and namespace in other branches
  1. 7 test/behat/features/bootstrap/FeatureContext.php \FeatureContext::findTypeByName()

Returns a type_id from its name.

Parameters

$type_name:

Return value

int

Throws

RuntimeException

1 call to FeatureContext::findTypeByName()
FeatureContext::iAmDoingOnTheType in test/behat/features/bootstrap/FeatureContext.php
Redirects user to the action page for the given unit.

File

test/behat/features/bootstrap/FeatureContext.php, line 209

Class

FeatureContext
Features context.

Code

protected function findTypeByName($type_name) {
  $query = \Drupal::entityQuery('bat_unit_type');
  $query
    ->condition('name', $type_name);
  $results = $query
    ->execute();
  if ($results) {
    return key($results);
  }
  else {
    throw new RuntimeException('Unable to find that type');
  }
}