You are here

protected function MigrateNodeCounterTest::assertNodeCounter in Drupal 9

Same name in this branch
  1. 9 core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php \Drupal\Tests\statistics\Kernel\Migrate\d6\MigrateNodeCounterTest::assertNodeCounter()
  2. 9 core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php \Drupal\Tests\statistics\Kernel\Migrate\d7\MigrateNodeCounterTest::assertNodeCounter()
Same name and namespace in other branches
  1. 8 core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php \Drupal\Tests\statistics\Kernel\Migrate\d7\MigrateNodeCounterTest::assertNodeCounter()

Asserts various aspects of a node counter.

Parameters

int $nid: The node ID.

int $total_count: The expected total count.

int $day_count: The expected day count.

int $timestamp: The expected timestamp.

1 call to MigrateNodeCounterTest::assertNodeCounter()
MigrateNodeCounterTest::testStatisticsSettings in core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php
Tests migration of node counter.

File

core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php, line 72

Class

MigrateNodeCounterTest
Tests the migration of node counter data to Drupal 8.

Namespace

Drupal\Tests\statistics\Kernel\Migrate\d7

Code

protected function assertNodeCounter($nid, $total_count, $day_count, $timestamp) {

  /** @var \Drupal\statistics\StatisticsViewsResult $statistics */
  $statistics = $this->container
    ->get('statistics.storage.node')
    ->fetchView($nid);
  $this
    ->assertSame($total_count, $statistics
    ->getTotalCount());
  $this
    ->assertSame($day_count, $statistics
    ->getDayCount());
  $this
    ->assertSame($timestamp, $statistics
    ->getTimestamp());
}