mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR: Replaced containsIDs() calls in tests with assertContains() and column().
This commit is contained in:
parent
435867d516
commit
e7acf678a9
@ -33,7 +33,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
|
|
||||||
// assert backlink to page 2 doesn't exist
|
// assert backlink to page 2 doesn't exist
|
||||||
$page2 = $this->objFromFixture('Page', 'page2');
|
$page2 = $this->objFromFixture('Page', 'page2');
|
||||||
$this->assertFalse($page1->BackLinkTracking()->containsIDs(array($page2->ID)), 'Assert backlink to page 2 doesn\'t exist');
|
$this->assertNotContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 doesn\'t exist');
|
||||||
|
|
||||||
// add hyperlink to page 1 on page 2
|
// add hyperlink to page 1 on page 2
|
||||||
$page2->Content .= '<p><a href="[sitetree_link id='.$page1->ID.']">Testing page 1 link</a></p>';
|
$page2->Content .= '<p><a href="[sitetree_link id='.$page1->ID.']">Testing page 1 link</a></p>';
|
||||||
@ -43,7 +43,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
|
|
||||||
// assert backlink to page 2 exists
|
// assert backlink to page 2 exists
|
||||||
$this->assertTrue($page1->BackLinkTracking()->containsIDs(array($page2->ID)), 'Assert backlink to page 2 exists');
|
$this->assertContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRemovingLinkFromPageRemovesBacklink() {
|
function testRemovingLinkFromPageRemovesBacklink() {
|
||||||
@ -52,7 +52,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
|
|
||||||
// assert backlink to page 3 exits
|
// assert backlink to page 3 exits
|
||||||
$page3 = $this->objFromFixture('Page', 'page3');
|
$page3 = $this->objFromFixture('Page', 'page3');
|
||||||
$this->assertTrue($page1->BackLinkTracking()->containsIDs(array($page3->ID)), 'Assert backlink to page 3 exists');
|
$this->assertContains($page3->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 exists');
|
||||||
|
|
||||||
// remove hyperlink to page 1
|
// remove hyperlink to page 1
|
||||||
$page3->Content = '<p>No links anymore!</p>';
|
$page3->Content = '<p>No links anymore!</p>';
|
||||||
@ -62,7 +62,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
|
|
||||||
// assert backlink to page 3 exists
|
// assert backlink to page 3 exists
|
||||||
$this->assertFalse($page1->BackLinkTracking()->containsIDs(array($page3->ID)), 'Assert backlink to page 3 doesn\'t exist');
|
$this->assertNotContains($page3->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 doesn\'t exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testChangingUrlOnDraftSiteRewritesLink() {
|
function testChangingUrlOnDraftSiteRewritesLink() {
|
||||||
@ -71,7 +71,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
|
|
||||||
// assert backlink to page 3 exists
|
// assert backlink to page 3 exists
|
||||||
$page3 = $this->objFromFixture('Page', 'page3');
|
$page3 = $this->objFromFixture('Page', 'page3');
|
||||||
$this->assertTrue($page1->BackLinkTracking()->containsIDs(array($page3->ID)), 'Assert backlink to page 3 exists');
|
$this->assertContains($page3->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 exists');
|
||||||
|
|
||||||
// assert hyperlink to page 1's current url exists on page 3
|
// assert hyperlink to page 1's current url exists on page 3
|
||||||
$links = HTTP::getLinksIn($page3->obj('Content')->forTemplate());
|
$links = HTTP::getLinksIn($page3->obj('Content')->forTemplate());
|
||||||
@ -101,7 +101,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
$page3live = Versioned::get_one_by_stage('Page', 'Live', '"SiteTree"."ID" = ' . $page3->ID);
|
||||||
|
|
||||||
// assert backlink to page 3 exists
|
// assert backlink to page 3 exists
|
||||||
$this->assertTrue($page1live->BackLinkTracking()->containsIDs(array($page3live->ID)), 'Assert backlink to page 3 exists');
|
$this->assertContains($page3live->ID, $page1live->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 exists');
|
||||||
|
|
||||||
// assert hyperlink to page 1's current url exists on page 3
|
// assert hyperlink to page 1's current url exists on page 3
|
||||||
$links = HTTP::getLinksIn($page3live->obj('Content')->forTemplate());
|
$links = HTTP::getLinksIn($page3live->obj('Content')->forTemplate());
|
||||||
@ -202,7 +202,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$page2->doPublish();
|
$page2->doPublish();
|
||||||
|
|
||||||
// assert backlink to page 2 doesn't exist
|
// assert backlink to page 2 doesn't exist
|
||||||
$this->assertFalse($page1->BackLinkTracking()->containsIDs(array($page2->ID)), 'Assert backlink to page 2 doesn\'t exist');
|
$this->assertNotContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 doesn\'t exist');
|
||||||
|
|
||||||
// add hyperlink to page 1 on page 2
|
// add hyperlink to page 1 on page 2
|
||||||
$page2->ExtraContent .= '<p><a href="[sitetree_link id='.$page1->ID.']">Testing page 1 link</a></p>';
|
$page2->ExtraContent .= '<p><a href="[sitetree_link id='.$page1->ID.']">Testing page 1 link</a></p>';
|
||||||
@ -210,7 +210,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$page2->doPublish();
|
$page2->doPublish();
|
||||||
|
|
||||||
// assert backlink to page 2 exists
|
// assert backlink to page 2 exists
|
||||||
$this->assertTrue($page1->BackLinkTracking()->containsIDs(array($page2->ID)), 'Assert backlink to page 2 exists');
|
$this->assertContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 exists');
|
||||||
|
|
||||||
// update page1 url
|
// update page1 url
|
||||||
$page1 = $this->objFromFixture('Page', 'page1');
|
$page1 = $this->objFromFixture('Page', 'page1');
|
||||||
@ -237,7 +237,7 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
|||||||
$page2->write();
|
$page2->write();
|
||||||
|
|
||||||
// assert backlink to page 2 no longer exists
|
// assert backlink to page 2 no longer exists
|
||||||
$this->assertFalse($page1->BackLinkTracking()->containsIDs(array($page2->ID)), 'Assert backlink to page 2 has been removed');
|
$this->assertNotContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 has been removed');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user