function GenerateThemeTest::testInfoOverrides

Same name in other branches
  1. 10 core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php \Drupal\BuildTests\Command\GenerateThemeTest::testInfoOverrides()

File

core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php, line 555

Class

GenerateThemeTest
Tests the generate-theme commands.

Namespace

Drupal\BuildTests\Command

Code

public function testInfoOverrides() : void {
    // Force `base theme` to be `false.
    $starterkit_info_yml = $this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/starterkit_theme.info.yml';
    $info = Yaml::decode(file_get_contents($starterkit_info_yml));
    $info['base theme'] = FALSE;
    file_put_contents($starterkit_info_yml, Yaml::encode($info));
    $this->writeStarterkitConfig([
        'info' => [
            'libraries' => [
                'core/jquery',
            ],
        ],
    ]);
    $tester = $this->runCommand([
        'machine-name' => 'test_custom_theme',
        '--name' => 'Test custom starterkit theme',
        '--description' => 'Custom theme generated from a starterkit theme',
    ]);
    $tester->assertCommandIsSuccessful($tester->getErrorOutput());
    $info = $this->assertThemeExists('themes/test_custom_theme');
    self::assertArrayHasKey('base theme', $info);
    self::assertFalse($info['base theme']);
    self::assertArrayHasKey('libraries', $info);
    self::assertEquals([
        'core/jquery',
    ], $info['libraries']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.