DiceGraphicTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetString() 0 9 1
A testCreateObject() 0 7 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
     * testCreateObject
15
     *
16
     * Construct object and verify that the object has the expected
17
     * properties, use no arguments.
18
     *
19
     * @return void
20
     */
21
    public function testCreateObject(): void
22
    {
23
        $diceGraphic = new DiceGraphic();
24
        $this->assertInstanceOf(DiceGraphic::class, $diceGraphic);
25
26
        $res = $diceGraphic->getString();
27
        $this->assertNotEmpty($res);
28
    }
29
30
    /**
31
     * testGetString
32
     *
33
     * Test the toString method
34
     *
35
     * @return void
36
     */
37
    public function testGetString(): void
38
    {
39
        $stub = $this->createMock(DiceGraphic::class);
40
41
        // Configure the stub.
42
        $stub->method('getString')
43
            ->willReturn('⚅');
44
45
        $this->assertEquals('⚅', $stub->getString());
46
    }
47
}
48