Permalink
Browse files

MINOR Moved MigrateSiteTreeLinkingTask from 'sapphire' to 'cms' module

  • Loading branch information...
1 parent 7e5da27 commit ecc28cb565e2e54854054b0c2c911921d37a8ccc @chillu chillu committed Mar 22, 2011
Showing with 0 additions and 147 deletions.
  1. +0 −80 tests/tasks/MigrateSiteTreeLinkingTaskTest.php
  2. +0 −67 tests/tasks/MigrateSiteTreeLinkingTaskTest.yml
@@ -1,80 +0,0 @@
-<?php
-/**
- * @package sapphire
- * @subpackage tests
- */
-class MigrateSiteTreeLinkingTaskTest extends SapphireTest {
-
- public static $fixture_file = 'sapphire/tests/tasks/MigrateSiteTreeLinkingTaskTest.yml';
-
- public static $use_draft_site = true;
-
- public function testLinkingMigration() {
- ob_start();
-
- $task = new MigrateSiteTreeLinkingTask();
- $task->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('SiteTree', 'home');
- $aboutID = $this->idFromFixture('SiteTree', 'about');
- $staffID = $this->idFromFixture('SiteTree', 'staff');
- $actionID = $this->idFromFixture('SiteTree', 'action');
- $hashID = $this->idFromFixture('SiteTree', 'hash_link');
-
- $homeContent = sprintf (
- '<a href="[sitetree_link id=%d]">About</a><a href="[sitetree_link id=%d]">Staff</a><a href="http://silverstripe.org/">External Link</a>',
- $aboutID,
- $staffID
- );
- $aboutContent = sprintf (
- '<a href="[sitetree_link id=%d]">Home</a><a href="[sitetree_link id=%d]">Staff</a>',
- $homeID,
- $staffID
- );
- $staffContent = sprintf (
- '<a href="[sitetree_link id=%d]">Home</a><a href="[sitetree_link id=%d]">About</a>',
- $homeID,
- $aboutID
- );
- $actionContent = sprintf (
- '<a href="[sitetree_link id=%d]SearchForm">Search Form</a>', $homeID
- );
- $hashLinkContent = sprintf (
- '<a href="[sitetree_link id=%d]#anchor">Home</a><a href="[sitetree_link id=%d]#second-anchor">About</a>',
- $homeID,
- $aboutID
- );
-
- $this->assertEquals (
- $homeContent,
- DataObject::get_by_id('SiteTree', $homeID)->Content,
- 'HTML URLSegment links are rewritten.'
- );
- $this->assertEquals (
- $aboutContent,
- DataObject::get_by_id('SiteTree', $aboutID)->Content
- );
- $this->assertEquals (
- $staffContent,
- DataObject::get_by_id('SiteTree', $staffID)->Content
- );
- $this->assertEquals (
- $actionContent,
- DataObject::get_by_id('SiteTree', $actionID)->Content,
- 'Links to actions on pages are rewritten correctly.'
- );
- $this->assertEquals (
- $hashLinkContent,
- DataObject::get_by_id('SiteTree', $hashID)->Content,
- 'Hash/anchor links are correctly handled.'
- );
- }
-
-}
@@ -1,67 +0,0 @@
-SiteTree:
- home:
- Title: Home Page
- URLSegment: home
- Content: '<a href="about/">About</a><a href="staff">Staff</a><a href="http://silverstripe.org/">External Link</a>'
- about:
- Title: About Us
- URLSegment: about
- Content: <a href="home">Home</a><a href="staff/">Staff</a>
- staff:
- Title: Staff
- URLSegment: staff
- Content: <a href="home/">Home</a><a href="about">About</a>
- Parent: =>SiteTree.about
- action:
- Title: Action Link
- URLSegment: action
- Content: <a href="home/SearchForm">Search Form</a>
- hash_link:
- Title: Hash Link
- URLSegment: hash-link
- Content: '<a href="home/#anchor">Home</a><a href="about/#second-anchor">About</a>'
- admin_link:
- Title: Admin Link
- URLSegment: admin-link
- Content: <a href="admin">Admin</a>
- no_links:
- Title: No Links
- URLSegment: No Links
-
-SiteTree_LinkTracking:
- home_about:
- SiteTreeID: =>SiteTree.home
- ChildID: =>SiteTree.about
- FieldName: Content
- home_staff:
- SiteTreeID: =>SiteTree.home
- ChildID: =>SiteTree.staff
- FieldName: Content
- about_home:
- SiteTreeID: =>SiteTree.about
- ChildID: =>SiteTree.home
- FieldName: Content
- about_staff:
- SiteTreeID: =>SiteTree.about
- ChildID: =>SiteTree.staff
- FieldName: Content
- staff_home:
- SiteTreeID: =>SiteTree.staff
- ChildID: =>SiteTree.home
- FieldName: Content
- staff_about:
- SiteTreeID: =>SiteTree.staff
- ChildID: =>SiteTree.about
- FieldName: Content
- action_home:
- SiteTreeID: =>SiteTree.action
- ChildID: =>SiteTree.home
- FieldName: Content
- hash_link_home:
- SiteTreeID: =>SiteTree.hash_link
- ChildID: =>SiteTree.home
- FieldName: Content
- hash_link_about:
- SiteTreeID: =>SiteTree.hash_link
- ChildID: =>SiteTree.about
- FieldName: Content

0 comments on commit ecc28cb

Please sign in to comment.