Passed
Push — master ( 35eebd...7b8a1a )
by Roman
16:45
created

GridTest::testSuccessfullyFillCrossLine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 21
ccs 0
cts 8
cp 0
crap 2
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Game\Features\GamePlay\Crossword;
6
7
use App\Game\Features\GamePlay\Crossword\Grid;
8
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * @coversDefaultClass \App\Game\Features\GamePlay\Crossword\Grid
12
 */
13
final class GridTest extends TestCase
14
{
15
    /**
16
     * @covers ::fillLetter
17
     */
18
    public function testSuccessfullyFillLetter(): void
19
    {
20
        $crossword = [
21
            [
22
                'line' => [
23
                    ['coordinate' => '1.1', 'letter' => null],
24
                ],
25
                'word' => ['definition' => 'test']
26
            ]
27
        ];
28
29
        $cell = [
30
            'coordinate' => '1.1',
31
            'letter' => 't'
32
        ];
33
34
        $grid = new Grid($crossword);
35
        $grid->fillLetter($cell);
36
37
        self::assertSame(['1.1' => ['letter' => 't', 'coordinate' => ['x' => 1, 'y' => 1]]], $grid->field());
38
    }
39
40
    /**
41
     * @covers ::fillCrossLineNumbers
42
     */
43
    public function testSuccessfullyFillCrossLine(): void
44
    {
45
        $crossword = [
46
            [
47
                'line' => [
48
                    ['coordinate' => '1.1', 'index' => '2'],
49
                ],
50
                'word' => ['definition' => 'test']
51
            ]
52
        ];
53
54
        $cell = ['coordinate' => '1.1'];
55
56
        $grid = new Grid($crossword);
57
        $grid->fillCrossLineNumbers($cell, 2);
58
59
        self::assertSame(3, $grid->field()['1.1']['index']);
60
61
        $grid->fillCrossLineNumbers($cell, 3);
62
63
        self::assertSame('3/4', $grid->field()['1.1']['index']);
64
    }
65
66
    /**
67
     * @covers ::fillLineNumbers
68
     */
69
    public function testSuccessfullyFillLineNumbers(): void
70
    {
71
        $crossword = [
72
            [
73
                'line' => [
74
                    ['coordinate' => '1.1', 'number' => '2'],
75
                ],
76
                'word' => ['definition' => 'test']
77
            ]
78
        ];
79
80
        $cell = ['coordinate' => '1.1'];
81
82
        $grid = new Grid($crossword);
83
        $grid->fillLineNumbers($cell, 2);
84
85
        self::assertSame(3, $grid->field()['1.1']['number']);
86
87
        $grid->fillLineNumbers($cell, 3);
88
89
        self::assertSame('3/4', $grid->field()['1.1']['number']);
90
    }
91
}
92