/**
  * Test get_subwiki_pages with groups and individual wikis.
  */
 public function test_get_subwiki_pages_visible_groups_individual()
 {
     // Create testing data.
     $this->create_individual_wikis_with_groups();
     $this->setUser($this->student);
     // Check that student can retrieve his pages from visible wiki.
     $expectedpage = (array) $this->fpvisg1indstu;
     $expectedpage['caneditpage'] = true;
     $expectedpage['firstpage'] = true;
     $expectedpage['contentformat'] = 1;
     $expectedpages = array($expectedpage);
     $result = mod_wiki_external::get_subwiki_pages($this->wikivisind->id, $this->group1->id, $this->student->id);
     $result = external_api::clean_returnvalue(mod_wiki_external::get_subwiki_pages_returns(), $result);
     $this->assertEquals($expectedpages, $result['pages']);
     // Check that student can see teacher pages in visible groups, even if the user doesn't belong to the group.
     $expectedpage = (array) $this->fpvisg2indt;
     $expectedpage['caneditpage'] = false;
     $expectedpage['firstpage'] = true;
     $expectedpage['contentformat'] = 1;
     $expectedpages = array($expectedpage);
     $result = mod_wiki_external::get_subwiki_pages($this->wikivisind->id, $this->group2->id, $this->teacher->id);
     $result = external_api::clean_returnvalue(mod_wiki_external::get_subwiki_pages_returns(), $result);
     $this->assertEquals($expectedpages, $result['pages']);
     // Check that with visible groups a student can get the pages of all participants.
     $expectedpage = (array) $this->fpvisallindt;
     $expectedpage['caneditpage'] = false;
     $expectedpage['firstpage'] = true;
     $expectedpage['contentformat'] = 1;
     $expectedpages = array($expectedpage);
     $result = mod_wiki_external::get_subwiki_pages($this->wikivisind->id, 0, $this->teacher->id);
     $result = external_api::clean_returnvalue(mod_wiki_external::get_subwiki_pages_returns(), $result);
     $this->assertEquals($expectedpages, $result['pages']);
 }