1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace App\Tests\Game\Features\GamePlay; |
6
|
|
|
|
7
|
|
|
use App\Game\Features\GamePlay\Crossword\CrosswordConstructor; |
8
|
|
|
use App\Game\Features\GamePlay\Crossword\CrosswordDto; |
9
|
|
|
use App\Game\Features\GamePlay\Crossword\CrosswordInterface; |
10
|
|
|
use App\Game\Features\GamePlay\Crossword\GameDto; |
11
|
|
|
use App\Game\Features\GamePlay\Crossword\Type; |
12
|
|
|
use App\Game\Features\GamePlay\GamePlay; |
13
|
|
|
use App\Game\Features\GamePlay\Player\Role; |
14
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
15
|
|
|
use Psr\Log\NullLogger; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @coversDefaultClass \App\Game\Features\GamePlay\GamePlay |
19
|
|
|
*/ |
20
|
|
|
final class GamePlayTest extends TestCase |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @covers ::new |
24
|
|
|
*/ |
25
|
|
|
public function testCreateNewGame(): void |
26
|
|
|
{ |
27
|
|
|
$crossword = new CrosswordDto([ |
28
|
|
|
'success' => true, |
29
|
|
|
'data' => [ |
30
|
|
|
[ |
31
|
|
|
'line' => [ |
32
|
|
|
['coordinate' => '1.1', 'letter' => 't'], |
33
|
|
|
['coordinate' => '1.2', 'letter' => 'e'], |
34
|
|
|
['coordinate' => '1.3', 'letter' => 's'], |
35
|
|
|
['coordinate' => '1.4', 'letter' => 't'], |
36
|
|
|
], |
37
|
|
|
'word' => ['definition' => 'test'] |
38
|
|
|
] |
39
|
|
|
] |
40
|
|
|
]); |
41
|
|
|
|
42
|
|
|
$crosswordMock = $this->createMock(CrosswordInterface::class); |
43
|
|
|
$crosswordMock->method('construct')->willReturn($crossword); |
44
|
|
|
|
45
|
|
|
$gamePlay = new GamePlay(new CrosswordConstructor($crosswordMock, new NullLogger())); |
46
|
|
|
$gameDto = $gamePlay->new( |
47
|
|
|
'en', |
48
|
|
|
Type::byRole(new Role(Role::SIMPLE_PLAYER)), |
49
|
|
|
3 * 2 |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
self::assertInstanceOf(GameDto::class, $gameDto); |
53
|
|
|
self::assertSame(4, $gameDto->size()); |
54
|
|
|
self::assertSame(['test'], $gameDto->definitions()); |
55
|
|
|
self::assertSame('t', $gameDto->grid()['1.1']['letter']); |
56
|
|
|
self::assertSame('e', $gameDto->grid()['1.2']['letter']); |
57
|
|
|
self::assertSame('s', $gameDto->grid()['1.3']['letter']); |
58
|
|
|
self::assertSame('t', $gameDto->grid()['1.4']['letter']); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
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