fileDisplay.lib.test.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. class TestFileDisplay extends UnitTestCase {
  3. public function TestFileDisplay(){
  4. $this->UnitTestCase('File display library - main/inc/lib/fileDisplay.lib.test.php');
  5. }
  6. //todo public function testArraySearch()
  7. //todo public function testChooseImage()
  8. //todo public function testFormatFileSize()
  9. //todo public function testFormatDate()
  10. //todo public function testFormatUrl()
  11. //todo public function testRecentModifiedFileTime()
  12. //todo public function testFolderSize()
  13. //todo public function testGetTotalFolderSize()
  14. public function testChooseImage(){
  15. global $_course;
  16. static $type, $image;
  17. $file_name = '';
  18. $res = choose_image($file_name);
  19. $this->assertEqual($res,'defaut.gif');
  20. $this->assertTrue(is_string($res));
  21. //var_dump($file_name);
  22. }
  23. public function testFormatFileSize(){
  24. $file_size = '100';
  25. $res = format_file_size($file_size);
  26. $this->assertTrue($res);
  27. $this->assertTrue(is_string($res));
  28. //var_dump($res);
  29. }
  30. public function testFormatDate(){
  31. $date = '11/02/2009';
  32. $res = format_date($date);
  33. $this->assertTrue($res);
  34. //var_dump($res);
  35. }
  36. public function testFormatUrl(){
  37. $file_path ='/var/www/path/';
  38. $res = format_url($file_path);
  39. $this->assertTrue($res);
  40. $this->assertTrue(is_string($res));
  41. //var_dump($res);
  42. }
  43. public function testRecentModifiedFileTime(){
  44. $dir_name = '';
  45. $$do_recursive =true;
  46. $res = recent_modified_file_time($dir_name, $do_recursive);
  47. $this->assertTrue(is_numeric($res));
  48. //var_dump($res);
  49. }
  50. public function testFolderSize(){
  51. $dir_name ='';
  52. $res = folder_size($dir_name);
  53. $this->assertFalse($res);
  54. $this->assertTrue(is_numeric($res));
  55. //var_dump($res);
  56. }
  57. }
  58. ?>