protected function FeatureContext::findBookableUnitByName in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Returns a unit_id from its name.
Parameters
$unit_name:
Return value
int
Throws
RuntimeException
7 calls to FeatureContext::findBookableUnitByName()
- FeatureContext::checkUnitPropertyRange in test/
features/ bootstrap/ FeatureContext.php - Checks the state of a unit for a given range of dates.
- FeatureContext::createBookings in test/
features/ bootstrap/ FeatureContext.php - @Given /^"(?P<type>[^"]*)" bookings:$/
- FeatureContext::findUnitAvailability in test/
features/ bootstrap/ FeatureContext.php - FeatureContext::iAmDoingOnTheUnit in test/
features/ bootstrap/ FeatureContext.php - Redirects user to the action page for the given unit.
- FeatureContext::iSelectTheRoomForPackage in test/
features/ bootstrap/ FeatureContext.php - @Given /^I select the "(?P<unit_name>[^"]*)" room for package$/
File
- test/
features/ bootstrap/ FeatureContext.php, line 223
Class
- FeatureContext
- Features context.
Code
protected function findBookableUnitByName($unit_name) {
$efq = new EntityFieldQuery();
$efq
->entityCondition('entity_type', 'rooms_unit')
->propertyCondition('name', $unit_name);
$results = $efq
->execute();
if ($results && isset($results['rooms_unit'])) {
return key($results['rooms_unit']);
}
else {
throw new RuntimeException('Unable to find that bookable unit');
}
}