You are here

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

@Given /^booking types:$/

File

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

Class

FeatureContext
Features context.

Code

public function createBookingTypes(TableNode $nodesTable) {
  $random = new Random();
  foreach ($nodesTable
    ->getHash() as $nodeHash) {
    $booking_type_definition = array();
    $booking_type_definition['type'] = isset($nodeHash['type']) ? $nodeHash['type'] : drupal_strtolower($random
      ->name(8));
    $booking_type_definition['label'] = isset($nodeHash['label']) ? $nodeHash['label'] : $random
      ->name(8);
    $booking_type = rooms_boking_type_create($booking_type_definition);
    $booking_type
      ->save();
    $this->bookingTypes[] = $booking_type;
  }
}