function RendererTest::testRenderWithThemeArguments
@covers ::render
      
    
@covers ::doRender
      
    
File
- 
              core/tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php, line 775 
Class
- RendererTest
- @coversDefaultClass \Drupal\Core\Render\Renderer[[api-linebreak]] @group Render
Namespace
Drupal\Tests\Core\RenderCode
public function testRenderWithThemeArguments() : void {
  $element = [
    '#theme' => 'common_test_foo',
    '#foo' => $this->randomMachineName(),
    '#bar' => $this->randomMachineName(),
  ];
  $this->themeManager
    ->expects($this->once())
    ->method('render')
    ->with('common_test_foo', $this->defaultThemeVars + $element)
    ->willReturnCallback(function ($hook, $vars) {
    return $vars['#foo'] . $vars['#bar'];
  });
  // Tests that passing arguments to the theme function works.
  $this->assertEquals($this->renderer
    ->renderRoot($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works');
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
