fileDisplay.lib.test.php 1.7 KB

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