function MigrateNodeCounterTest::assertNodeCounter

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

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