function UpdateContribTest::testUpdateShowDisabledThemes in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/update/src/Tests/UpdateContribTest.php \Drupal\update\Tests\UpdateContribTest::testUpdateShowDisabledThemes()
Tests that disabled themes are only shown when desired.
@todo https://www.drupal.org/node/2338175 extensions can not be hidden and base themes have to be installed.
File
- core/
modules/ update/ src/ Tests/ UpdateContribTest.php, line 234 - Contains \Drupal\update\Tests\UpdateContribTest.
Class
- UpdateContribTest
- Tests how the Update Manager module handles contributed modules and themes in a series of functional tests using mock XML data.
Namespace
Drupal\update\TestsCode
function testUpdateShowDisabledThemes() {
$update_settings = $this
->config('update.settings');
// Make sure all the update_test_* themes are disabled.
$extension_config = $this
->config('core.extension');
foreach ($extension_config
->get('theme') as $theme => $weight) {
if (preg_match('/^update_test_/', $theme)) {
$extension_config
->clear("theme.{$theme}");
}
}
$extension_config
->save();
// Define the initial state for core and the test contrib themes.
$system_info = array(
// We want core to be version 8.0.0.
'#all' => array(
'version' => '8.0.0',
),
// The update_test_basetheme should be visible and up to date.
'update_test_basetheme' => array(
'project' => 'update_test_basetheme',
'version' => '8.x-1.1',
'hidden' => FALSE,
),
// The update_test_subtheme should be visible and up to date.
'update_test_subtheme' => array(
'project' => 'update_test_subtheme',
'version' => '8.x-1.0',
'hidden' => FALSE,
),
);
// When there are contributed modules in the site's file system, the
// total number of attempts made in the test may exceed the default value
// of update_max_fetch_attempts. Therefore this variable is set very high
// to avoid test failures in those cases.
$update_settings
->set('fetch.max_attempts', 99999)
->save();
$this
->config('update_test.settings')
->set('system_info', $system_info)
->save();
$xml_mapping = array(
'drupal' => '0.0',
'update_test_subtheme' => '1_0',
'update_test_basetheme' => '1_1-sec',
);
$base_theme_project_link = \Drupal::l(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme'));
$sub_theme_project_link = \Drupal::l(t('Update test subtheme'), Url::fromUri('http://example.com/project/update_test_subtheme'));
foreach (array(
TRUE,
FALSE,
) as $check_disabled) {
$update_settings
->set('check.disabled_extensions', $check_disabled)
->save();
$this
->refreshUpdateStatus($xml_mapping);
// In neither case should we see the "Themes" heading for installed
// themes.
$this
->assertNoText(t('Themes'));
if ($check_disabled) {
$this
->assertText(t('Uninstalled themes'));
$this
->assertRaw($base_theme_project_link, 'Link to the Update test base theme project appears.');
$this
->assertRaw($sub_theme_project_link, 'Link to the Update test subtheme project appears.');
}
else {
$this
->assertNoText(t('Uninstalled themes'));
$this
->assertNoRaw($base_theme_project_link, 'Link to the Update test base theme project does not appear.');
$this
->assertNoRaw($sub_theme_project_link, 'Link to the Update test subtheme project does not appear.');
}
}
}