Files
FreshRSS/tests/app/Models/StatsDAOTest.php
Jam Balaya 271257be42 Fix statistics repartition averages (#8996)
* Fix statistics repartition averages

* Minor code preference

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-07-07 10:42:53 +02:00

19 lines
639 B
PHP

<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class StatsDAOTest extends TestCase {
public static function testCalculateEntryAverageFromRepartition(): void {
self::assertSame(2.0, FreshRSS_StatsDAO::calculateEntryAverageFromRepartition([0, 2, 4]));
}
public static function testCalculateEntryAverageFromEmptyRepartition(): void {
self::assertSame(0.0, FreshRSS_StatsDAO::calculateEntryAverageFromRepartition([]));
}
public static function testCalculateEntryAverageFromZeroRepartition(): void {
self::assertSame(0.0, FreshRSS_StatsDAO::calculateEntryAverageFromRepartition(array_fill(0, 24, 0)));
}
}