function IconBuilderTest::testBuild

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php \Drupal\KernelTests\Core\Layout\IconBuilderTest::testBuild()
  2. 10 core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php \Drupal\KernelTests\Core\Layout\IconBuilderTest::testBuild()
  3. 11.x core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php \Drupal\KernelTests\Core\Layout\IconBuilderTest::testBuild()

@covers ::build @covers ::buildRenderArray @covers ::calculateSvgValues @covers ::getLength @covers ::getOffset

@dataProvider providerTestBuild

File

core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php, line 24

Class

IconBuilderTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Layout%21Icon%21SvgIconBuilder.php/class/SvgIconBuilder/9" title="Builds SVG layout icons." class="local">\Drupal\Core\Layout\Icon\SvgIconBuilder</a> @group Layout

Namespace

Drupal\KernelTests\Core\Layout

Code

public function testBuild(SvgIconBuilder $icon_builder, $icon_map, $expected) {
    $renderer = $this->container
        ->get('renderer');
    $build = $icon_builder->build($icon_map);
    $output = (string) $renderer->executeInRenderContext(new RenderContext(), function () use ($build, $renderer) {
        return $renderer->render($build);
    });
    $this->assertSame($expected, $output);
}

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