You are here

function CourseEnrollmentTestCase::testCourseDuration in Course 7

Same name and namespace in other branches
  1. 6 tests/CourseEnrollmentTestCase.test \CourseEnrollmentTestCase::testCourseDuration()
  2. 7.2 tests/CourseEnrollmentTestCase.test \CourseEnrollmentTestCase::testCourseDuration()

Test for course duration being set properly on enrollment.

File

tests/CourseEnrollmentTestCase.test, line 74

Class

CourseEnrollmentTestCase
Tests for Course enrollment

Code

function testCourseDuration() {
  global $user;
  $courseNode = $this
    ->createCourseNode();
  $courseNode->course['duration'] = 30;
  node_save($courseNode);
  $enroll = course_enrollment_load($courseNode, $user);
  $this
    ->assertFalse($enroll, 'Check that enrollment does not exist.');
  course_take_course($courseNode);
  $enroll = course_enrollment_load($courseNode, $user);
  $this
    ->assertTrue($enroll->enroll_end > REQUEST_TIME, 'Duration end got set with course start.');
}