DiceGraphicTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAsString() 0 9 1
A testInheritanceFromDice() 0 4 1
1
<?php
2
3
namespace App\Tests\Dice;
4
5
use PHPUnit\Framework\TestCase;
6
use App\Dice\DiceGraphic;
7
8
/**
9
 * Test cases for class DiceGraphic.
10
 */
11
class DiceGraphicTest extends TestCase
12
{
13
    /**
14
     * Test that the DiceGraphic class is a subclass of Dice.
15
     */
16
    public function testInheritanceFromDice(): void
17
    {
18
        $dice = new DiceGraphic();
19
        $this->assertInstanceOf(\App\Dice\Dice::class, $dice);
20
    }
21
22
    /**
23
     * Test that getAsString returns a valid Unicode symbol
24
     * representing the rolled dice value.
25
     */
26
    public function testGetAsString(): void
27
    {
28
        $dice = new DiceGraphic();
29
        $dice->roll();
30
31
        $representation = ['⚀', '⚁', '⚂', '⚃', '⚄', '⚅'];
32
        $symbol = $dice->getAsString();
33
34
        $this->assertContains($symbol, $representation);
35
    }
36
}
37