1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace App\Tests\Game\Features\Answers; |
6
|
|
|
|
7
|
|
|
use App\Game\Features\Answers\AnswersValidator; |
8
|
|
|
use App\Game\Features\Answers\WrongAnswerException; |
9
|
|
|
use App\Game\Infrastructure\Encoder\Base64Encoder; |
10
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @coversDefaultClass \App\Game\Features\Answers\AnswersValidator |
14
|
|
|
*/ |
15
|
|
|
final class AnswersValidatorTest extends TestCase |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @covers ::validate |
19
|
|
|
*/ |
20
|
|
|
public function testSuccessfullyValidateAnswers(): void |
21
|
|
|
{ |
22
|
|
|
$encoder = new Base64Encoder(); |
23
|
|
|
$answers = [ |
24
|
|
|
['index' => 0, 'letter' => $encoder->encode('t'), 'value' => 't'], |
25
|
|
|
['index' => 1, 'letter' => $encoder->encode('e'), 'value' => 'e'], |
26
|
|
|
['index' => 2, 'letter' => $encoder->encode('s'), 'value' => 's'], |
27
|
|
|
['index' => 3, 'letter' => $encoder->encode('t'), 'value' => 't'], |
28
|
|
|
]; |
29
|
|
|
|
30
|
|
|
$answersValidator = new AnswersValidator($encoder); |
31
|
|
|
$answersValidator->validate($answers); |
32
|
|
|
|
33
|
|
|
self::assertTrue(true); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @covers ::validate |
38
|
|
|
*/ |
39
|
|
|
public function testRaiseExceptionWhenAnswersIsWrong(): void |
40
|
|
|
{ |
41
|
|
|
$this->expectException(WrongAnswerException::class); |
42
|
|
|
|
43
|
|
|
$encoder = new Base64Encoder(); |
44
|
|
|
$answers = [ |
45
|
|
|
['index' => 0, 'letter' => $encoder->encode('t'), 'value' => 't'], |
46
|
|
|
['index' => 1, 'letter' => $encoder->encode('e'), 'value' => 'e'], |
47
|
|
|
['index' => 2, 'letter' => $encoder->encode('s'), 'value' => 'k'], |
48
|
|
|
['index' => 3, 'letter' => $encoder->encode('t'), 'value' => 'e'], |
49
|
|
|
]; |
50
|
|
|
|
51
|
|
|
$answersValidator = new AnswersValidator($encoder); |
52
|
|
|
$answersValidator->validate($answers); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
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