skala
Julio Montoya 15 years ago
commit 96b6ed4294
  1. 4
      main/webservices/user_import/import.lib.php
  2. 8
      tests/main/webservices/user_import/import.lib.test.php

@ -6,6 +6,7 @@ function validate_data($users) {
global $defined_auth_sources;
$errors = array ();
$usernames = array ();
if(is_array($users)) {
foreach ($users as $index => $user) {
// 1. Check whether mandatory fields have been set.
$mandatory_fields = array ('LastName', 'FirstName');
@ -57,6 +58,7 @@ function validate_data($users) {
}
}
}
}
return $errors;
}
@ -88,6 +90,7 @@ function complete_missing_data($user) {
*/
function save_data($users) {
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
if(is_array($users)) {
foreach ($users as $index => $user) {
$user = complete_missing_data($user);
@ -126,6 +129,7 @@ function save_data($users) {
}
}
}
}
/**
* Reads the CSV-file.

@ -3,6 +3,7 @@ require_once(api_get_path(SYS_CODE_PATH).'webservices/user_import/import.lib.php
require_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
require_once(api_get_path(LIBRARY_PATH).'import.lib.php');
require_once(api_get_path(LIBRARY_PATH).'classmanager.lib.php');
require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
class TestImpor extends UnitTestCase {
@ -38,5 +39,12 @@ class TestImpor extends UnitTestCase {
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* This functon only is added to the end of the test and the end of the files in the all test.
*/
/*public function testDeleteCourse() {
global $cidReq;
$resu = CourseManager::delete_course($cidReq);
}*/
}
?>

Loading…
Cancel
Save