diff --git a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php b/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
similarity index 72%
rename from core/modules/comment/src/Tests/CommentNewIndicatorTest.php
rename to core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
index 318e17c57c..83d5674686 100644
--- a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
@@ -1,12 +1,13 @@
 <?php
 
-namespace Drupal\comment\Tests;
+namespace Drupal\Tests\comment\Functional;
 
 use Drupal\Component\Serialization\Json;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\comment\CommentInterface;
 use Drupal\Core\Url;
 use Drupal\comment\Entity\Comment;
+use GuzzleHttp\Cookie\CookieJar;
 
 /**
  * Tests the 'new' indicator posted on comments.
@@ -24,40 +25,32 @@ class CommentNewIndicatorTest extends CommentTestBase {
    */
   public static $modules = ['views'];
 
+  /**
+   * The Guzzle HTTP client cookies.
+   *
+   * @var \GuzzleHttp\Cookie\CookieJar
+   */
+  protected $cookies;
+
   /**
    * Get node "x new comments" metadata from the server for the current user.
    *
    * @param array $node_ids
    *   An array of node IDs.
    *
-   * @return string
-   *   The response body.
+   * @return \Psr\Http\Message\ResponseInterface
+   *   The HTTP response.
    */
   protected function renderNewCommentsNodeLinks(array $node_ids) {
-    // Build POST values.
-    $post = [];
-    for ($i = 0; $i < count($node_ids); $i++) {
-      $post['node_ids[' . $i . ']'] = $node_ids[$i];
-    }
-    $post['field_name'] = 'comment';
-
-    // Serialize POST values.
-    foreach ($post as $key => $value) {
-      // Encode according to application/x-www-form-urlencoded
-      // Both names and values needs to be urlencoded, according to
-      // http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
-      $post[$key] = urlencode($key) . '=' . urlencode($value);
-    }
-    $post = implode('&', $post);
+    $client = $this->getHttpClient();
+    $url = Url::fromRoute('comment.new_comments_node_links')->setAbsolute();
 
-    // Perform HTTP request.
-    return $this->curlExec([
-      CURLOPT_URL => \Drupal::url('comment.new_comments_node_links', [], ['absolute' => TRUE]),
-      CURLOPT_POST => TRUE,
-      CURLOPT_POSTFIELDS => $post,
-      CURLOPT_HTTPHEADER => [
-        'Accept: application/json',
-        'Content-Type: application/x-www-form-urlencoded',
+    return $client->request('POST', $url->toString(), [
+      'cookies' => $this->cookies,
+      'http_errors' => FALSE,
+      'form_params' => [
+        'node_ids' => $node_ids,
+        'field_name' => 'comment',
       ],
     ]);
   }
@@ -127,8 +120,8 @@ public function testCommentNewCommentsIndicator() {
     // Pretend the data was not present in drupalSettings, i.e. test the
     // separate request to the server.
     $response = $this->renderNewCommentsNodeLinks([$this->node->id()]);
-    $this->assertResponse(200);
-    $json = Json::decode($response);
+    $this->assertEquals(200, $response->getStatusCode());
+    $json = Json::decode($response->getBody());
     $expected = [
       $this->node->id() => [
         'new_comment_count' => 1,
@@ -138,15 +131,30 @@ public function testCommentNewCommentsIndicator() {
     $this->assertIdentical($expected, $json);
 
     // Failing to specify node IDs for the endpoint should return a 404.
-    $this->renderNewCommentsNodeLinks([]);
-    $this->assertResponse(404);
+    $response = $this->renderNewCommentsNodeLinks([]);
+    $this->assertEquals(404, $response->getStatusCode());
 
     // Accessing the endpoint as the anonymous user should return a 403.
     $this->drupalLogout();
-    $this->renderNewCommentsNodeLinks([$this->node->id()]);
-    $this->assertResponse(403);
-    $this->renderNewCommentsNodeLinks([]);
-    $this->assertResponse(403);
+    $response = $this->renderNewCommentsNodeLinks([$this->node->id()]);
+    $this->assertEquals(403, $response->getStatusCode());
+    $response = $this->renderNewCommentsNodeLinks([]);
+    $this->assertEquals(403, $response->getStatusCode());
+  }
+
+  /**
+   * Obtain the HTTP client and set the cookies.
+   *
+   * @return \GuzzleHttp\Client
+   *   The client with BrowserTestBase configuration.
+   */
+  protected function getHttpClient() {
+    // Similar code is also employed to test CSRF tokens.
+    // @see \Drupal\Tests\system\Functional\CsrfRequestHeaderTest::testRouteAccess()
+    $domain = parse_url($this->getUrl(), PHP_URL_HOST);
+    $session_id = $this->getSession()->getCookie($this->getSessionName());
+    $this->cookies = CookieJar::fromArray([$this->getSessionName() => $session_id], $domain);
+    return $this->getSession()->getDriver()->getClient()->getClient();
   }
 
 }
