You are here

function MessagingTestCase::dumpTable in Messaging 6.4

Same name and namespace in other branches
  1. 7 tests/messaging_test_case.inc \MessagingTestCase::dumpTable()

File

tests/messaging_test_case.inc, line 63

Class

MessagingTestCase

Code

function dumpTable($table) {
  $result = db_query('SELECT * FROM {' . $table . '}');
  $output = '';
  $header = $rows = array();
  while ($row = db_fetch_array($result)) {
    $rows[] = array_values($row);
    if (empty($header)) {
      $header = array_keys($row);
    }
  }
  if (!empty($rows)) {

    // Need to call theme function directly
    $output .= theme_table($header, $rows);
  }
  else {
    $output .= ' No rows';
  }
  $this
    ->printDebug($output, "Table dump: {$table}");
}