Drupal investigation

assoziative_arrays.phpt 538B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Header and data as associative arrays.
  3. --FILE--
  4. <?php
  5. if (file_exists(dirname(__FILE__) . '/../Table.php')) {
  6. require_once dirname(__FILE__) . '/../Table.php';
  7. } else {
  8. require_once 'Console/Table.php';
  9. }
  10. $headers = array(
  11. 'one' => 'foo',
  12. 'two' => 'bar'
  13. );
  14. $data = array(
  15. array(
  16. 'x' => 'baz',
  17. )
  18. );
  19. $table = new Console_Table();
  20. $table->setHeaders($headers);
  21. $table->addData($data);
  22. echo $table->getTable();
  23. ?>
  24. --EXPECT--
  25. +-----+-----+
  26. | foo | bar |
  27. +-----+-----+
  28. | baz | |
  29. +-----+-----+