AttemptWordFinderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 19
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSuccessfullyFindWord() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Crossword\Features\Constructor\Normal;
6
7
use App\Crossword\Features\Constructor\Dictionary\DictionaryWordDto;
8
use App\Crossword\Features\Constructor\Dictionary\Word;
9
use App\Crossword\Features\Constructor\Normal\AttemptWordFinder;
10
use App\Crossword\Features\Constructor\Scanner\Grid\RowMask;
11
use App\Crossword\Features\Constructor\WordFinder;
12
use App\Crossword\Infrastructure\Adapter\Dictionary\InMemoryDictionaryAdapter;
13
use App\Tests\Crossword\CrosswordTestCase;
14
use Psr\Log\NullLogger;
0 ignored issues
show
Bug introduced by
The type Psr\Log\NullLogger 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...
15
16
/**
17
 * @coversDefaultClass \App\Crossword\Features\Constructor\Normal\AttemptWordFinder
18
 */
19
final class AttemptWordFinderTest extends CrosswordTestCase
20
{
21
    /**
22
     * @covers ::find
23
     */
24
    public function testSuccessfullyFindWord(): void
25
    {
26
        $wordDto = new DictionaryWordDto([
27
            'success' => true,
28
            'data' => [['word' => 'test', 'definition' => 'test test']],
29
        ]);
30
        $wordFinder = new WordFinder(new InMemoryDictionaryAdapter(null, $wordDto), new NullLogger());
0 ignored issues
show
Bug introduced by
null of type null is incompatible with the type App\Crossword\Features\L...Adapter\Dictionary\null expected by parameter $languagesDto of App\Crossword\Infrastruc...yAdapter::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        $wordFinder = new WordFinder(new InMemoryDictionaryAdapter(/** @scrutinizer ignore-type */ null, $wordDto), new NullLogger());
Loading history...
31
        $attemptWordFinder = new AttemptWordFinder($wordFinder);
32
33
        $word = $attemptWordFinder->find('en', new RowMask('..s.*'));
34
35
        self::assertInstanceOf(Word::class, $word);
36
        self::assertSame($word->value(), 'test');
37
        self::assertSame($word->definition(), 'test test');
38
    }
39
}
40