ComponentNodeVisitorTest.php

Same filename in this branch
  1. 10 core/tests/Drupal/KernelTests/Components/ComponentNodeVisitorTest.php
Same filename in other branches
  1. 11.x core/modules/sdc/tests/src/Kernel/ComponentNodeVisitorTest.php
  2. 11.x core/tests/Drupal/KernelTests/Components/ComponentNodeVisitorTest.php

Namespace

Drupal\Tests\sdc\Kernel

File

core/modules/sdc/tests/src/Kernel/ComponentNodeVisitorTest.php

View source
<?php

namespace Drupal\Tests\sdc\Kernel;


/**
 * Tests the node visitor.
 *
 * @coversDefaultClass \Drupal\sdc\Twig\ComponentNodeVisitor
 * @group sdc
 *
 * @internal
 */
final class ComponentNodeVisitorTest extends ComponentKernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'sdc',
        '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);
    }

}

Classes

Title Deprecated Summary
ComponentNodeVisitorTest Tests the node visitor.

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