You are here

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

@Given /^I select the "(?P<unit_name>[^"]*)" room for package$/

File

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

Class

FeatureContext
Features context.

Code

public function iSelectTheRoomForPackage($unit_name) {
  $unit_id = $this
    ->findBookableUnitByName($unit_name);
  $text = $unit_name . ' (' . $unit_id . ')';
  $items = $this
    ->getSession()
    ->getPage()
    ->findAll('css', 'table[id^="rooms-package-units-values"] tbody tr');
  $delta = count($items) - 1;
  $element_name = 'rooms_package_units[und][' . $delta . '][target_id]';
  $this
    ->fillFieldByJS($element_name, $text);
  $this->minkContext
    ->pressButton('rooms_package_units_add_more');
  $this->minkContext
    ->iWaitForAjaxToFinish();
}