silverstripe-cms/tests/model/SiteConfigTest.php
Fred Condo d99e3a0927 Code cleanup: removed trailing ?> markers per code standard.
All cms module except lang directory.
2012-02-13 12:48:41 -08:00

39 lines
1.3 KiB
PHP

<?php
/**
* @package cms
* @subpackage tests
*
* Note: Most of the permission-related SiteConfig tests are located in
* SiteTreePermissionsTest
*/
class SiteConfigTest extends SapphireTest {
protected $illegalExtensions = array(
'SiteTree' => array('SiteTreeSubsites')
);
function testAvailableThemes() {
$config = SiteConfig::current_site_config();
$ds = DIRECTORY_SEPARATOR;
$testThemeBaseDir = TEMP_FOLDER . $ds . 'test-themes';
if(file_exists($testThemeBaseDir)) Filesystem::removeFolder($testThemeBaseDir);
mkdir($testThemeBaseDir);
mkdir($testThemeBaseDir . $ds . 'blackcandy');
mkdir($testThemeBaseDir . $ds . 'blackcandy_blog');
mkdir($testThemeBaseDir . $ds . 'darkshades');
mkdir($testThemeBaseDir . $ds . 'darkshades_blog');
$themes = $config->getAvailableThemes($testThemeBaseDir);
$this->assertContains('blackcandy', $themes, 'Test themes contain blackcandy theme');
$this->assertContains('darkshades', $themes, 'Test themes contain darkshades theme');
SiteConfig::disable_theme('darkshades');
$themes = $config->getAvailableThemes($testThemeBaseDir);
$this->assertFalse(in_array('darkshades', $themes), 'Darkshades was disabled - it is no longer available');
Filesystem::removeFolder($testThemeBaseDir);
}
}