Merge branch 'w34_MDL-34912_m24_description' of git://github.com/skodak/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2012-08-21 02:39:10 +02:00
commit fffb9b9064
2 changed files with 18 additions and 6 deletions

View File

@ -240,11 +240,11 @@ EOD;
} }
if (!isset($record['descriptionformat'])) { if (!isset($record['descriptionformat'])) {
$record['description'] = FORMAT_MOODLE; $record['descriptionformat'] = FORMAT_MOODLE;
} }
if (!isset($record['parent'])) { if (!isset($record['parent'])) {
$record['descriptionformat'] = 0; $record['parent'] = 0;
} }
if (empty($record['parent'])) { if (empty($record['parent'])) {
@ -310,12 +310,12 @@ EOD;
$record['numsections'] = 5; $record['numsections'] = 5;
} }
if (!isset($record['description'])) { if (!isset($record['summary'])) {
$record['description'] = "Test course $i\n$this->loremipsum"; $record['summary'] = "Test course $i\n$this->loremipsum";
} }
if (!isset($record['descriptionformat'])) { if (!isset($record['summaryformat'])) {
$record['description'] = FORMAT_MOODLE; $record['summaryformat'] = FORMAT_MOODLE;
} }
if (!isset($record['category'])) { if (!isset($record['category'])) {

View File

@ -48,10 +48,22 @@ class core_phpunit_generator_testcase extends advanced_testcase {
$count = $DB->count_records('course_categories'); $count = $DB->count_records('course_categories');
$category = $generator->create_category(); $category = $generator->create_category();
$this->assertEquals($count+1, $DB->count_records('course_categories')); $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'); $count = $DB->count_records('course');
$course = $generator->create_course(); $course = $generator->create_course();
$this->assertEquals($count+1, $DB->count_records('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)); $section = $generator->create_course_section(array('course'=>$course->id, 'section'=>3));
$this->assertEquals($course->id, $section->course); $this->assertEquals($course->id, $section->course);