mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Fixed FilesystemPublisherTest to have self-contained extension settings, and not rely on static publishing being enable in mysite/_config.php already. Fixed login permissions for doPublish() calls in test case.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99347 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d61a370972
commit
641a8fec7a
@ -6,14 +6,21 @@
|
|||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
*/
|
*/
|
||||||
class FilesystemPublisherTest extends SapphireTest {
|
class FilesystemPublisherTest extends SapphireTest {
|
||||||
function setup() {
|
|
||||||
parent::setup();
|
protected $usesDatabase = true;
|
||||||
|
|
||||||
|
function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
Object::add_extension("SiteTree", "FilesystemPublisher('../FilesystemPublisherTest-static-folder/')");
|
||||||
SiteTree::$write_homepage_map = false;
|
SiteTree::$write_homepage_map = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function teardown() {
|
function tearDown() {
|
||||||
parent::teardown();
|
Object::remove_extension("SiteTree", "FilesystemPublisher");
|
||||||
SiteTree::$write_homepage_map = true;
|
SiteTree::$write_homepage_map = true;
|
||||||
|
|
||||||
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,7 +39,9 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
$this->assertEquals($fsp->class, 'FilesystemPublisher');
|
$this->assertEquals($fsp->class, 'FilesystemPublisher');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testHomepageMapIsCorrect() {
|
function testHomepageMapIsWithStaticPublishing() {
|
||||||
|
$this->logInWithPermssion('ADMIN');
|
||||||
|
|
||||||
$p1 = new Page();
|
$p1 = new Page();
|
||||||
$p1->URLSegment = strtolower(__CLASS__).'-page-1';
|
$p1->URLSegment = strtolower(__CLASS__).'-page-1';
|
||||||
$p1->HomepageForDomain = '';
|
$p1->HomepageForDomain = '';
|
||||||
@ -51,13 +60,15 @@ class FilesystemPublisherTest extends SapphireTest {
|
|||||||
|
|
||||||
$map = SiteTree::generate_homepage_domain_map();
|
$map = SiteTree::generate_homepage_domain_map();
|
||||||
|
|
||||||
$validMap = array(
|
$this->assertEquals(
|
||||||
|
$map,
|
||||||
|
array(
|
||||||
'domain1' => strtolower(__CLASS__).'-page-2',
|
'domain1' => strtolower(__CLASS__).'-page-2',
|
||||||
'domain2' => strtolower(__CLASS__).'-page-3',
|
'domain2' => strtolower(__CLASS__).'-page-3',
|
||||||
'domain3' => strtolower(__CLASS__).'-page-3',
|
'domain3' => strtolower(__CLASS__).'-page-3',
|
||||||
|
),
|
||||||
|
'Homepage/domain map is correct when static publishing is enabled'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($map, $validMap, 'Homepage/domain map is correct');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user