protected function WebTestBase::assertThemeOutput

Asserts themed output.

Parameters

$callback: The name of the theme function to invoke; e.g. 'links' for theme_links().

$variables: An array of variables to pass to the theme function.

$expected: The expected themed output string.

$message: (optional) A message to display with the assertion. Do not translate messages: use format_string() to embed variables in the message text, not t(). If left blank, a default message will be displayed.

$group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

Return value

TRUE on pass, FALSE on fail.

2 calls to WebTestBase::assertThemeOutput()
FunctionsTest::testItemList in drupal/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
Tests theme_item_list().
FunctionsTest::testLinks in drupal/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
Tests theme_links().

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 2453
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') {
  $output = theme($callback, $variables);
  $this
    ->verbose('Variables:' . '<pre>' . check_plain(var_export($variables, TRUE)) . '</pre>' . '<hr />' . 'Result:' . '<pre>' . check_plain(var_export($output, TRUE)) . '</pre>' . '<hr />' . 'Expected:' . '<pre>' . check_plain(var_export($expected, TRUE)) . '</pre>' . '<hr />' . $output);
  if (!$message) {
    $message = '%callback rendered correctly.';
  }
  $message = format_string($message, array(
    '%callback' => 'theme_' . $callback . '()',
  ));
  return $this
    ->assertIdentical($output, $expected, $message, $group);
}