function GenerateThemeTest::doTestGeneratingFromAnotherTheme
Same name and namespace in other branches
- main core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php \Drupal\BuildTests\Command\GenerateThemeTest::doTestGeneratingFromAnotherTheme()
Tests generating a theme from another Starterkit enabled theme.
1 call to GenerateThemeTest::doTestGeneratingFromAnotherTheme()
- GenerateThemeTest::testGenerateTheme in core/
tests/ Drupal/ BuildTests/ Command/ GenerateThemeTest.php - Tests the generate-theme command.
File
-
core/
tests/ Drupal/ BuildTests/ Command/ GenerateThemeTest.php, line 277
Class
- GenerateThemeTest
- Tests the generate-theme commands.
Namespace
Drupal\BuildTests\CommandCode
protected function doTestGeneratingFromAnotherTheme() : void {
$this->setVersion('9.4.0');
$process = $this->generateThemeFromStarterkit();
$exit_code = $process->run();
$this->assertStringContainsString('Theme generated successfully to themes/test_custom_theme', trim($process->getOutput()), $process->getErrorOutput());
$this->assertSame(0, $exit_code);
file_put_contents($this->getWorkspaceDirectory() . '/themes/test_custom_theme/test_custom_theme.starterkit.yml', <<<YAML
delete: []
no_edit: []
no_rename: []
info:
version: 1.0.0
YAML);
$install_command = [
$this->php,
'core/scripts/drupal',
'generate-theme',
'generated_from_another_theme',
'--name="Generated from another theme"',
'--description="Custom theme generated from a theme other than starterkit_theme"',
'--starterkit=test_custom_theme',
];
$process = new Process($install_command);
$exit_code = $process->run();
$this->assertStringContainsString('Theme generated successfully to themes/generated_from_another_theme', trim($process->getOutput()), $process->getErrorOutput());
$this->assertSame(0, $exit_code);
// Confirm new .theme file.
$dot_theme_file = $this->getWorkspaceDirectory() . '/themes/generated_from_another_theme/src/Hook/GeneratedFromAnotherThemeHooks.php';
$this->assertStringContainsString('public function preprocessImageWidget(array &$variables): void {', file_get_contents($dot_theme_file));
$this->deleteGeneratedTheme('generated_from_another_theme');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.