class StatisticsViewsResultTest in Drupal 8
Same name and namespace in other branches
- 9 core/modules/statistics/tests/src/Unit/StatisticsViewsResultTest.php \Drupal\Tests\statistics\Unit\StatisticsViewsResultTest
- 10 core/modules/statistics/tests/src/Unit/StatisticsViewsResultTest.php \Drupal\Tests\statistics\Unit\StatisticsViewsResultTest
@coversDefaultClass \Drupal\statistics\StatisticsViewsResult @group statistics
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\statistics\Unit\StatisticsViewsResultTest
Expanded class hierarchy of StatisticsViewsResultTest
File
- core/
modules/ statistics/ tests/ src/ Unit/ StatisticsViewsResultTest.php, line 12
Namespace
Drupal\Tests\statistics\UnitView source
class StatisticsViewsResultTest extends UnitTestCase {
/**
* Tests migration of node counter.
*
* @covers ::__construct
*
* @dataProvider providerTestStatisticsCount
*/
public function testStatisticsCount($total_count, $day_count, $timestamp) {
$statistics = new StatisticsViewsResult($total_count, $day_count, $timestamp);
$this
->assertSame((int) $total_count, $statistics
->getTotalCount());
$this
->assertSame((int) $day_count, $statistics
->getDayCount());
$this
->assertSame((int) $timestamp, $statistics
->getTimestamp());
}
public function providerTestStatisticsCount() {
return [
[
2,
0,
1421727536,
],
[
1,
0,
1471428059,
],
[
1,
1,
1478755275,
],
[
'1',
'1',
'1478755275',
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
StatisticsViewsResultTest:: |
public | function | ||
StatisticsViewsResultTest:: |
public | function | Tests migration of node counter. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 340 |