You are here

protected function HistoryTest::markNodeAsRead in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/history/tests/src/Functional/HistoryTest.php \Drupal\Tests\history\Functional\HistoryTest::markNodeAsRead()

Mark a node as read for the current user.

Parameters

int $node_id: A node ID.

Return value

\Psr\Http\Message\ResponseInterface The response body.

1 call to HistoryTest::markNodeAsRead()
HistoryTest::testHistory in core/modules/history/tests/src/Functional/HistoryTest.php
Verifies that the history endpoints work.

File

core/modules/history/tests/src/Functional/HistoryTest.php, line 91

Class

HistoryTest
Tests the History endpoints.

Namespace

Drupal\Tests\history\Functional

Code

protected function markNodeAsRead($node_id) {
  $http_client = $this
    ->getHttpClient();
  $url = Url::fromRoute('history.read_node', [
    'node' => $node_id,
  ], [
    'absolute' => TRUE,
  ])
    ->toString();
  return $http_client
    ->request('POST', $url, [
    'cookies' => $this
      ->getSessionCookies(),
    'http_errors' => FALSE,
  ]);
}