function MigrateNodeCounterTest::assertNodeCounter

Same name in this branch
  1. 11.x core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php \Drupal\Tests\statistics\Kernel\Migrate\d6\MigrateNodeCounterTest::assertNodeCounter()
Same name in other branches
  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()
  3. 8.9.x core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php \Drupal\Tests\statistics\Kernel\Migrate\d6\MigrateNodeCounterTest::assertNodeCounter()
  4. 8.9.x core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php \Drupal\Tests\statistics\Kernel\Migrate\d7\MigrateNodeCounterTest::assertNodeCounter()
  5. 10 core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php \Drupal\Tests\statistics\Kernel\Migrate\d6\MigrateNodeCounterTest::assertNodeCounter()
  6. 10 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.

@internal

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 81

Class

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

Namespace

Drupal\Tests\statistics\Kernel\Migrate\d7

Code

protected function assertNodeCounter(int $nid, int $total_count, int $day_count, int $timestamp) : void {
    
    /** @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());
}

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