You are here

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

Adds options field to any room_unit or room_unit_type entity.

Parameters

TableNode $table: Table containing options definitions.

$wrapper: The entity wrapper to attach the options.

2 calls to FeatureContext::addOptionsToEntity()
FeatureContext::optionsForUnit in test/features/bootstrap/FeatureContext.php
@Given /^options for "([^"]*)" unit:$/
FeatureContext::optionsForUnitType in test/features/bootstrap/FeatureContext.php
@Given /^options for "([^"]*)" unit type:$/

File

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

Class

FeatureContext
Features context.

Code

protected function addOptionsToEntity(TableNode $table, $wrapper) {
  $delta = 0;
  if (isset($wrapper->rooms_booking_unit_options)) {
    $delta = count($wrapper->rooms_booking_unit_options);
  }
  foreach ($table
    ->getHash() as $entityHash) {
    $wrapper->rooms_booking_unit_options[$delta] = $entityHash;
    $delta++;
  }
  $wrapper
    ->save();
}