sortable_table.class.test.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. class TestSortableTable extends UnitTestCase {
  3. public function __construct() {
  4. $this->UnitTestCase('Sortabletable library - main/inc/lib/sortable_table.class.test.php');
  5. }
  6. function testdisplay() {
  7. $instancia = new SortableTable();
  8. global $charset;
  9. ob_start();
  10. $res=$instancia->display();
  11. $this->assertTrue(is_null($res));
  12. ob_end_clean();
  13. //var_dump($res);
  14. }
  15. function testfilter_data() {
  16. $instancia = new SortableTable();
  17. $row=array();
  18. $res=$instancia->filter_data($row);
  19. $this->assertTrue(is_array($res));
  20. //var_dump($res);
  21. }
  22. function testget_additional_url_paramstring() {
  23. $instancia = new SortableTable();
  24. $res=$instancia->get_additional_url_paramstring();
  25. $this->assertTrue(is_string($res));
  26. //var_dump($res);
  27. }
  28. function testget_navigation_html() {
  29. $instancia = new SortableTable();
  30. $res=$instancia->get_navigation_html();
  31. $this->assertTrue(is_string($res));
  32. //var_dump($res);
  33. }
  34. function testget_page_select_form() {
  35. $instancia = new SortableTable();
  36. $res=$instancia->get_page_select_form();
  37. $this->assertTrue(is_string($res));
  38. //var_dump($res);
  39. }
  40. function testget_pager() {
  41. $instancia = new SortableTable();
  42. $res=$instancia->get_pager();
  43. $this->assertTrue(is_object($res));
  44. //var_dump($res);
  45. }
  46. function testget_sortable_table_param_string() {
  47. $instancia = new SortableTable();
  48. $res=$instancia->get_sortable_table_param_string();
  49. $this->assertTrue(is_string($res));
  50. //var_dump($res);
  51. }
  52. function testget_table_data() {
  53. $instancia = new SortableTable();
  54. $res=$instancia->get_table_data();
  55. $this->assertTrue(is_array($res));
  56. //var_dump($res);
  57. }
  58. function testget_table_html() {
  59. $instancia = new SortableTable();
  60. $res=$instancia->get_table_html();
  61. $this->assertTrue(is_string($res));
  62. //var_dump($res);
  63. }
  64. function testget_table_title() {
  65. $instancia = new SortableTable();
  66. $res=$instancia->get_table_title();
  67. $this->assertTrue(is_string($res));
  68. //var_dump($res);
  69. }
  70. function testget_total_number_of_items() {
  71. $instancia = new SortableTable();
  72. $res=$instancia->get_total_number_of_items();
  73. $this->assertTrue(is_numeric($res));
  74. //var_dump($res);
  75. }
  76. function testset_additional_parameters() {
  77. $instancia = new SortableTable();
  78. $parameters='';
  79. $res=$instancia->set_additional_parameters($parameters);
  80. $this->assertTrue(is_null($res));
  81. //var_dump($res);
  82. }
  83. function testset_column_filter() {
  84. $instancia = new SortableTable();
  85. $column='';
  86. $function='';
  87. $res=$instancia->set_column_filter($column, $function);
  88. $this->assertTrue(is_null($res));
  89. //var_dump($res);
  90. }
  91. function testset_form_actions() {
  92. $instancia = new SortableTable();
  93. $actions='';
  94. $checkbox_name = 'id';
  95. $res=$instancia->set_form_actions($actions, $checkbox_name = 'id');
  96. $this->assertTrue(is_null($res));
  97. //var_dump($res);
  98. }
  99. function testset_header() {
  100. $instancia = new SortableTable();
  101. $column='';
  102. $label='';
  103. $res=$instancia->set_header($column, $label, $sortable = true, $th_attributes = null, $td_attributes = null);
  104. $this->assertTrue(is_null($res));
  105. //var_dump($res);
  106. }
  107. function testset_other_tables() {
  108. $instancia = new SortableTable();
  109. $tablenames='';
  110. $res=$instancia->set_other_tables($tablenames);
  111. $this->assertTrue(is_null($res));
  112. //var_dump($res);
  113. }
  114. }
  115. class TestSortableTableFromArray extends UnitTestCase {
  116. function testget_table_data() {
  117. $res=SortableTableFromArray::get_table_data($from=1);
  118. $this->assertTrue(is_array($res));
  119. //var_dump($res);
  120. }
  121. function testget_total_number_of_items() {
  122. $res=SortableTableFromArray::get_total_number_of_items();
  123. $this->assertTrue(is_numeric($res));
  124. //var_dump($res);
  125. }
  126. }
  127. class TestSortableTableFromArrayConfig extends UnitTestCase {
  128. public function testget_table_data() {
  129. $res=SortableTableFromArray::get_table_data($from=1);
  130. $this->assertTrue(is_array($res));
  131. //var_dump($res);
  132. }
  133. public function testget_total_number_of_items() {
  134. $res=SortableTableFromArray::get_total_number_of_items();
  135. $this->assertTrue(is_numeric($res));
  136. //var_dump($res);
  137. }
  138. }
  139. ?>