You are here

function CourseOutlineUiTestCase::testCourseOutlineMaxOccurences in Course 7

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

Test maximum course objects per course.

File

tests/CourseOutlineUiTestCase.test, line 45

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.');
}