MDL-34912 fix invalid descriptionformat default handling

This commit is contained in:
Petr Škoda
2012-08-18 09:53:03 +02:00
parent 7033316dad
commit 71a03114e0
2 changed files with 18 additions and 6 deletions
+12
View File
@@ -48,10 +48,22 @@ class core_phpunit_generator_testcase extends advanced_testcase {
$count = $DB->count_records('course_categories');
$category = $generator->create_category();
$this->assertEquals($count+1, $DB->count_records('course_categories'));
$this->assertRegExp('/^Course category \d/', $category->name);
$this->assertSame('', $category->idnumber);
$this->assertRegExp('/^Test course category \d/', $category->description);
$this->assertSame(FORMAT_MOODLE, $category->descriptionformat);
$count = $DB->count_records('course');
$course = $generator->create_course();
$this->assertEquals($count+1, $DB->count_records('course'));
$this->assertRegExp('/^Test course \d/', $course->fullname);
$this->assertRegExp('/^tc_\d/', $course->shortname);
$this->assertSame('', $course->idnumber);
$this->assertSame('topics', $course->format);
$this->assertEquals(0, $course->newsitems);
$this->assertEquals(5, $course->numsections);
$this->assertRegExp('/^Test course \d/', $course->summary);
$this->assertSame(FORMAT_MOODLE, $course->summaryformat);
$section = $generator->create_course_section(array('course'=>$course->id, 'section'=>3));
$this->assertEquals($course->id, $section->course);