ConstructorFactoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 20
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSuccessfullyCreateConstructor() 0 7 1
A typesDataProvider() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Crossword\Features\Constructor;
6
7
use App\Crossword\Features\Constructor\ConstructorFactory;
8
use App\Crossword\Features\Constructor\Figured\FiguredConstructor;
9
use App\Crossword\Features\Constructor\Normal\NormalConstructor;
10
use App\Crossword\Features\Constructor\Type\Type;
11
use App\Crossword\Features\Constructor\WordFinder;
12
use App\Crossword\Infrastructure\Adapter\Dictionary\InMemoryDictionaryAdapter;
13
use App\Tests\Crossword\CrosswordTestCase;
14
use Generator;
15
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...
16
17
/**
18
 * @coversDefaultClass \App\Crossword\Features\Constructor\Figured\FiguredConstructor
19
 */
20
final class ConstructorFactoryTest extends CrosswordTestCase
21
{
22
    /**
23
     * @covers ::build
24
     *
25
     * @dataProvider typesDataProvider
26
     */
27
    public function testSuccessfullyCreateConstructor(Type $type, string $result): void
28
    {
29
        $wordFinder = new WordFinder(new InMemoryDictionaryAdapter(null, null), 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

29
        $wordFinder = new WordFinder(new InMemoryDictionaryAdapter(/** @scrutinizer ignore-type */ null, null), new NullLogger());
Loading history...
Bug introduced by
null of type null is incompatible with the type App\Crossword\Features\C...Adapter\Dictionary\null expected by parameter $wordDto 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

29
        $wordFinder = new WordFinder(new InMemoryDictionaryAdapter(null, /** @scrutinizer ignore-type */ null), new NullLogger());
Loading history...
30
        $factory = new ConstructorFactory($wordFinder);
31
        $class = $factory->create($type);
32
33
        self::assertInstanceOf($result, $class);
34
    }
35
36
    public function typesDataProvider(): Generator
37
    {
38
        yield 'Create normal constructor' => [Type::normal(), NormalConstructor::class];
39
        yield 'Create figure constructor' => [Type::figure(), FiguredConstructor::class];
40
    }
41
}
42