From 93beccc5715e4cb3e645f560e605b59b9be8b880 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 13 Aug 2014 14:01:36 -0700 Subject: [PATCH] Issue #2217755 by Alumei, Les Lim, er.pushpinderrana, martin107, Daniel Norton | alexpott: Fixed template_preprocess_links uses a non existent class JSON. --- core/includes/theme.inc | 1 + .../system/src/Tests/Theme/FunctionsTest.php | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index f7acb39cbd..7187666e0e 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -8,6 +8,7 @@ * customized by user themes. */ +use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\String; use Drupal\Component\Utility\UrlHelper; diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php index 577e075959..b0fe305098 100644 --- a/core/modules/system/src/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php @@ -7,11 +7,10 @@ namespace Drupal\system\Tests\Theme; +use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\String; use Drupal\Core\Session\UserSession; use Drupal\simpletest\WebTestBase; -use Symfony\Cmf\Component\Routing\RouteObjectInterface; -use Symfony\Component\HttpFoundation\Request; /** * Tests for common theme functions. @@ -206,6 +205,14 @@ function testLinks() { 'route_name' => 'router_test.1', 'route_parameters' => array(), ), + 'query-test' => array( + 'title' => 'Query test route', + 'route_name' => 'router_test.1', + 'route_parameters' => array(), + 'query' => array( + 'key' => 'value', + ) + ), ); $expected_links = ''; @@ -214,6 +221,8 @@ function testLinks() { $expected_links .= '
  • ' . String::checkPlain('Plain "text"') . '
  • '; $expected_links .= '
  • ' . String::checkPlain('Front page') . '
  • '; $expected_links .= '
  • ' . String::checkPlain('Test route') . '
  • '; + $query = array('key' => 'value'); + $expected_links .= '
  • ' . String::checkPlain('Query test route') . '
  • '; $expected_links .= ''; // Verify that passing a string as heading works. @@ -250,6 +259,8 @@ function testLinks() { $expected_links .= '
  • ' . String::checkPlain('Plain "text"') . '
  • '; $expected_links .= '
  • ' . String::checkPlain('Front page') . '
  • '; $expected_links .= '
  • ' . String::checkPlain('Test route') . '
  • '; + $query = array('key' => 'value'); + $expected_links .= '
  • ' . String::checkPlain('Query test route') . '
  • '; $expected_links .= ''; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); @@ -263,6 +274,9 @@ function testLinks() { $expected_links .= '
  • ' . String::checkPlain('Plain "text"') . '
  • '; $expected_links .= '
  • ' . String::checkPlain('Front page') . '
  • '; $expected_links .= '
  • ' . String::checkPlain('Test route') . '
  • '; + $query = array('key' => 'value'); + $encoded_query = String::checkPlain(Json::encode($query)); + $expected_links .= '
  • ' . String::checkPlain('Query test route') . '
  • '; $expected_links .= ''; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); -- GitLab