2026-08-12 00:32:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Tests\Unit\Dashboard\Stats;
|
|
|
|
|
|
|
|
|
|
use App\Dashboard\Stats\ArticlesPerFeed;
|
|
|
|
|
use App\Dashboard\Stats\BreakdownStat;
|
2026-08-12 23:14:19 +02:00
|
|
|
use App\Dashboard\Stats\SeriesStat;
|
2026-08-12 00:32:46 +02:00
|
|
|
use App\Dashboard\Stats\Stat;
|
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
|
|
class StatContractTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
public function test_the_base_contract_only_promises_identity(): void
|
|
|
|
|
{
|
|
|
|
|
$methods = array_map(
|
|
|
|
|
fn (\ReflectionMethod $method): string => $method->getName(),
|
|
|
|
|
(new \ReflectionClass(Stat::class))->getMethods(),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
sort($methods);
|
|
|
|
|
|
|
|
|
|
$this->assertSame(['key', 'label'], $methods);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function test_a_breakdown_stat_is_a_stat(): void
|
|
|
|
|
{
|
|
|
|
|
$this->assertTrue(is_subclass_of(BreakdownStat::class, Stat::class));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function test_articles_per_feed_is_a_breakdown_stat(): void
|
|
|
|
|
{
|
|
|
|
|
$this->assertInstanceOf(BreakdownStat::class, new ArticlesPerFeed);
|
|
|
|
|
}
|
2026-08-12 23:14:19 +02:00
|
|
|
|
|
|
|
|
public function test_a_series_stat_is_a_stat(): void
|
|
|
|
|
{
|
|
|
|
|
$this->assertTrue(is_subclass_of(SeriesStat::class, Stat::class));
|
|
|
|
|
}
|
2026-08-12 00:32:46 +02:00
|
|
|
}
|