You are here

public function NodeViewCountHooksTest::testNodeviewcountInsertHook in Node view count 8

Tests hook_nodeviewcount_insert().

File

src/Tests/NodeViewCountHooksTest.php, line 22

Class

NodeViewCountHooksTest
Tests hooks of nodeviewcount module.

Namespace

Drupal\nodeviewcount\Tests

Code

public function testNodeviewcountInsertHook() {
  $this
    ->sendAjaxStatistics($this->firstTestTrackedNode
    ->id(), 0);
  $message = $this->connection
    ->select('watchdog', 'wd')
    ->fields('wd', [
    'message',
  ])
    ->condition('type', 'nodeviewcount')
    ->execute()
    ->fetchField();
  $this
    ->assertEqual($message, $this->firstTestTrackedNode
    ->getTitle(), 'Nodeviewcount hook is called.');
}