public function test_set_section_visibility()
 {
     $generator = $this->getDataGenerator();
     // Create topics course
     $generator->create_course(['shortname' => 'testcourse', 'format' => 'topics', 'numsections' => 5], ['createsections' => true]);
     $this->setAdminUser();
     // Hide the section.
     $visibility = $this->courseservice->set_section_visibility('testcourse', 3, false);
     $this->assertTrue(isset($visibility['actionmodel']));
     $this->assertTrue(isset($visibility['toc']));
     $actionmodel = $visibility['actionmodel'];
     $toc = $visibility['toc'];
     $this->assertTrue($actionmodel instanceof theme_snap\renderables\course_action_section_visibility);
     $this->assertTrue($toc instanceof theme_snap\renderables\course_toc);
     // Check that action model has toggled after section hidden.
     $this->assertEquals('snap-visibility snap-show', $actionmodel->class);
     $this->assertEquals('Show topic', $actionmodel->title);
     $this->assertContains('show=3', $actionmodel->url);
     // Unhide the section.
     $visibility = $this->courseservice->set_section_visibility('testcourse', 3, true);
     $actionmodel = $visibility['actionmodel'];
     $this->assertTrue($actionmodel instanceof theme_snap\renderables\course_action_section_visibility);
     // Check that action model now corresponds to unhighlighted state.
     $this->assertEquals('snap-visibility snap-hide', $actionmodel->class);
     $this->assertEquals('Hide topic', $actionmodel->title);
     $this->assertContains('hide=3', $actionmodel->url);
 }