tests/SubsiteAdminTest.php
/**
     * Test the intranet creation form.
     */
Test the intranet creation form.
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();
  }
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 ( ) ; }
Test the intranet creation form.
Test the intranet creation form .