You are here

function MultifieldTableTest::checkMultifieldTable in Multifield table 7

Checks that multifield table has been generated successfully.

Parameters

array $fields: Array containing fields to test

1 call to MultifieldTableTest::checkMultifieldTable()
MultifieldTableTest::testMultifieldTableBasic in ./multifield_table.test
Performs the basic tests.

File

./multifield_table.test, line 81

Class

MultifieldTableTest

Code

function checkMultifieldTable($fields) {
  $position = 0;
  foreach ($fields as $field) {
    $position++;
    $xpath = $this
      ->buildXPathQuery('//table/thead/tr/th[:position]', array(
      ':position' => $position,
    ));
    $this
      ->assertFieldByXPath($xpath, $field['label']);
    $xpath = $this
      ->buildXPathQuery('//table/thead/tr/th[contains(@class, :field-name)]', array(
      ':field-name' => drupal_clean_css_identifier($field['name']),
    ));
    $this
      ->assertFieldByXPath($xpath, $field['label']);
    $xpath = $this
      ->buildXPathQuery('//table/tbody/tr/td[:position]', array(
      ':position' => $position,
    ));
    $this
      ->assertFieldByXPath($xpath, $field['value']);
  }
}