1 theme.test protected ThemeFunctionsTestCase::assertThemeOutput($callback, array $variables = array(), $expected = '', $message = '', $group = 'Other')

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) An assertion message.

Overrides BackdropWebTestCase::assertThemeOutput

File

core/modules/simpletest/tests/theme.test, line 412
Tests for the theme API.

Class

ThemeFunctionsTestCase
Tests for common theme functions.

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 = t($message, array('%callback' => 'theme_' . $callback . '()'));
  $this->assertIdentical($output, $expected, $message);
}