function RenderTest::testDrupalRenderInvalidKeys

Tests rendering elements with invalid keys.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php, line 324
Definition of Drupal\system\Tests\Common\RenderTest.

Class

RenderTest
Tests drupal_render().

Namespace

Drupal\system\Tests\Common

Code

function testDrupalRenderInvalidKeys() {
  $error = array(
    '%type' => 'User error',
    '!message' => '"child" is an invalid render array key',
    '%function' => 'element_children()',
  );
  $message = t('%type: !message in %function (line ', $error);
  config('system.logging')
    ->set('error_level', ERROR_REPORTING_DISPLAY_ALL)
    ->save();
  $this
    ->drupalGet('common-test/drupal-render-invalid-keys');
  $this
    ->assertResponse(200, 'Received expected HTTP status code.');
  $this
    ->assertRaw($message, format_string('Found error message: !message.', array(
    '!message' => $message,
  )));
}