summaryrefslogtreecommitdiffstatshomepage
path: root/core/tests/Drupal/KernelTests/Components/ComponentNodeVisitorTest.php
blob: 6b72fa745ea5a354bb58e9c0fed4910c08e71420 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

declare(strict_types=1);

namespace Drupal\KernelTests\Components;

/**
 * Tests the node visitor.
 *
 * @coversDefaultClass \Drupal\Core\Template\ComponentNodeVisitor
 * @group sdc
 */
class ComponentNodeVisitorTest extends ComponentKernelTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['system', 'sdc_other_node_visitor'];

  /**
   * {@inheritdoc}
   */
  protected static $themes = ['sdc_theme_test'];

  /**
   * Test that other visitors can modify Twig nodes.
   */
  public function testOtherVisitorsCanModifyTwigNodes(): void {
    $build = [
      '#type' => 'inline_template',
      '#template' => "{% embed('sdc_theme_test_base:my-card-no-schema') %}{% block card_body %}Foo bar{% endblock %}{% endembed %}",
    ];
    $this->renderComponentRenderArray($build);

    // If this is reached, the test passed.
    $this->assertTrue(TRUE);
  }

}