function HistoryTest::getNodeReadTimestamps

Same name and namespace in other branches
  1. 9 core/modules/history/tests/src/Functional/HistoryTest.php \Drupal\Tests\history\Functional\HistoryTest::getNodeReadTimestamps()
  2. 10 core/modules/history/tests/src/Functional/HistoryTest.php \Drupal\Tests\history\Functional\HistoryTest::getNodeReadTimestamps()
  3. 11.x core/modules/history/tests/src/Functional/HistoryTest.php \Drupal\Tests\history\Functional\HistoryTest::getNodeReadTimestamps()

Get node read timestamps from the server for the current user.

Parameters

array $node_ids: An array of node IDs.

Return value

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

1 call to HistoryTest::getNodeReadTimestamps()
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 67

Class

HistoryTest
Tests the History endpoints.

Namespace

Drupal\Tests\history\Functional

Code

protected function getNodeReadTimestamps(array $node_ids) {
    // Perform HTTP request.
    $http_client = $this->getHttpClient();
    $url = Url::fromRoute('history.get_last_node_view')->setAbsolute()
        ->toString();
    return $http_client->request('POST', $url, [
        'form_params' => [
            'node_ids' => $node_ids,
        ],
        'cookies' => $this->getSessionCookies(),
        'http_errors' => FALSE,
    ]);
}

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