run(null);
$this->assertEquals (
"Rewrote 9 link(s) on 5 page(s) to use shortcodes.\n",
ob_get_contents(),
'Rewritten links are correctly reported'
);
ob_end_clean();
$homeID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home');
$aboutID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'about');
$staffID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'staff');
$actionID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'action');
$hashID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'hash_link');
$homeContent = sprintf (
'AboutStaffExternal Link',
$aboutID,
$staffID
);
$aboutContent = sprintf (
'HomeStaff',
$homeID,
$staffID
);
$staffContent = sprintf (
'HomeAbout',
$homeID,
$aboutID
);
$actionContent = sprintf (
'Search Form', $homeID
);
$hashLinkContent = sprintf (
'HomeAbout',
$homeID,
$aboutID
);
$this->assertEquals (
$homeContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $homeID)->Content,
'HTML URLSegment links are rewritten.'
);
$this->assertEquals (
$aboutContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $aboutID)->Content
);
$this->assertEquals (
$staffContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $staffID)->Content
);
$this->assertEquals (
$actionContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $actionID)->Content,
'Links to actions on pages are rewritten correctly.'
);
$this->assertEquals (
$hashLinkContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $hashID)->Content,
'Hash/anchor links are correctly handled.'
);
}
}