You are here

function Drupali18nTestCase::dumpTable in Internationalization 7

Same name and namespace in other branches
  1. 6 tests/drupal_i18n_test_case.php \Drupali18nTestCase::dumpTable()

Dump table contents

@params $table1, $table2.. One or more table names

File

./i18n.test, line 400
Base class for Internationalization tests

Class

Drupali18nTestCase
@file Base class for Internationalization tests

Code

function dumpTable() {
  $output = '';
  foreach (func_get_args() as $table) {
    $header = $rows = array();
    $result = db_query('SELECT * FROM {' . $table . '}');
    $output .= '<h2>Table dump <i>' . $table . '</i>:</h2>';
    while ($row = $result
      ->fetchAssoc()) {
      $rows[] = $row;
      if (empty($header)) {
        $header = array_keys($row);
      }
    }
    if (!empty($rows)) {
      $output .= theme('table', array(
        'header' => $header,
        'rows' => $rows,
      ));
    }
    else {
      $output .= ' No rows';
    }
    $output .= '<br />';
  }
  $this
    ->verbose($output);
}