function CourseObjectContentTestCase::testContentCourseObjectCreation in Course 6
Same name and namespace in other branches
- 7.2 modules/course_content/course_content.test \CourseObjectContentTestCase::testContentCourseObjectCreation()
- 7 modules/course_content/course_content.test \CourseObjectContentTestCase::testContentCourseObjectCreation()
Test course content object creation.
File
- modules/
course_content/ course_content.test, line 29
Class
- CourseObjectContentTestCase
- Tests for content Course objects.
Code
function testContentCourseObjectCreation() {
$ct1 = $this
->drupalCreateContentType();
variable_set('course_content_use_' . $ct1->type, 1);
// Flush handlers (we just made a new course object type).
course_get_handlers(NULL, TRUE);
$courseNode = $this
->createCourseNode();
$co1 = course_get_course_object('course_content', $ct1->type);
$co1
->setCourse($courseNode->nid);
$co1
->save();
// Reload course.
$course = course_get_course($courseNode, NULL, TRUE);
foreach ($course
->getObjects() as $courseObject) {
$node = node_load($courseObject
->getInstanceId());
$this
->assertEqual($node->type, $ct1->type, "Node type saved is the same node type specified by the course object.");
}
}