function GenerateThemeTest::assertThemeExists

Same name in this branch
  1. 11.x core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php \Drupal\Tests\Core\Command\GenerateThemeTest::assertThemeExists()
Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php \Drupal\Tests\Core\Command\GenerateThemeTest::assertThemeExists()
  2. 10 core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php \Drupal\Tests\Core\Command\GenerateThemeTest::assertThemeExists()
  3. 10 core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php \Drupal\BuildTests\Command\GenerateThemeTest::assertThemeExists()

Asserts the theme exists. Returns the parsed *.info.yml file.

Parameters

string $theme_path_relative: The core-relative path to the theme.

Return value

array The parsed *.info.yml file.

10 calls to GenerateThemeTest::assertThemeExists()
GenerateThemeTest::test in core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
Tests the generate-theme command.
GenerateThemeTest::testContribStarterkit in core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
Tests the generate-theme command on a theme with a release version number.
GenerateThemeTest::testContribStarterkitDevSnapshot in core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
Tests the generate-theme command on a theme with a dev version number.
GenerateThemeTest::testCustomStarterkit in core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
Tests the generate-theme command on a theme without a version number.
GenerateThemeTest::testDeleteDirectory in core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php

... See full list

File

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

Class

GenerateThemeTest
Tests the generate-theme commands.

Namespace

Drupal\BuildTests\Command

Code

private function assertThemeExists(string $theme_path_relative) : array {
    $theme_path_absolute = $this->getWorkspaceDirectory() . "/{$theme_path_relative}";
    $theme_name = basename($theme_path_relative);
    $info_yml_filename = "{$theme_name}.info.yml";
    $this->assertFileExists($theme_path_absolute . '/' . $info_yml_filename);
    $info = Yaml::decode(file_get_contents($theme_path_absolute . '/' . $info_yml_filename));
    return $info;
}

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