legal.lib.test.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. require_once api_get_path(LIBRARY_PATH).'legal.lib.php';
  3. class TestLegal extends UnitTestCase{
  4. public function __construct() {
  5. $this->UnitTestCase('Legal terms library - main/inc/lib/legal.lib.test.php');
  6. }
  7. public function testAdd(){
  8. $language='english';
  9. $content='english';
  10. $type='';
  11. $changes='';
  12. $res = LegalManager::add($language, $content, $type, $changes);
  13. if(is_bool($res))
  14. $this->assertTrue($res === true || $res === false);
  15. else
  16. $this->assertTrue(is_null($res));
  17. //var_dump($res);
  18. }
  19. public function testGetLastConditionVersion(){
  20. $language='english';
  21. $res = LegalManager::get_last_condition_version($language);
  22. if(!is_array($res)):
  23. $this->assertTrue(is_numeric($res));
  24. endif;
  25. //var_dump($res);
  26. }
  27. public function testGetLastCondition(){
  28. $language='english';
  29. $result=2;
  30. $res = LegalManager::get_last_condition($language);
  31. if(is_bool($res)){
  32. $this->assertTrue($res===true || $res === false);
  33. $this->assertTrue(is_bool($res));
  34. }else{
  35. $this->assertTrue(is_array($res));}
  36. //var_dump($res);
  37. }
  38. public function testShowLastCondition(){
  39. $term_preview=1;
  40. $preview =true;
  41. $res = LegalManager::show_last_condition($term_preview);
  42. $this->assertTrue($res);
  43. $this->assertTrue(is_string($res));
  44. //var_dump($res);
  45. }
  46. public function testGetLastVersion(){
  47. $language='english';
  48. $$res = LegalManager::get_last_version($language);
  49. if(is_bool($res)){
  50. $this->assertTrue(is_bool($res));
  51. $this->assertTrue($res === true || $res === false);
  52. }else{
  53. $this->assertTrue(is_null($res));
  54. $this->assertNull($res);
  55. }
  56. //var_dump($res);
  57. }
  58. public function testget_legal_data(){
  59. $from='test';
  60. $number_of_items=5;
  61. $column=5;
  62. $res = LegalManager::get_legal_data($from, $number_of_items, $column);
  63. $this->assertTrue(is_array($res));
  64. //var_dump($res);
  65. }
  66. public function testCount(){
  67. $res = LegalManager::count();
  68. $this->assertTrue(is_string($res));
  69. //var_dump($res);
  70. }
  71. }
  72. ?>