
| Current Path : /var/www/html1/testsite/web/core/modules/statistics/tests/src/Kernel/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/testsite/web/core/modules/statistics/tests/src/Kernel/StatisticsDeprecationsTest.php |
<?php
namespace Drupal\Tests\statistics\Kernel;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests deprecations in the Statistics module.
*
* @group statistics
* @group legacy
*/
class StatisticsDeprecationsTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['statistics'];
/**
* @expectedDeprecation statistics_get() is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use Drupal::service('statistics.storage.node')->fetchView() instead. See https://www.drupal.org/node/2778245
*/
public function testStatisticsGetDeprecation() {
$this->installSchema('statistics', 'node_counter');
$this->container->get('statistics.storage.node')->recordView(1);
$expected_timestamp = $this->container->get('datetime.time')->getRequestTime();
$this->assertSame([
'totalcount' => 1,
'daycount' => 1,
'timestamp' => $expected_timestamp,
], statistics_get(1));
}
}