You are here

protected function FeatureContext::findNodeByTypeAndTitle in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Returns a nid from its content_type and title.

Parameters

$content_type:

$title:

Return value

int

Throws

RuntimeException

1 call to FeatureContext::findNodeByTypeAndTitle()
FeatureContext::iAmViewingThePackage in test/features/bootstrap/FeatureContext.php
@Given /^I am viewing the package "(?<package_name>[^"]*)"$/

File

test/features/bootstrap/FeatureContext.php, line 244

Class

FeatureContext
Features context.

Code

protected function findNodeByTypeAndTitle($content_type, $title) {
  $efq = new EntityFieldQuery();
  $efq
    ->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', $content_type)
    ->propertyCondition('title', $title);
  $results = $efq
    ->execute();
  if ($results && isset($results['node'])) {
    return key($results['node']);
  }
  else {
    throw new RuntimeException('Unable to find that node');
  }
}