1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace App\Tests\Crossword\Features\Constructor\Scaner\Grid; |
6
|
|
|
|
7
|
|
|
use App\Crossword\Features\Constructor\Scanner\Exception\CellNotFoundException; |
8
|
|
|
use App\Crossword\Features\Constructor\Scanner\Grid\Cell; |
9
|
|
|
use App\Crossword\Features\Constructor\Scanner\Grid\Coordinate; |
10
|
|
|
use App\Crossword\Features\Constructor\Scanner\Grid\Row; |
11
|
|
|
use Generator; |
12
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @coversDefaultClass \App\Crossword\Features\Constructor\Scanner\Grid\Row |
16
|
|
|
*/ |
17
|
|
|
final class RowTest extends TestCase |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @covers ::cell |
21
|
|
|
*/ |
22
|
|
|
public function testSearchCellByIndex(): void |
23
|
|
|
{ |
24
|
|
|
$row = new Row(new Cell(new Coordinate(1, 1), 't')); |
25
|
|
|
$cell = $row->cell(0); |
26
|
|
|
|
27
|
|
|
self::assertInstanceOf(Cell::class, $cell); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @covers ::remove |
32
|
|
|
*/ |
33
|
|
|
public function testRemoveCellByIndex(): void |
34
|
|
|
{ |
35
|
|
|
$this->expectException(CellNotFoundException::class); |
36
|
|
|
|
37
|
|
|
$row = new Row(new Cell(new Coordinate(1, 1), 't')); |
38
|
|
|
$cell = $row->cell(0); |
39
|
|
|
|
40
|
|
|
self::assertInstanceOf(Cell::class, $cell); |
41
|
|
|
|
42
|
|
|
$row = $row->remove(0); |
43
|
|
|
$row->cell(0); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @covers ::mask |
48
|
|
|
* |
49
|
|
|
* @dataProvider maskDataProvider |
50
|
|
|
*/ |
51
|
|
|
public function testBuildMaskByRow(string $mask, string $limit, array $cells): void |
52
|
|
|
{ |
53
|
|
|
$row = new Row(...$cells); |
54
|
|
|
|
55
|
|
|
self::assertSame($row->mask()->query(), $mask); |
56
|
|
|
self::assertSame($row->mask()->limit(), $limit); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function maskDataProvider(): Generator |
60
|
|
|
{ |
61
|
|
|
yield '..s' => [ |
62
|
|
|
'...s.*', |
63
|
|
|
'{0,4}', |
64
|
|
|
[ |
65
|
|
|
new Cell(new Coordinate(1, 2), ''), |
66
|
|
|
new Cell(new Coordinate(1, 2), ''), |
67
|
|
|
new Cell(new Coordinate(1, 3), ''), |
68
|
|
|
new Cell(new Coordinate(1, 4), 's'), |
69
|
|
|
] |
70
|
|
|
]; |
71
|
|
|
|
72
|
|
|
yield '.s.' => [ |
73
|
|
|
'..s.*', |
74
|
|
|
'{0,4}', |
75
|
|
|
[ |
76
|
|
|
new Cell(new Coordinate(1, 2), ''), |
77
|
|
|
new Cell(new Coordinate(1, 2), ''), |
78
|
|
|
new Cell(new Coordinate(1, 3), 's'), |
79
|
|
|
new Cell(new Coordinate(1, 4), ''), |
80
|
|
|
] |
81
|
|
|
]; |
82
|
|
|
|
83
|
|
|
yield '.s..' => [ |
84
|
|
|
'.s.*', |
85
|
|
|
'{0,4}', |
86
|
|
|
[ |
87
|
|
|
new Cell(new Coordinate(1, 2), ''), |
88
|
|
|
new Cell(new Coordinate(1, 3), 's'), |
89
|
|
|
new Cell(new Coordinate(1, 4), ''), |
90
|
|
|
new Cell(new Coordinate(1, 5), ''), |
91
|
|
|
] |
92
|
|
|
]; |
93
|
|
|
|
94
|
|
|
yield '....' => [ |
95
|
|
|
'.*', |
96
|
|
|
'{0,4}', |
97
|
|
|
[ |
98
|
|
|
new Cell(new Coordinate(1, 1), ''), |
99
|
|
|
new Cell(new Coordinate(1, 2), ''), |
100
|
|
|
new Cell(new Coordinate(1, 3), ''), |
101
|
|
|
new Cell(new Coordinate(1, 4), ''), |
102
|
|
|
] |
103
|
|
|
]; |
104
|
|
|
|
105
|
|
|
yield 'a...' => [ |
106
|
|
|
'a.*', |
107
|
|
|
'{0,4}', |
108
|
|
|
[ |
109
|
|
|
new Cell(new Coordinate(1, 1), 'a'), |
110
|
|
|
new Cell(new Coordinate(1, 2), ''), |
111
|
|
|
new Cell(new Coordinate(1, 3), ''), |
112
|
|
|
new Cell(new Coordinate(1, 4), ''), |
113
|
|
|
] |
114
|
|
|
]; |
115
|
|
|
|
116
|
|
|
yield '.a.' => [ |
117
|
|
|
'.a.*', |
118
|
|
|
'{0,4}', |
119
|
|
|
[ |
120
|
|
|
new Cell(new Coordinate(1, 1), ''), |
121
|
|
|
new Cell(new Coordinate(1, 2), 'a'), |
122
|
|
|
new Cell(new Coordinate(1, 3), ''), |
123
|
|
|
new Cell(new Coordinate(1, 4), ''), |
124
|
|
|
] |
125
|
|
|
]; |
126
|
|
|
|
127
|
|
|
yield '..a.' => [ |
128
|
|
|
'..a.*', |
129
|
|
|
'{0,4}', |
130
|
|
|
[ |
131
|
|
|
new Cell(new Coordinate(1, 1), ''), |
132
|
|
|
new Cell(new Coordinate(1, 2), ''), |
133
|
|
|
new Cell(new Coordinate(1, 3), 'a'), |
134
|
|
|
new Cell(new Coordinate(1, 4), ''), |
135
|
|
|
] |
136
|
|
|
]; |
137
|
|
|
|
138
|
|
|
yield 'a..a' => [ |
139
|
|
|
'a..a.*', |
140
|
|
|
'{0,4}', |
141
|
|
|
[ |
142
|
|
|
new Cell(new Coordinate(1, 1), 'a'), |
143
|
|
|
new Cell(new Coordinate(1, 2), ''), |
144
|
|
|
new Cell(new Coordinate(1, 3), ''), |
145
|
|
|
new Cell(new Coordinate(1, 4), 'a'), |
146
|
|
|
] |
147
|
|
|
]; |
148
|
|
|
} |
149
|
|
|
} |
150
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths