assertSame(7, $result->total()); } public function test_it_reports_a_zero_total_when_empty(): void { $this->assertSame(0, (new BreakdownResult([]))->total()); } public function test_it_calculates_a_row_share_of_the_total(): void { $result = new BreakdownResult([ new Breakdown('A', 3), new Breakdown('B', 1), ]); $this->assertSame(75.0, $result->shareOf($result->rows[0])); $this->assertSame(25.0, $result->shareOf($result->rows[1])); } public function test_it_reports_a_zero_share_when_nothing_was_counted(): void { $result = new BreakdownResult([new Breakdown('A', 0)]); $this->assertSame(0.0, $result->shareOf($result->rows[0])); } }