예제 #1
0
 function testGetVersionRecord()
 {
     $cmsMain = new CMSMain();
     $page1 = $this->objFromFixture('Page', 'page1');
     $page1->Content = 'this is the old content';
     $page1->write();
     $page1->Content = 'this is new content (new version)';
     $page1->write();
     $versionID = DB::query('SELECT "Version" FROM "SiteTree_versions" WHERE "Content" = \'this is the old content\'')->value();
     $_REQUEST['Version'] = $versionID;
     $this->assertEquals($cmsMain->getRecord($page1->ID)->Version, $versionID);
     $this->assertEquals($cmsMain->getRecord($page1->ID)->Content, 'this is the old content');
     unset($_REQUEST['Version']);
 }
예제 #2
0
 /**
  * Test CMSMain::getRecord()
  */
 function testGetRecord()
 {
     // Set up a page that is delete from live
     $page1 = $this->objFromFixture('Page', 'page1');
     $page1ID = $page1->ID;
     $page1->doPublish();
     $page1->delete();
     $cmsMain = new CMSMain();
     // Bad calls
     $this->assertNull($cmsMain->getRecord('0'));
     $this->assertNull($cmsMain->getRecord('asdf'));
     // Pages that are on draft and aren't on draft should both work
     $this->assertType('Page', $cmsMain->getRecord($page1ID));
     $this->assertType('Page', $cmsMain->getRecord($this->idFromFixture('Page', 'page2')));
     // This functionality isn't actually used any more.
     $newPage = $cmsMain->getRecord('new-Page-5');
     $this->assertType('Page', $newPage);
     $this->assertEquals('5', $newPage->ParentID);
 }