-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Subsite theme as main theme; allow cascading of themes
- Loading branch information
1 parent
a4a1ab6
commit 877f4f5
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace subsites\tests\php; | ||
|
||
|
||
use Page; | ||
use SilverStripe\Dev\FunctionalTest; | ||
use SilverStripe\Subsites\Model\Subsite; | ||
use SilverStripe\View\SSViewer; | ||
|
||
class SubsiteFunctionalTest extends FunctionalTest | ||
{ | ||
public static $fixture_file = 'subsites/tests/php/SubsiteTest.yml'; | ||
|
||
/** | ||
* @todo: remove test from SiteTreeSubsitesTest when this one works. Seems domain lookup is broken atm | ||
*/ | ||
public function testIfSubsiteThemeIsSetToThemeList() | ||
{ | ||
$this->markTestSkipped('doesn\'t work somehow - refactor when domain lookup is working'); | ||
$defaultThemes = ['default']; | ||
SSViewer::set_themes($defaultThemes); | ||
|
||
$subsitePage = $this->objFromFixture(Page::class, 'contact'); | ||
$this->get($subsitePage->AbsoluteLink()); | ||
$this->assertEquals($subsitePage->SubsiteID, Subsite::currentSubsiteID(), 'Subsite should be changed'); | ||
$this->assertEquals(SSViewer::get_themes(), $defaultThemes, | ||
'Themes should not be modified when Subsite has no theme defined'); | ||
|
||
$pageWithTheme = $this->objFromFixture(Page::class, 'subsite1_contactus'); | ||
$this->get($pageWithTheme->AbsoluteLink()); | ||
$subsiteTheme = $pageWithTheme->Subsite()->Theme; | ||
$this->assertEquals($pageWithTheme->SubsiteID, Subsite::currentSubsiteID(), 'Subsite should be changed'); | ||
$this->assertEquals(SSViewer::get_themes(), array_merge([$subsiteTheme], $defaultThemes), | ||
'Themes should be modified when Subsite has theme defined'); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters