You are here

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

Parameters

$unit_name:

$start:

$end:

Return value

bool

2 calls to FeatureContext::findUnitAvailability()
FeatureContext::iWillBeAbleToMakeABookingForUnitFromTo in test/features/bootstrap/FeatureContext.php
@Then /^I will be able to make a booking for "(?P<unit_name>[^"]*)" unit from "(?P<start>[^"]*)" to "(?P<end>[^"]*)"$/
FeatureContext::iWonTBeAbleToMakeABookingForUnitFromTo in test/features/bootstrap/FeatureContext.php
@Then /^I won\'t be able to make a booking for "(?P<unit_name>[^"]*)" unit from "(?P<start>[^"]*)" to "(?P<end>[^"]*)"$/

File

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

Class

FeatureContext
Features context.

Code

protected function findUnitAvailability($unit_name, $start, $end) {
  $unit_id = $this
    ->findBookableUnitByName($unit_name);
  $start_date = new DateTime($start);
  $end_date = new DateTime($end);
  $agent = new AvailabilityAgent($start_date, $end_date);
  $units = $agent
    ->checkAvailability();
  if (is_array($units)) {
    foreach ($units as $units_per_type) {
      foreach ($units_per_type as $units) {
        foreach ($units as $id => $unit) {
          if ($id == $unit_id) {
            return TRUE;
          }
        }
      }
    }
  }
  return FALSE;
}