public function RendererTest::testRenderWithThemeArguments in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderWithThemeArguments()
- 10 core/tests/Drupal/Tests/Core/Render/RendererTest.php \Drupal\Tests\Core\Render\RendererTest::testRenderWithThemeArguments()
@covers ::render @covers ::doRender
File
- core/
tests/ Drupal/ Tests/ Core/ Render/ RendererTest.php, line 773 - Contains \Drupal\Tests\Core\Render\RendererTest.
Class
- RendererTest
- @coversDefaultClass \Drupal\Core\Render\Renderer @group Render
Namespace
Drupal\Tests\Core\RenderCode
public function testRenderWithThemeArguments() {
$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');
}