Permalink
Browse files

Merge branch 'w26_MDL-40254_m25_flatfile' of https://github.com/skoda…

…k/moodle into MOODLE_25_STABLE
  • Loading branch information...
2 parents 9067595 + 55384d2 commit 3d4a0f28875a3094c1e032fcd9c820c6bb677da0 @stronk7 stronk7 committed Jun 24, 2013
Showing with 4 additions and 2 deletions.
  1. +1 −1 enrol/flatfile/lib.php
  2. +3 −1 enrol/flatfile/tests/flatfile_test.php
View
@@ -311,7 +311,7 @@ protected function process_file(progress_trace $trace) {
}
$roleid = $rolemap[$fields[1]];
- if (!$user = $DB->get_record("user", array("idnumber"=>$fields[2]))) {
+ if (empty($fields[2]) or !$user = $DB->get_record("user", array("idnumber"=>$fields[2]))) {
$trace->output("Unknown user idnumber in field 3 - ignoring line $line", 1);
continue;
}
@@ -88,6 +88,7 @@ public function test_sync() {
$user4 = $this->getDataGenerator()->create_user(array('idnumber'=>'čtvrtý'));
$user5 = $this->getDataGenerator()->create_user(array('idnumber'=>'u5'));
$user6 = $this->getDataGenerator()->create_user(array('idnumber'=>'u6'));
+ $user7 = $this->getDataGenerator()->create_user(array('idnumber'=>''));
$course1 = $this->getDataGenerator()->create_course(array('idnumber'=>'c1'));
$course2 = $this->getDataGenerator()->create_course(array('idnumber'=>'c2'));
@@ -124,7 +125,8 @@ public function test_sync() {
add,student,u5,c2,20,10
add,student,u6,c1,0,$future
add,student,u6,c2,$future,0
- add,student,u6,c3,$future,$farfuture";
+ add,student,u6,c3,$future,$farfuture
+ add,student,,c2";
file_put_contents($file, $data);
$this->assertEquals(0, $DB->count_records('user_enrolments'));

0 comments on commit 3d4a0f2

Please sign in to comment.