tests/SubsiteAdminTest.php
/**
	 * Test that the main-site user with ADMIN permissions can access all subsites, regardless
	 * of whether he is in a subsite-specific group or not.
	 */
Test that the main-site user with ADMIN permissions can access all subsites, regardless
of whether he is in a subsite-specific group or not.
Test that the main - site user with ADMIN permissions can access all subsites regardless of whether he is in a subsite - specific group or not .
function testMainsiteAdminCanAccessAllSubsites() {
		$member = $this->objFromFixture('Member', 'admin');
		Session::set("loggedInAs", $member->ID);
		$cmsMain = new CMSMain();
		foreach($cmsMain->Subsites() as $subsite) {
			$ids[$subsite->ID] = true;
		}	
		$this->assertTrue($subsite->adminSearchFields() instanceof FieldSet);
		$this->assertArrayHasKey(0, $ids, "Main site accessible");
		$this->assertArrayHasKey($this->idFromFixture('Subsite_Template','main'), $ids, "Site with no groups inaccesible");
		$this->assertArrayHasKey($this->idFromFixture('Subsite_Template','subsite1'), $ids, "Subsite1 Template inaccessible");
		$this->assertArrayHasKey($this->idFromFixture('Subsite_Template','subsite2'), $ids, "Subsite2 Template inaccessible");
	}
function testMainsiteAdminCanAccessAllSubsites ( ) { $ member = $ this -> objFromFixture ( 'Member' , 'admin' ) ; Session :: set ( " loggedInAs " , $ member -> ID ) ; $ cmsMain = new CMSMain ( ) ; foreach ( $ cmsMain -> Subsites ( ) as $ subsite ) { $ ids [ $ subsite -> ID ] = true ; } $ this -> assertTrue ( $ subsite -> adminSearchFields ( ) instanceof FieldSet ) ; $ this -> assertArrayHasKey ( 0 , $ ids , " Main site accessible " ) ; $ this -> assertArrayHasKey ( $ this -> idFromFixture ( 'Subsite_Template' , 'main' ) , $ ids , " Site with no groups inaccesible " ) ; $ this -> assertArrayHasKey ( $ this -> idFromFixture ( 'Subsite_Template' , 'subsite1' ) , $ ids , " Subsite1 Template inaccessible " ) ; $ this -> assertArrayHasKey ( $ this -> idFromFixture ( 'Subsite_Template' , 'subsite2' ) , $ ids , " Subsite2 Template inaccessible " ) ; }
Test that the main-site user with ADMIN permissions can access all subsites, regardless
 of whether he is in a subsite-specific group or not.
Test that the main - site user with ADMIN permissions can access all subsites regardless of whether he is in a subsite - specific group or not .