/** * Test the intranet creation form. */ function XXtestIntranetCreation() { $cont = new SubsiteAdmin(); $cont->pushCurrent(); $cont->setSession($this->adminLoggedInSession()); $form = $cont->AddSubsiteForm(); $source = $form->dataFieldByName('TemplateID')->getSource(); $templateIDs = $this->allFixtureIDs('Subsite_Template'); foreach ($templateIDs as $templateID) { $this->assertArrayHasKey($templateID, $source); } $templateObj = $this->objFromFixture('Subsite_Template', 'main'); $this->assertEquals($templateObj->Title, $source[$templateObj->ID], "Template dropdown isn't listing Title values"); $response = $form->testSubmission('addintranet', array('Name' => 'Test Intranet', 'Domain' => 'test.example.com', 'TemplateID' => 1, 'AdminEmail' => '', 'AdminName' => '')); $this->assertTrue(true == preg_match('/admin\\/subsites\\/show\\/([0-9]+)/i', $response->getHeader('Location'), $matches), "Intranet creation dowsn't redirect to new view"); $newIntranet = DataObject::get_by_id("Subsite", $matches[1]); $this->assertEquals('Test Intranet', $newIntranet->Title, "New intranet not created properly."); $cont->popCurrent(); }
<?php /** * The subsites module modifies the behaviour of the CMS - in the SiteTree and Group databases - to store information * about a number of sub-sites, rather than a single site. */ SiteTree::add_extension('SiteTreeSubsites'); ContentController::add_extension('ControllerSubsites'); CMSPageAddController::add_extension('CMSPageAddControllerExtension'); LeftAndMain::add_extension('LeftAndMainSubsites'); LeftAndMain::add_extension('ControllerSubsites'); Group::add_extension('GroupSubsites'); ErrorPage::add_extension('ErrorPageSubsite'); SiteConfig::add_extension('SiteConfigSubsites'); SS_Report::add_excluded_reports('SubsiteReportWrapper'); //Display in cms menu SecurityAdmin::add_extension('SubsiteMenuExtension'); CMSMain::add_extension('SubsiteMenuExtension'); CMSPagesController::add_extension('SubsiteMenuExtension'); SubsiteAdmin::add_extension('SubsiteMenuExtension'); CMSSettingsController::add_extension('SubsiteMenuExtension'); CMSMenu::remove_menu_item('SubsiteXHRController');