DiceGraphicTest::testGetString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
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