course_object_manual.test in Course 7.2
File
modules/course_object_manual/course_object_manual.test
View source
<?php
class CourseObjectManualTestCase extends CourseObjectTestCase {
public static function getInfo() {
return array(
'name' => 'Course object manual',
'description' => 'Ensure that manual course objects function properly.',
'group' => 'Course',
);
}
public function getModules() {
$modules = parent::getModules();
$modules[] = 'course_object_manual';
return $modules;
}
public function testCourseObjectManual() {
$account = $this
->drupalCreateUser();
$node = $this
->createCourseNode();
$course = course_get_course($node);
$co1 = course_get_course_object('course_object_manual', 'manual', NULL, $course);
$co1
->save();
$co1 = course_get_course_object_by_id($co1
->getId());
$this
->drupalLogin($account);
course_enroll($node, $account);
$this
->drupalGet($co1
->getUrl());
$this
->assertText('Your instructor has not given you a pass/fail grade yet.');
$co1 = course_get_course_object_by_id($co1
->getId());
$co1
->getFulfillment($account)
->setGrade(0)
->save();
$this
->drupalGet($co1
->getUrl());
$this
->assertText('Your instructor has marked you as failed.');
$co1 = course_get_course_object_by_id($co1
->getId());
$co1
->getFulfillment($account)
->setGrade(100)
->setComplete(1)
->save();
$this
->drupalGet($co1
->getUrl());
$this
->assertText('Your instructor has marked you as passed.');
}
}