assertSame(['state' => 'insufficient_data', 'people' => null], $calculator->observed(100, null, true, true)); $this->assertSame(['state' => 'insufficient_data', 'people' => null], $calculator->observed(null, 10, true, true)); $this->assertSame(['state' => 'incomparable', 'people' => null], $calculator->observed(100, 10, false, true)); $this->assertSame(['state' => 'expired', 'people' => null], $calculator->observed(100, 10, true, false)); } public function test_comparable_people_produce_only_an_unvalidated_nonnegative_gap(): void { $calculator = new EducationGapCalculator; $this->assertSame(['state' => 'observed_unvalidated', 'people' => 60], $calculator->observed(100, 40, true, true)); $this->assertSame(0, $calculator->observed(10, 40, true, true)['people']); $this->assertSame(10, $calculator->observed(10, 0, true, true)['people']); } public function test_negative_quantities_are_rejected(): void { $this->expectException(InvalidArgumentException::class); (new EducationGapCalculator)->observed(10, -1, true, true); } }