public function GenerateThemeTest::testContribStarterkit in Drupal 10
Tests the generate-theme command on a theme with a release version number.
File
- core/
tests/ Drupal/ Tests/ Core/ Command/ GenerateThemeTest.php, line 150
Class
- GenerateThemeTest
- Tests the generate-theme commands.
Namespace
Drupal\Tests\Core\CommandCode
public function testContribStarterkit() : void {
// Change the version to a concrete version number, to simulate using a
// contrib theme as the starterkit.
$starterkit_info_yml = $this
->getWorkspaceDirectory() . '/core/themes/starterkit_theme/starterkit_theme.info.yml';
$info = Yaml::decode(file_get_contents($starterkit_info_yml));
$info['version'] = '1.20';
file_put_contents($starterkit_info_yml, Yaml::encode($info));
$process = $this
->generateThemeFromStarterkit();
$result = $process
->run();
$this
->assertEquals('Theme generated successfully to themes/test_custom_theme', trim($process
->getOutput()), $process
->getErrorOutput());
$this
->assertSame(0, $result);
$info = $this
->assertThemeExists('themes/test_custom_theme');
self::assertArrayNotHasKey('hidden', $info);
self::assertArrayHasKey('generator', $info);
self::assertEquals('starterkit_theme:1.20', $info['generator']);
}