mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR: Removed tests for link rewriting operations that are no longer necessary. Link rewriting isn't needed because we use shortcodes now.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89455 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9289de1319
commit
ed1e677c1f
@ -47,133 +47,6 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
||||
// assert backlink to page 3 exists
|
||||
$this->assertFalse($page1->BackLinkTracking()->containsIDs(array($page3->ID)), 'Assert backlink to page 3 doesn\'t exist');
|
||||
}
|
||||
|
||||
function testChangingUrlOnDraftSiteRewritesLink() {
|
||||
// load page 1
|
||||
$page1 = $this->objFromFixture('Page', 'page1');
|
||||
|
||||
// assert backlink to page 3 exists
|
||||
$page3 = $this->objFromFixture('Page', 'page3');
|
||||
$this->assertTrue($page1->BackLinkTracking()->containsIDs(array($page3->ID)), 'Assert backlink to page 3 exists');
|
||||
|
||||
// assert hyperlink to page 1's current url exists on page 3
|
||||
$links = HTTP::getLinksIn($page3->Content);
|
||||
$this->assertContains('page1/', $links, 'Assert hyperlink to page 1\'s current url exists on page 3');
|
||||
|
||||
// change url of page 1
|
||||
$page1->URLSegment = 'new-url-segment';
|
||||
$page1->write();
|
||||
|
||||
// load page 3
|
||||
$page3 = $this->objFromFixture('Page', 'page3');
|
||||
|
||||
// assert hyperlink to page 1's new url exists
|
||||
$links = HTTP::getLinksIn($page3->Content);
|
||||
$this->assertContains('new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
|
||||
}
|
||||
|
||||
function testChangingUrlOnLiveSiteRewritesLink() {
|
||||
// publish page 1 & 3
|
||||
$page1 = $this->objFromFixture('Page', 'page1');
|
||||
$page3 = $this->objFromFixture('Page', 'page3');
|
||||
$this->assertTrue($page1->doPublish());
|
||||
$this->assertTrue($page3->doPublish());
|
||||
|
||||
// load pages from live
|
||||
$page1live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page1->ID);
|
||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||
|
||||
// assert backlink to page 3 exists
|
||||
$this->assertTrue($page1live->BackLinkTracking()->containsIDs(array($page3live->ID)), 'Assert backlink to page 3 exists');
|
||||
|
||||
// assert hyperlink to page 1's current url exists on page 3
|
||||
$links = HTTP::getLinksIn($page3live->Content);
|
||||
$this->assertContains('page1/', $links, 'Assert hyperlink to page 1\'s current url exists on page 3');
|
||||
|
||||
// change url of page 1
|
||||
$page1live->URLSegment = 'new-url-segment';
|
||||
$page1live->writeToStage('Live');
|
||||
|
||||
// load page 3 from live
|
||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||
|
||||
// assert hyperlink to page 1's new url exists
|
||||
$links = HTTP::getLinksIn($page3live->Content);
|
||||
$this->assertContains('new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3');
|
||||
}
|
||||
|
||||
function testPublishingPageWithModifiedUrlRewritesLink() {
|
||||
// publish page 1 & 3
|
||||
$page1 = $this->objFromFixture('Page', 'page1');
|
||||
$page3 = $this->objFromFixture('Page', 'page3');
|
||||
|
||||
$this->assertTrue($page1->doPublish());
|
||||
$this->assertTrue($page3->doPublish());
|
||||
|
||||
// load page 3 from live
|
||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||
|
||||
// assert hyperlink to page 1's current url exists
|
||||
$links = HTTP::getLinksIn($page3live->Content);
|
||||
$this->assertContains('page1/', $links, 'Assert hyperlink to page 1\'s current url exists on page 3');
|
||||
|
||||
// rename url of page 1 on stage
|
||||
$page1->URLSegment = 'new-url-segment';
|
||||
$page1->write();
|
||||
|
||||
// assert hyperlink to page 1's current publish url exists
|
||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||
$links = HTTP::getLinksIn($page3live->Content);
|
||||
$this->assertContains('page1/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3');
|
||||
|
||||
|
||||
// publish page 1
|
||||
$this->assertTrue($page1->doPublish());
|
||||
|
||||
// assert hyperlink to page 1's new published url exists
|
||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||
$links = HTTP::getLinksIn($page3live->Content);
|
||||
$this->assertContains('new-url-segment/', $links, 'Assert hyperlink to page 1\'s new published url exists on page 3');
|
||||
}
|
||||
|
||||
function testPublishingPageWithModifiedLinksRewritesLinks() {
|
||||
// publish page 1 & 3
|
||||
$page1 = $this->objFromFixture('Page', 'page1');
|
||||
$page3 = $this->objFromFixture('Page', 'page3');
|
||||
$this->assertTrue($page1->doPublish());
|
||||
$this->assertTrue($page3->doPublish());
|
||||
|
||||
// assert hyperlink to page 1's current url exists
|
||||
$links = HTTP::getLinksIn($page3->Content);
|
||||
$this->assertContains('page1/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3');
|
||||
|
||||
// change page 1 url on draft
|
||||
$page1->URLSegment = 'new-url-segment';
|
||||
|
||||
// save page 1
|
||||
$page1->write();
|
||||
|
||||
// assert page 3 on draft contains new page 1 url
|
||||
$page3 = $this->objFromFixture('Page', 'page3');
|
||||
$links = HTTP::getLinksIn($page3->Content);
|
||||
$this->assertContains('new-url-segment/', $links, 'Assert hyperlink to page 1\'s current draft url exists on page 3');
|
||||
|
||||
// publish page 3
|
||||
$this->assertTrue($page3->doPublish());
|
||||
|
||||
// assert page 3 on published site contains old page 1 url
|
||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||
$links = HTTP::getLinksIn($page3live->Content);
|
||||
$this->assertContains('page1/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3');
|
||||
|
||||
// publish page 1
|
||||
$this->assertTrue($page1->doPublish());
|
||||
|
||||
// assert page 3 on published site contains new page 1 url
|
||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||
$links = HTTP::getLinksIn($page3live->Content);
|
||||
$this->assertContains('new-url-segment/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user