Permalink
Browse files

Merge branch 'w34_MDL-34912_m23_description' of git://github.com/skod…

…ak/moodle into MOODLE_23_STABLE
  • Loading branch information...
2 parents a130109 + 71a0311 commit 9b7738c8fb2c1aafb790f7f891b93eb2a4a4ab04 @stronk7 stronk7 committed Aug 21, 2012
Showing with 18 additions and 6 deletions.
  1. +6 −6 lib/phpunit/classes/data_generator.php
  2. +12 −0 lib/phpunit/tests/generator_test.php
@@ -240,11 +240,11 @@ function create_category($record=null, array $options=null) {
}
if (!isset($record['descriptionformat'])) {
- $record['description'] = FORMAT_MOODLE;
+ $record['descriptionformat'] = FORMAT_MOODLE;
}
if (!isset($record['parent'])) {
- $record['descriptionformat'] = 0;
+ $record['parent'] = 0;
}
if (empty($record['parent'])) {
@@ -310,12 +310,12 @@ function create_course($record=null, array $options=null) {
$record['numsections'] = 5;
}
- if (!isset($record['description'])) {
- $record['description'] = "Test course $i\n$this->loremipsum";
+ if (!isset($record['summary'])) {
+ $record['summary'] = "Test course $i\n$this->loremipsum";
}
- if (!isset($record['descriptionformat'])) {
- $record['description'] = FORMAT_MOODLE;
+ if (!isset($record['summaryformat'])) {
+ $record['summaryformat'] = FORMAT_MOODLE;
}
if (!isset($record['category'])) {
@@ -48,10 +48,22 @@ public function test_create() {
$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);

0 comments on commit 9b7738c

Please sign in to comment.