You are here

protected function NodeViewCountTestBase::sendAjaxStatistics in Node view count 8

Send AJAX request to '/nodeviewcount/updateCounter' for updating stats.

Parameters

int $nid: Node id to track.

int $uid: Id of user who viewed the node.

6 calls to NodeViewCountTestBase::sendAjaxStatistics()
NodeViewCountBaseFunctionalityTest::testAjaxCall in src/Tests/NodeViewCountBaseFunctionalityTest.php
Tests recording of new nodeviewcount record after AJAX call.
NodeViewCountBaseFunctionalityTest::testExpiredLogs in src/Tests/NodeViewCountBaseFunctionalityTest.php
Tests that cron clears old nodeviewcount records.
NodeViewCountHooksTest::testNodeviewcountInsertHook in src/Tests/NodeViewCountHooksTest.php
Tests hook_nodeviewcount_insert().
NodeViewCountViewsTest::testLastViewsPerUserView in src/Tests/NodeViewCountViewsTest.php
Tests Last views per user view.
NodeViewCountViewsTest::testNodeViewsCountStatisticsView in src/Tests/NodeViewCountViewsTest.php
Tests Node views count statistics view.

... See full list

File

src/Tests/NodeViewCountTestBase.php, line 152

Class

NodeViewCountTestBase
Defines a base class for testing the nodeviewcount module.

Namespace

Drupal\nodeviewcount\Tests

Code

protected function sendAjaxStatistics($nid, $uid) {
  global $base_url;
  $stats_path = $base_url . '/nodeviewcount/updateCounter';
  $post = [
    'nid' => $nid,
    'uid' => $uid,
  ];
  $this->client
    ->post($stats_path, [
    'form_params' => $post,
  ]);
}