diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
index 1f371fa..df0ad23 100644
--- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
@@ -430,7 +430,7 @@ public function testGenerateActive() {
       'tag' => 'a',
       'attributes' => array(
         'data-drupal-link-system-path' => 'test-route-3',
-        'data-drupal-link-query' => 'regexp:/.*value.*example_1.*/',
+        'data-drupal-link-query' => '{"value":"example_1"}',
       ),
     ), $result);
 
@@ -445,11 +445,44 @@ public function testGenerateActive() {
       'tag' => 'a',
       'attributes' => array(
         'data-drupal-link-system-path' => 'test-route-4/1',
-        'data-drupal-link-query' => 'regexp:/.*value.*example_1.*/',
+        'data-drupal-link-query' => '{"value":"example_1"}',
       ),
     ), $result);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public static function assertTag($matcher, $actual, $message = '', $isHtml = TRUE) {
+    // The parent method is deprecated in PHPUnit 4.2. This is an alternative
+    // implementation that covers the use cases in this test.
+    // Provide default values.
+    $matcher += array('attributes' => array());
+
+    // Create an XPath query to select the requested tag.
+    $query = '//' . $matcher['tag'];
+
+    // Append XPath predicates for the attributes and content text.
+    $predicates = array();
+    foreach ($matcher['attributes'] as $attribute => $value) {
+      $predicates[] = "@$attribute='$value'";
+    }
+    if (!empty($matcher['content'])) {
+      $predicates[] = "contains(.,'{$matcher['content']}')";
+    }
+    if (!empty($predicates)) {
+      $query .= '[' . implode(' and ', $predicates) . ']';
+    }
+
+    // Execute the query.
+    $document = new \DOMDocument;
+    $document->preserveWhiteSpace = FALSE;
+    $document->loadHTML($actual);
+    $xpath = new \DOMXPath($document);
+
+    self::assertEquals(1, $xpath->query($query)->length);
+  }
+
 }
 
 }
