function HistoryTest::markNodeAsRead

Same name in other branches
  1. 9 core/modules/history/tests/src/Functional/HistoryTest.php \Drupal\Tests\history\Functional\HistoryTest::markNodeAsRead()
  2. 8.9.x core/modules/history/tests/src/Functional/HistoryTest.php \Drupal\Tests\history\Functional\HistoryTest::markNodeAsRead()
  3. 11.x 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 94

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,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.