Drupal investigation

rules.phpt 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. --TEST--
  2. Horizontal rules
  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. $data = array(
  11. array('one', 'two'),
  12. CONSOLE_TABLE_HORIZONTAL_RULE,
  13. array('three', 'four'),
  14. CONSOLE_TABLE_HORIZONTAL_RULE,
  15. CONSOLE_TABLE_HORIZONTAL_RULE,
  16. array('five', 'six'),
  17. array('seven', 'eight'),
  18. );
  19. $table = new Console_Table();
  20. $table->setHeaders(array('foo', 'bar'));
  21. $table->addData($data);
  22. $table->addSeparator();
  23. echo $table->getTable();
  24. echo "=========================\n";
  25. $table = new Console_Table(CONSOLE_TABLE_ALIGN_LEFT, '');
  26. $table->setHeaders(array('foo', 'bar'));
  27. $table->addData($data);
  28. $table->addSeparator();
  29. echo $table->getTable();
  30. echo "=========================\n";
  31. $table = new Console_Table(CONSOLE_TABLE_ALIGN_LEFT, '#', 0);
  32. $table->setHeaders(array('foo', 'bar'));
  33. $table->addData($data);
  34. $table->addSeparator();
  35. echo $table->getTable();
  36. ?>
  37. --EXPECT--
  38. +-------+-------+
  39. | foo | bar |
  40. +-------+-------+
  41. | one | two |
  42. +-------+-------+
  43. | three | four |
  44. +-------+-------+
  45. +-------+-------+
  46. | five | six |
  47. | seven | eight |
  48. +-------+-------+
  49. +-------+-------+
  50. =========================
  51. foo bar
  52. one two
  53. three four
  54. five six
  55. seven eight
  56. =========================
  57. #############
  58. #foo #bar #
  59. #############
  60. #one #two #
  61. #############
  62. #three#four #
  63. #############
  64. #############
  65. #five #six #
  66. #seven#eight#
  67. #############
  68. #############