import.lib.test.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. require_once(api_get_path(SYS_CODE_PATH).'webservices/user_import/import.lib.php');
  3. require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  4. require_once(api_get_path(LIBRARY_PATH).'import.lib.php');
  5. require_once(api_get_path(LIBRARY_PATH).'classmanager.lib.php');
  6. require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
  7. class TestImpor extends UnitTestCase {
  8. public function __construct() {
  9. $this->UnitTestCase('User import WS library - main/webservices/user_import/import.lib.test.php');
  10. }
  11. function testcomplete_missing_data(){
  12. $user='admin';
  13. $res=complete_missing_data($user);
  14. $this->assertTrue(is_string($res));
  15. //var_dump($res);
  16. }
  17. /**
  18. * Save the imported data
  19. */
  20. function testsave_data() {
  21. global $users;
  22. $res=save_data($users);
  23. $this->assertTrue(is_null($res));
  24. //var_dump($res);
  25. }
  26. function testvalidate_data() {
  27. global $defined_auth_sources, $users;
  28. $res=validate_data($users);
  29. $this->assertTrue(is_array($res));
  30. //var_dump($res);
  31. }
  32. function testparse_csv_data() {
  33. $file= '/tmp/';
  34. $res=parse_csv_data($file);
  35. $this->assertTrue(is_array($res));
  36. //var_dump($res);
  37. }
  38. /**
  39. * This functon only is added to the end of the test and the end of the files in the all test.
  40. */
  41. /*public function testDeleteCourse() {
  42. global $cidReq;
  43. $resu = CourseManager::delete_course($cidReq);
  44. }*/
  45. }
  46. ?>