You are here

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

Same name and namespace in other branches
  1. 8 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 211

Class

FeatureContext
Features context.

Code

protected function findTypeByName($type_name) {
  $efq = new EntityFieldQuery();
  $efq
    ->entityCondition('entity_type', 'bat_type')
    ->propertyCondition('name', $type_name);
  $results = $efq
    ->execute();
  if ($results && isset($results['bat_type'])) {
    return key($results['bat_type']);
  }
  else {
    throw new RuntimeException('Unable to find that type');
  }
}