function CourseOutlineUiTest::testCourseOutlineMaxOccurences in Course 3.x
Test maximum course objects per course.
File
- tests/
src/ Functional/ CourseOutlineUiTest.php, line 40
Class
- CourseOutlineUiTest
- 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.');
}