function GenerateThemeTest::doTestStarterKitFlag

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

Tests that only themes with `starterkit` flag can be used.

1 call to GenerateThemeTest::doTestStarterKitFlag()
GenerateThemeTest::testInvalidThemesAndWarnings in core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php

File

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

Class

GenerateThemeTest
Tests the generate-theme commands.

Namespace

Drupal\BuildTests\Command

Code

protected function doTestStarterKitFlag() : void {
  // Explicitly not a starter theme.
  $install_command = [
    $this->php,
    'core/scripts/drupal',
    'generate-theme',
    'test_custom_theme',
    '--name="Test custom starterkit theme"',
    '--description="Custom theme generated from a starterkit theme"',
    '--starterkit',
    'stark',
  ];
  $process = new Process($install_command, NULL);
  $process->setTimeout(60);
  $result = $process->run();
  $this->assertStringContainsString('Theme source theme stark is not a valid starter kit.', trim($process->getErrorOutput()));
  $this->assertSame(1, $result);
  // Has not defined `starterkit`.
  $install_command = [
    $this->php,
    'core/scripts/drupal',
    'generate-theme',
    'test_custom_theme',
    '--name="Test custom starterkit theme"',
    '--description="Custom theme generated from a starterkit theme"',
    '--starterkit',
    'olivero',
  ];
  $process = new Process($install_command, NULL);
  $process->setTimeout(60);
  $result = $process->run();
  $this->assertStringContainsString('Theme source theme olivero is not a valid starter kit.', trim($process->getErrorOutput()));
  $this->assertSame(1, $result);
}

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