Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | public function testAddStubbedDices(): void |
||
16 | { |
||
17 | // Create a stub for the Dice class. |
||
18 | $stub = $this->createMock(Dice::class); |
||
19 | |||
20 | // Configure the stub. |
||
21 | $stub->method('roll') |
||
22 | ->willReturn(6); |
||
23 | $stub->method('getValue') |
||
24 | ->willReturn(6); |
||
25 | |||
26 | $dicehand = new DiceHand(); |
||
27 | $dicehand->add(clone $stub); |
||
28 | $dicehand->add(clone $stub); |
||
29 | $dicehand->roll(); |
||
30 | $res = $dicehand->sum(); |
||
31 | $this->assertEquals(12, $res); |
||
32 | } |
||
54 |