class MaintenanceThemeUpdateRegistryTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/Theme/MaintenanceThemeUpdateRegistryTest.php \Drupal\Tests\system\Functional\Theme\MaintenanceThemeUpdateRegistryTest
- 10 core/modules/system/tests/src/Functional/Theme/MaintenanceThemeUpdateRegistryTest.php \Drupal\Tests\system\Functional\Theme\MaintenanceThemeUpdateRegistryTest
Ensures theme update functions are registered for maintenance themes.
@group Theme
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Functional\Theme\MaintenanceThemeUpdateRegistryTest uses \Drupal\Tests\RequirementsPageTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of MaintenanceThemeUpdateRegistryTest
File
-
core/
modules/ system/ tests/ src/ Functional/ Theme/ MaintenanceThemeUpdateRegistryTest.php, line 14
Namespace
Drupal\Tests\system\Functional\ThemeView source
class MaintenanceThemeUpdateRegistryTest extends BrowserTestBase {
use RequirementsPageTrait;
/**
* {@inheritdoc}
*/
protected $profile = 'theme_test_profile';
/**
* {@inheritdoc}
*/
protected function prepareSettings() {
parent::prepareSettings();
$this->writeSettings([
'settings' => [
'maintenance_theme' => (object) [
'value' => 'test_theme_updates',
'required' => TRUE,
],
],
]);
}
/**
* {@inheritdoc}
*/
protected function prepareEnvironment() {
parent::prepareEnvironment();
$info = [
'type' => 'profile',
'core_version_requirement' => '*',
'name' => 'Theme test profile',
'themes' => [
'test_theme_updates',
],
];
// Create an install profile that uses the test theme.
$path = $this->siteDirectory . '/profiles/theme_test_profile';
mkdir($path, 0777, TRUE);
file_put_contents("{$path}/theme_test_profile.info.yml", Yaml::encode($info));
// Create a system.theme.yml file for the profile so the test theme is used.
$path = $this->siteDirectory . '/profiles/theme_test_profile/config/install';
mkdir($path, 0777, TRUE);
$theme_config = Yaml::decode(file_get_contents(\Drupal::moduleHandler()->getModule('system')
->getPath() . '/config/install/system.theme.yml'));
$theme_config['default'] = 'test_theme_updates';
file_put_contents("{$path}/system.theme.yml", Yaml::encode($theme_config));
}
/**
* Tests that after installing the profile there are no outstanding updates.
*/
public function testMaintenanceThemeUpdateRegistration() {
$this->drupalLogin($this->rootUser);
$this->drupalGet('update.php/selection');
$this->updateRequirementsProblem();
$this->drupalGet('update.php/selection');
$this->assertSession()
->pageTextContains('No pending updates.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.