Commit aa94eca6 authored by catch's avatar catch
Browse files

task: #3582093 Convert Unit and Kernel tests that use Claro to Admin

By: quietone
By: catch
By: daffie
By: dcam
parent 0f9a918d
Loading
Loading
Loading
Loading
+10 −10
Changes for core/modules/block/tests/src/Kernel/ConfigActionsTest.php: 10 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -48,12 +48,12 @@ protected function setUp(): void {
    $this->installConfig('system');
    $this->container->get(ThemeInstallerInterface::class)->install([
      'stark',
      'claro',
      'default_admin',
      'block_test_theme',
    ]);
    $this->config('system.theme')
      ->set('default', 'stark')
      ->set('admin', 'claro')
      ->set('admin', 'default_admin')
      ->save();
    $this->configActionManager = $this->container->get('plugin.manager.config_action');
  }
@@ -98,32 +98,32 @@ public function testPlaceBlockActionOnlyWorksOnBlocks(string $action): void {
   */
  public function testPlaceBlockActionDoesNotChangeExistingBlock(): void {
    $this->config('system.theme')
      ->set('default', 'claro')
      ->set('default', 'default_admin')
      ->save();
    $extant_region = Block::load('claro_breadcrumbs')->getRegion();
    $extant_region = Block::load('default_admin_breadcrumbs')->getRegion();
    $this->assertNotSame('content', $extant_region);

    $this->configActionManager->applyAction('placeBlockInDefaultTheme', 'block.block.claro_powered', [
    $this->configActionManager->applyAction('placeBlockInDefaultTheme', 'block.block.default_admin_powered', [
      'plugin' => 'system_powered_by_block',
      'region' => [
        'claro' => 'content',
        'default_admin' => 'content',
      ],
    ]);
    // The extant block should be unchanged.
    $this->assertSame($extant_region, Block::load('claro_breadcrumbs')->getRegion());
    $this->assertSame($extant_region, Block::load('default_admin_breadcrumbs')->getRegion());
  }

  /**
 * Tests place block in dynamic region.
 */
  #[TestWith(["placeBlockInDefaultTheme", "stark", "header"])]
  #[TestWith(["placeBlockInAdminTheme", "claro", "page_bottom"])]
  #[TestWith(["placeBlockInAdminTheme", "default_admin", "page_bottom"])]
  public function testPlaceBlockInDynamicRegion(string $action, string $expected_theme, string $expected_region): void {
    $this->configActionManager->applyAction($action, 'block.block.test_block', [
      'plugin' => 'system_powered_by_block',
      'region' => [
        'stark' => 'header',
        'claro' => 'page_bottom',
        'default_admin' => 'page_bottom',
      ],
      'default_region' => 'content',
    ]);
@@ -146,7 +146,7 @@ public function testPlaceBlockInDynamicRegion(string $action, string $expected_t
 * Tests place block in static region.
 */
  #[TestWith(["placeBlockInDefaultTheme", "stark"])]
  #[TestWith(["placeBlockInAdminTheme", "claro"])]
  #[TestWith(["placeBlockInAdminTheme", "default_admin"])]
  public function testPlaceBlockInStaticRegion(string $action, string $expected_theme): void {
    $this->configActionManager->applyAction($action, 'block.block.test_block', [
      'plugin' => 'system_powered_by_block',
+2 −2
Changes for core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public static function contextualLinksDataProvider(): array {
        ],
      ],
      'foo:0=bar&key=baz&1=qux:langcode=en',
      'claro',
      'default_admin',
    ];

    $tests['one group, one dynamic path argument, metadata'] = [
@@ -99,7 +99,7 @@ public static function contextualLinksDataProvider(): array {
        ],
      ],
      'node:node=14031991:langcode=en|foo:0=bar&key=baz&1=qux:langcode=en|edge:0=20011988:langcode=en',
      'claro',
      'default_admin',
    ];

    return $tests;
+1 −1
Changes for core/modules/help/tests/src/Kernel/HelpTopicsSyntaxTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ public function testHelpTopics(): void {
    // test can continue.
    $this->assertArrayHasKey('system', $directories, 'System module is being scanned');
    $this->assertArrayHasKey('help', $directories, 'Help module is being scanned');
    $this->assertArrayHasKey('default_admin', $directories, 'Admin theme is being scanned');
    $this->assertArrayHasKey('default_admin', $directories, 'Default Admin theme is being scanned');
    $this->assertArrayHasKey('standard', $directories, 'Standard profile is being scanned');

    $definitions = (new HelpTopicDiscovery($directories))->getDefinitions();
+2 −2
Changes for core/modules/system/tests/src/Kernel/Theme/TwigNamespaceTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class TwigNamespaceTest extends KernelTestBase {
   */
  protected function setUp(): void {
    parent::setUp();
    \Drupal::service('theme_installer')->install(['test_theme', 'claro']);
    \Drupal::service('theme_installer')->install(['test_theme', 'default_admin']);
    $this->twig = \Drupal::service('twig');
  }

@@ -57,7 +57,7 @@ public function testTemplateDiscovery(): void {
    $this->assertTwigTemplate($this->twig->load('@node/node.html.twig'), 'Found node.html.twig in node module.');

    // Tests resolving namespaced templates in themes.
    $this->assertTwigTemplate($this->twig->load('@claro/page.html.twig'), 'Found page.html.twig in Stark theme.');
    $this->assertTwigTemplate($this->twig->load('@default_admin/page/page.html.twig'), 'Found page.html.twig in Default Admin theme.');
  }

  /**
+1 −1
Changes for core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public function testDetermineActiveTheme(?string $admin_theme, ?string $expected
   */
  public static function getThemes(): array {
    return [
      ['claro', 'claro'],
      ['default_admin', 'default_admin'],
      [NULL, NULL],
      ['', NULL],
    ];
Loading