sortabletable.class.test.php 3.9 KB

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