public function NodeViewCountBaseFunctionalityTest::testAjaxCall in Node view count 8
Tests recording of new nodeviewcount record after AJAX call.
File
- src/
Tests/ NodeViewCountBaseFunctionalityTest.php, line 81
Class
- NodeViewCountBaseFunctionalityTest
- Tests the base functionality of nodeviewcount module.
Namespace
Drupal\nodeviewcount\TestsCode
public function testAjaxCall() {
$this
->sendAjaxStatistics($this->firstTestTrackedNode
->id(), 0);
$this
->sendAjaxStatistics($this->firstTestTrackedNode
->id(), 1);
$result = $this->connection
->select('nodeviewcount', 'nvc')
->fields('nvc', [
'nid',
])
->condition('nvc.nid', $this->firstTestTrackedNode
->id())
->execute()
->fetchAll();
$this
->assertEqual(count($result), 2, 'Verifying that the node counter is incremented.');
}