You are here

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

@Then /^I should see values in row table:$/

File

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

Class

FeatureContext
Features context.

Code

public function iShouldSeeValuesInTable(TableNode $nodesTable) {
  $page = $this
    ->getSession()
    ->getPage();
  $rows = $page
    ->findAll('css', 'tr');
  if (!$rows) {
    throw new \Exception(sprintf('No rows found on the page %s', $this
      ->getSession()
      ->getCurrentUrl()));
  }
  foreach ($nodesTable
    ->getHash() as $row_texts) {
    $found = TRUE;
    foreach ($rows as $row) {
      $found = TRUE;
      foreach ($row_texts as $row_text) {
        if (!empty($row_text) && strpos($row
          ->getText(), $row_text) === FALSE) {
          $found = FALSE;
        }
      }
      if ($found) {
        break;
      }
    }
    if (!$found) {
      throw new \Exception(sprintf('Not found a row containing the desired texts'));
    }
  }
}