function CourseObjectAccessTestCase::testHiddenCourseObjects in Course 6
Same name and namespace in other branches
- 7.2 tests/CourseObjectAccessTestCase.test \CourseObjectAccessTestCase::testHiddenCourseObjects()
- 7 tests/CourseObjectAccessTestCase.test \CourseObjectAccessTestCase::testHiddenCourseObjects()
Test hidden course objects do not show up in the course outline.
File
- tests/
CourseObjectAccessTestCase.test, line 100
Class
- CourseObjectAccessTestCase
- Tests for course object access.
Code
function testHiddenCourseObjects() {
// Create a course.
$courseNode = $this
->createCourseNode();
// Use the student user.
$user = $this->student_user;
$o1 = $this
->createCourseObject($courseNode);
// By default, should be visible.
$this
->assertTrue($o1
->access('see', $user));
// Make object hidden.
$o1
->setOption('hidden', 1)
->save();
$this
->assertFalse($o1
->access('see', $user));
// Make object not hidden.
$o1
->setOption('hidden', 0)
->save();
$this
->assertTrue($o1
->access('see', $user));
}