ThemeSettingsTest.php in Zircon Profile 8
File
core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
View source
<?php
namespace Drupal\system\Tests\Theme;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\simpletest\KernelTestBase;
class ThemeSettingsTest extends KernelTestBase {
public static $modules = array(
'system',
);
protected $availableThemes;
protected function setUp() {
parent::setUp();
$this
->installConfig(array(
'system',
));
if (!isset($this->availableThemes)) {
$discovery = new ExtensionDiscovery(\Drupal::root());
$this->availableThemes = $discovery
->scan('theme');
}
}
function testDefaultConfig() {
$name = 'test_basetheme';
$path = $this->availableThemes[$name]
->getPath();
$this
->assertTrue(file_exists("{$path}/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/{$name}.settings.yml"));
$this->container
->get('theme_handler')
->install(array(
$name,
));
$this
->assertIdentical(theme_get_setting('base', $name), 'only');
}
function testNoDefaultConfig() {
$name = 'stark';
$path = $this->availableThemes[$name]
->getPath();
$this
->assertFalse(file_exists("{$path}/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/{$name}.settings.yml"));
$this->container
->get('theme_handler')
->install(array(
$name,
));
$this
->assertNotNull(theme_get_setting('features.favicon', $name));
}
}