expectException(InvalidArgumentException::class); new SeriesResult( ['2026-07-01', '2026-07-02', '2026-07-03'], [new Series('Approved', [1, 2])], ); } public function test_a_series_result_accepts_multiple_series_that_all_align(): void { $result = new SeriesResult( ['2026-07-01', '2026-07-02'], [ new Series('Approved', [1, 2]), new Series('Rejected', [0, 1]), ], ); $this->assertSame(['2026-07-01', '2026-07-02'], $result->labels); $this->assertCount(2, $result->series); } public function test_a_too_wide_result_reports_itself_as_too_wide(): void { $result = SeriesResult::tooWide(); $this->assertTrue($result->isTooWide()); } public function test_a_too_wide_result_is_not_reported_as_merely_empty(): void { $result = SeriesResult::tooWide(); $this->assertFalse($result->isEmpty()); } public function test_an_empty_but_valid_result_is_not_reported_as_too_wide(): void { $result = new SeriesResult([], []); $this->assertFalse($result->isTooWide()); } public function test_an_empty_but_valid_result_reports_itself_as_empty(): void { $result = new SeriesResult([], []); $this->assertTrue($result->isEmpty()); } public function test_a_result_whose_series_are_all_zero_has_no_data(): void { $result = new SeriesResult( ['2026-07-01', '2026-07-02'], [new Series('Fetched', [0, 0]), new Series('Published', [0, 0])], ); $this->assertTrue($result->hasNoData()); } public function test_a_result_with_any_non_zero_value_has_data(): void { $result = new SeriesResult( ['2026-07-01', '2026-07-02'], [new Series('Fetched', [0, 0]), new Series('Published', [0, 1])], ); $this->assertFalse($result->hasNoData()); } public function test_a_result_of_only_nulls_has_no_data(): void { $result = new SeriesResult( ['2026-07-01', '2026-07-02'], [new Series('Approval Rate', [null, null])], ); $this->assertTrue($result->hasNoData()); } public function test_a_zero_count_is_an_absence_of_data(): void { $result = new SeriesResult( ['2026-07-01', '2026-07-02'], [new Series('Fetched', [null, 0])], ); $this->assertTrue($result->hasNoData()); } public function test_a_zero_is_data_when_the_series_says_zero_is_meaningful(): void { $result = new SeriesResult( ['2026-07-01', '2026-07-02'], [new Series('Approval Rate', [null, 0.0], zeroIsMeaningful: true)], ); $this->assertFalse($result->hasNoData()); } public function test_a_meaningful_zero_series_of_only_nulls_still_has_no_data(): void { $result = new SeriesResult( ['2026-07-01', '2026-07-02'], [new Series('Approval Rate', [null, null], zeroIsMeaningful: true)], ); $this->assertTrue($result->hasNoData()); } }