From ae6e0cfdf40aea870d08d460c9f7535f0c534c98 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 3 Jun 2010 01:29:14 +0000 Subject: [PATCH] BUGFIX fix for #5076 (from r98957) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@106124 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/FilesystemPublisherTest.php | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/FilesystemPublisherTest.php b/tests/FilesystemPublisherTest.php index efef7815..26ca5fde 100644 --- a/tests/FilesystemPublisherTest.php +++ b/tests/FilesystemPublisherTest.php @@ -6,6 +6,15 @@ * @subpackage tests */ class FilesystemPublisherTest extends SapphireTest { + function setup() { + parent::setup(); + SiteTree::$write_homepage_map = false; + } + + function teardown() { + parent::teardown(); + SiteTree::$write_homepage_map = true; + } /** * Simple test to ensure that FileSystemPublisher::__construct() @@ -23,4 +32,32 @@ class FilesystemPublisherTest extends SapphireTest { $this->assertEquals($fsp->class, 'FilesystemPublisher'); } + function testHomepageMapIsCorrect() { + $p1 = new Page(); + $p1->URLSegment = strtolower(__CLASS__).'-page-1'; + $p1->HomepageForDomain = ''; + $p1->write(); + $p1->doPublish(); + $p2 = new Page(); + $p2->URLSegment = strtolower(__CLASS__).'-page-2'; + $p2->HomepageForDomain = 'domain1'; + $p2->write(); + $p2->doPublish(); + $p3 = new Page(); + $p3->URLSegment = strtolower(__CLASS__).'-page-3'; + $p3->HomepageForDomain = 'domain2,domain3'; + $p3->write(); + $p3->doPublish(); + + $map = SiteTree::generate_homepage_domain_map(); + + $validMap = array( + 'domain1' => strtolower(__CLASS__).'-page-2', + 'domain2' => strtolower(__CLASS__).'-page-3', + 'domain3' => strtolower(__CLASS__).'-page-3', + ); + + $this->assertEquals($map, $validMap, 'Homepage/domain map is correct'); + } + } \ No newline at end of file