You are here

function CourseOutlineUiTestCase::testCourseOutlineMaxOccurences in Course 6

Same name and namespace in other branches
  1. 7.2 tests/CourseOutlineUiTestCase.test \CourseOutlineUiTestCase::testCourseOutlineMaxOccurences()
  2. 7 tests/CourseOutlineUiTestCase.test \CourseOutlineUiTestCase::testCourseOutlineMaxOccurences()

Test maximum course objects per course.

File

tests/CourseOutlineUiTestCase.test, line 46

Class

CourseOutlineUiTestCase
Test class for dealing with adding and removing elements from the course outline.

Code

function testCourseOutlineMaxOccurences() {
  $courseNode = $this
    ->createCourseNode();
  $this
    ->drupalGet("node/{$courseNode->nid}/course-outline");
  $this
    ->createCourseObjectUi($courseNode);
  $this
    ->createCourseObjectUi($courseNode);
  $elements = $this
    ->xpath('//select[@id=:id]//option[@value=:option]', array(
    ':id' => 'edit-more-object-type',
    ':option' => 'course_test-course_test_object',
  ));
  $this
    ->assertTrue((bool) $elements, 'User able to add up to maxOccurances of course objects.');
  $this
    ->createCourseObjectUi($courseNode);
  $elements = $this
    ->xpath('//select[@id=:id]//option[@value=:option]', array(
    ':id' => 'edit-more-object-type',
    ':option' => 'course_test-course_test_object',
  ));
  $this
    ->assertFalse((bool) $elements, 'User was not able to add more than maxOccurances of course objects.');
}