MDL-55042 phpunit: Get sorted sections

Sometimes db doesn't return records in order
So enusre it is in order so that last record
doesn't have section equal 0. As section 0
can't be deleted.
This commit is contained in:
Rajesh Taneja 2017-01-03 06:52:03 +08:00
parent c4cf1c60f5
commit d15a44d6fb
No known key found for this signature in database
GPG Key ID: B363F7FB787F80E4

View File

@ -2019,7 +2019,7 @@ class core_course_courselib_testcase extends advanced_testcase {
// Create the course with sections.
$course = $this->getDataGenerator()->create_course(array('numsections' => 10), array('createsections' => true));
$sections = $DB->get_records('course_sections', array('course' => $course->id));
$sections = $DB->get_records('course_sections', array('course' => $course->id), 'section');
$coursecontext = context_course::instance($course->id);
$section = array_pop($sections);
course_delete_section($course, $section);