function GenerateThemeTest::testNoRename

Same name in other branches
  1. 11.x core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php \Drupal\BuildTests\Command\GenerateThemeTest::testNoRename()

File

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

Class

GenerateThemeTest
Tests the generate-theme commands.

Namespace

Drupal\BuildTests\Command

Code

public function testNoRename() : void {
    $this->writeStarterkitConfig([
        'no_rename' => [
            'js/starterkit_theme.js',
            '**/js/*.js',
            'js/**/*.js',
        ],
    ]);
    mkdir($this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/js');
    mkdir($this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/js/baz');
    file_put_contents($this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/js/starterkit_theme.js', '');
    file_put_contents($this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/js/starterkit_theme.foo.js', '');
    file_put_contents($this->getWorkspaceDirectory() . '/core/themes/starterkit_theme/js/baz/starterkit_theme.bar.js', '');
    $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());
    $this->assertThemeExists('themes/test_custom_theme');
    $theme_path_absolute = $this->getWorkspaceDirectory() . '/themes/test_custom_theme';
    self::assertFileExists($theme_path_absolute . '/js/starterkit_theme.js');
    self::assertFileExists($theme_path_absolute . '/js/starterkit_theme.foo.js');
    self::assertFileExists($theme_path_absolute . '/js/baz/starterkit_theme.bar.js');
}

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