diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php
index 02fec0f..9d61b2b 100644
--- a/core/modules/block/src/Tests/BlockViewBuilderTest.php
+++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php
@@ -90,7 +90,7 @@ public function testBasicRendering() {
$expected[] = ' ';
$expected[] = '';
$expected_output = implode("\n", $expected);
- $this->assertEqual(drupal_render($output), $expected_output);
+ $this->assertEqual($this->container->get('renderer')->render($output), $expected_output);
// Reset the HTML IDs so that the next render is not affected.
Html::resetSeenIds();
@@ -115,7 +115,7 @@ public function testBasicRendering() {
$expected[] = ' ';
$expected[] = '';
$expected_output = implode("\n", $expected);
- $this->assertEqual(drupal_render($output), $expected_output);
+ $this->assertEqual($this->container->get('renderer')->render($output), $expected_output);
}
/**
@@ -152,7 +152,7 @@ protected function verifyRenderCacheHandling() {
// Test that a cache entry is created.
$build = $this->getBlockRenderArray();
$cid = 'entity_view:block:test_block:en:core';
- drupal_render($build);
+ $this->container->get('renderer')->render($build);
$this->assertTrue($this->container->get('cache.render')->get($cid), 'The block render element has been cached.');
// Re-save the block and check that the cache entry has been deleted.
@@ -166,7 +166,7 @@ protected function verifyRenderCacheHandling() {
// removes it.
$build['#block'] = $this->block;
- drupal_render($build);
+ $this->container->get('renderer')->render($build);
$this->assertTrue($this->container->get('cache.render')->get($cid), 'The block render element has been cached.');
$this->block->delete();
$this->assertFalse($this->container->get('cache.render')->get($cid), 'The block render cache entry has been cleared when the block was deleted.');
@@ -181,14 +181,14 @@ protected function verifyRenderCacheHandling() {
public function testBlockViewBuilderAlter() {
// Establish baseline.
$build = $this->getBlockRenderArray();
- $this->assertIdentical(drupal_render($build), 'Llamas > unicorns!');
+ $this->assertIdentical($this->container->get('renderer')->render($build), 'Llamas > unicorns!');
// Enable the block view alter hook that adds a suffix, for basic testing.
\Drupal::state()->set('block_test_view_alter_suffix', TRUE);
Cache::invalidateTags($this->block->getCacheTags());
$build = $this->getBlockRenderArray();
$this->assertTrue(isset($build['#suffix']) && $build['#suffix'] === '
Goodbye!', 'A block with content is altered.');
- $this->assertIdentical(drupal_render($build), 'Llamas > unicorns!
Goodbye!');
+ $this->assertIdentical($this->container->get('renderer')->render($build), 'Llamas > unicorns!
Goodbye!');
\Drupal::state()->set('block_test_view_alter_suffix', FALSE);
// Force a request via GET so we can get drupal_render() cache working.
@@ -209,7 +209,7 @@ public function testBlockViewBuilderAlter() {
$expected_keys = array_merge($default_keys, array($alter_add_key));
$build = $this->getBlockRenderArray();
$this->assertIdentical($expected_keys, $build['#cache']['keys'], 'An altered cacheable block has the expected cache keys.');
- $this->assertIdentical(drupal_render($build), '');
+ $this->assertIdentical($this->container->get('renderer')->render($build), '');
$cache_entry = $this->container->get('cache.render')->get($cid);
$this->assertTrue($cache_entry, 'The block render element has been cached with the expected cache ID.');
$expected_tags = array_merge($default_tags, ['rendered']);
@@ -224,7 +224,7 @@ public function testBlockViewBuilderAlter() {
$build = $this->getBlockRenderArray();
sort($build['#cache']['tags']);
$this->assertIdentical($expected_tags, $build['#cache']['tags'], 'An altered cacheable block has the expected cache tags.');
- $this->assertIdentical(drupal_render($build), '');
+ $this->assertIdentical($this->container->get('renderer')->render($build), '');
$cache_entry = $this->container->get('cache.render')->get($cid);
$this->assertTrue($cache_entry, 'The block render element has been cached with the expected cache ID.');
$expected_tags = array_merge($default_tags, [$alter_add_tag, 'rendered']);
@@ -237,7 +237,7 @@ public function testBlockViewBuilderAlter() {
\Drupal::state()->set('block_test_view_alter_append_pre_render_prefix', TRUE);
$build = $this->getBlockRenderArray();
$this->assertFalse(isset($build['#prefix']), 'The appended #pre_render callback has not yet run before calling drupal_render().');
- $this->assertIdentical(drupal_render($build), 'Hiya!
');
+ $this->assertIdentical($this->container->get('renderer')->render($build), 'Hiya!
');
$this->assertTrue(isset($build['#prefix']) && $build['#prefix'] === 'Hiya!
', 'A cached block without content is altered.');
// Restore the previous request method.