test: couverture 100% Service - branche entryDate < start dans computeUptimeRatio
- testComputeUptimeRatioEntryBeforeStart : ServiceStatusHistory avec createdAt à -60 jours (via ReflectionProperty), couvre la branche entryDate = start quand l'entrée est antérieure à la période de calcul - Résultat : 100% (22/22 methods, 54/54 lines) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,18 @@ class ServiceTest extends TestCase
|
||||
$this->assertLessThanOrEqual(100.0, $ratio);
|
||||
}
|
||||
|
||||
public function testComputeUptimeRatioEntryBeforeStart(): void
|
||||
{
|
||||
$service = $this->createService();
|
||||
$oldEntry = new ServiceStatusHistory($service, 'down');
|
||||
$ref = new \ReflectionProperty($oldEntry, 'createdAt');
|
||||
$ref->setValue($oldEntry, new \DateTimeImmutable('-60 days'));
|
||||
|
||||
$ratio = $service->computeUptimeRatio([$oldEntry], 30);
|
||||
$this->assertGreaterThanOrEqual(0.0, $ratio);
|
||||
$this->assertLessThanOrEqual(100.0, $ratio);
|
||||
}
|
||||
|
||||
public function testComputeUptimeRatioEmpty(): void
|
||||
{
|
||||
$service = $this->createService();
|
||||
|
||||
Reference in New Issue
Block a user