function CourseOutlineUiTestCase::testCourseOutlineMaxOccurences in Course 8.3
Same name and namespace in other branches
- 8.2 tests/src/Functional/CourseOutlineUiTestCase.php \Drupal\Tests\course\Functional\CourseOutlineUiTestCase::testCourseOutlineMaxOccurences()
Test maximum course objects per course.
File
- tests/
src/ Functional/ CourseOutlineUiTestCase.php, line 40
Class
- CourseOutlineUiTestCase
- Test class for dealing with adding and removing elements from the course outline.
Namespace
Drupal\Tests\course\FunctionalCode
function testCourseOutlineMaxOccurences() {
$course = $this
->createCourse();
$this
->drupalGet("course/{$course->id()}/outline");
$this
->createCourseObjectUi($course);
$this
->createCourseObjectUi($course);
$elements = $this
->xpath('//select[@id=:id]//option[@value=:option]', array(
':id' => 'edit-more-object-type',
':option' => 'course_test_object',
));
$this
->assertTrue((bool) $elements, 'User able to add up to maxOccurances of course objects.');
$this
->createCourseObjectUi($course);
$elements = $this
->xpath('//select[@id=:id]//option[@value=:option]', array(
':id' => 'edit-more-object-type',
':option' => 'course_test_object',
));
$this
->assertFalse((bool) $elements, 'User was not able to add more than maxOccurances of course objects.');
}