Passed
Push — master ( 3bddf7...37f0e3 )
by Max
07:30
created

ManagerTest::testCreateRealDictionary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
declare(strict_types=1);
4
5
namespace EasyDictionary;
6
7
use EasyDictionary\DataProvider\Simple;
8
use EasyDictionary\Dictionary\Simple as SimpleDictionary;
9
use EasyDictionary\Interfaces\ConfigInterface;
10
use EasyDictionary\Interfaces\DataProviderInterface;
11
use EasyDictionary\Interfaces\DictionaryInterface;
12
use PHPUnit\Framework\TestCase;
13
use Psr\SimpleCache\CacheInterface;
14
15
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
16
 * @coversDefaultClass \EasyDictionary\Manager
17
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
18
class ManagerTest extends TestCase
19
{
20
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
21
     * @covers \EasyDictionary\Manager
22
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
23
    public function testClassExistence()
24
    {
25
        self::assertTrue(class_exists('\EasyDictionary\Manager'));
26
    }
27
28
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
29
     * @covers ::__construct
30
     * @covers ::setConfig
31
     * @covers ::getConfig
32
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
33
    public function testSetConfigFromConstructor()
34
    {
35
        $config = $this->createMock(ConfigInterface::class);
36
        $manager = new Manager($config);
0 ignored issues
show
Documentation introduced by
$config is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a null|object<EasyDictiona...rfaces\ConfigInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
37
38
        self::assertEquals($config, $manager->getConfig());
39
    }
40
41
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
42
     * @covers ::__construct
43
     * @covers ::getConfig
44
     * @covers ::get
45
     *
46
     * @expectedException \EasyDictionary\Exception\RuntimeException
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 8 spaces but found 1
Loading history...
47
     * @expectedExceptionMessage Config not found
48
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
49
    public function testGetDictionaryWithoutConfig()
50
    {
51
        $manager = new Manager();
52
        $manager->get('test');
53
    }
54
55
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
56
     * @covers ::__construct
57
     * @covers ::setConfig
58
     * @covers ::getConfig
59
     * @covers ::get
60
     *
61
     * @expectedException \EasyDictionary\Exception\RuntimeException
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 8 spaces but found 1
Loading history...
62
     * @expectedExceptionMessage  Dictionary with key "test" not found
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 1 spaces but found 2
Loading history...
63
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
64
    public function testGetANonExistentDictionary()
65
    {
66
        $config = $this->createMock(ConfigInterface::class);
67
        $manager = new Manager($config);
0 ignored issues
show
Documentation introduced by
$config is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a null|object<EasyDictiona...rfaces\ConfigInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
68
        $manager->get('test');
69
    }
70
71
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
72
     * @covers ::__construct
73
     * @covers ::add
74
     * @covers ::get
75
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
76 View Code Duplication
    public function testAddNewDictionary()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
77
    {
78
        $dictionaryName = 'test';
79
        $dictionary = $this->createMock(DictionaryInterface::class);
80
        $dictionary->method('getName')->willReturn($dictionaryName);
81
82
        $manager = new Manager();
83
        $manager->add($dictionary);
0 ignored issues
show
Documentation introduced by
$dictionary is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\In...es\DictionaryInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
84
85
        self::assertEquals($dictionary, $manager->get($dictionaryName));
86
    }
87
88
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
89
     * @covers ::__construct
90
     * @covers ::add
91
     * @covers ::get
92
     *
93
     * @expectedException \EasyDictionary\Exception\RuntimeException
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 8 spaces but found 1
Loading history...
94
     * @expectedExceptionMessage The dictionary with key "test" already exists
95
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
96 View Code Duplication
    public function testAddDuplicatedDictionary()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
97
    {
98
        $dictionaryName = 'test';
99
        $dictionary = $this->createMock(DictionaryInterface::class);
100
        $dictionary->method('getName')->willReturn($dictionaryName);
101
102
        $manager = new Manager();
103
        $manager->add($dictionary);
0 ignored issues
show
Documentation introduced by
$dictionary is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\In...es\DictionaryInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
104
        $manager->add($dictionary);
0 ignored issues
show
Documentation introduced by
$dictionary is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\In...es\DictionaryInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
105
106
        self::assertEquals($dictionary, $manager->get($dictionaryName));
107
    }
108
109
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
110
     * @covers ::get
111
     * @covers ::add
112
     * @covers ::create
113
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
114
    public function testCreateSimpleDictionary()
115
    {
116
        $cacheMock = $this->createMock(CacheInterface::class);
117
        $dataProviderMock = $this->createMock(DataProviderInterface::class);
118
119
        $dictionaryMock = $this->createMock(DictionaryInterface::class);
120
        $dictionaryMock->method('getName')->willReturn('test');
121
        $dictionaryMock->expects(self::once())->method('getName');
122
        $dictionaryMock->expects(self::once())->method('setDataProvider')->with($dataProviderMock);
123
        $dictionaryMock->expects(self::once())->method('setName');
124
        $dictionaryMock->expects(self::once())->method('setDefaultView')->with(null);
125
        $dictionaryMock->expects(self::once())->method('setSearchFields')->with([]);
126
        $dictionaryMock->expects(self::once())->method('setCache')->with($cacheMock, 1);
127
128
        $config = $this->createMock(ConfigInterface::class);
129
        $config->method('getCache')->with('testCache')->willReturn($cacheMock);
130
        $config->expects(self::once())->method('getDefaultDataProviderClass');
131
        $config->expects(self::once())->method('getDefaultDictionaryClass');
132
        $config->method('getDictionaryConfig')->willReturn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
133
            'test' => [
134
                'cache' => 'testCache',
135
                'cacheTTL' => 1,
136
                'data' => []
137
            ]
138
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
139
140
        $manager = $this->createPartialMock(Manager::class, [
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
141
            'createDictionary',
142
            'createDataProvider',
143
            'getConfig',
144
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
145
146
        $manager->method('createDictionary')->willReturn($dictionaryMock);
147
        $manager->method('createDataProvider')->willReturn($dataProviderMock);
148
        $manager->method('getConfig')->willReturn($config);
149
150
        self::assertEquals($manager->get('test'), $manager->get('test'));
151
    }
152
153
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
154
     * @covers \EasyDictionary\AbstractDictionary
155
     * @covers \EasyDictionary\DataProvider\Simple
156
     * @covers ::<public>
157
     * @covers ::create
158
     * @covers ::createDataProvider
159
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
160
    public function testCreateRealDictionary()
161
    {
162
        $config = $this->createMock(ConfigInterface::class);
163
        $config->expects(self::once())->method('getDefaultDataProviderClass')
164
            ->willReturn(Simple::class);
165
        $config->expects(self::once())->method('getDefaultDictionaryClass')
166
            ->willReturn(SimpleDictionary::class);
167
168
        $config->method('getDictionaryConfig')->willReturn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
169
            'test' => [
170
                'data' => []
171
            ]
172
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
173
174
        $manager = new Manager();
175
        $manager->setConfig($config);
0 ignored issues
show
Documentation introduced by
$config is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\Interfaces\ConfigInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
176
177
        self::assertEquals($manager->get('test'), $manager->get('test'));
178
    }
179
180
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
181
     * @covers ::<public>
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
182
     * @covers ::create
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
183
     * @covers ::createDataProvider
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
184
     * @expectedException \EasyDictionary\Exception\InvalidConfigurationException
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 8 spaces but found 1
Loading history...
185
     * @expectedExceptionMessage Class "/bad/dataprovider/class" not found
186
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
187
    public function testGetExceptionOfUndefinedDataProviderClass()
188
    {
189
        $config = $this->createMock(ConfigInterface::class);
190
        $config->method('getDictionaryConfig')->willReturn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
191
            'test' => [
192
                'data' => [
193
                    'class' => '/bad/dataprovider/class',
194
                ]
195
            ]
196
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
197
198
        $manager = new Manager();
199
        $manager->setConfig($config);
0 ignored issues
show
Documentation introduced by
$config is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\Interfaces\ConfigInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
200
        $manager->get('test');
201
    }
202
203
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
204
     * @covers ::<public>
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
205
     * @covers ::create
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
206
     * @covers ::createDataProvider
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
207
     * @expectedException \EasyDictionary\Exception\InvalidConfigurationException
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 8 spaces but found 1
Loading history...
208
     * @expectedExceptionMessage Class "stdClass" is not implement required interface
209
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
210 View Code Duplication
    public function testGetExceptionOfBadDataProviderClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
211
    {
212
        $config = $this->createMock(ConfigInterface::class);
213
        $config->method('getDictionaryConfig')->willReturn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
214
            'test' => [
215
                'data' => [
216
                    'class' => \stdClass::class,
217
                ]
218
            ]
219
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
220
221
        $manager = new Manager();
222
        $manager->setConfig($config);
0 ignored issues
show
Documentation introduced by
$config is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\Interfaces\ConfigInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
223
        $manager->get('test');
224
    }
225
226
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
227
     * @covers \EasyDictionary\DataProvider\Simple
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
228
     * @covers ::<public>
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
229
     * @covers ::create
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
230
     * @covers ::createDataProvider
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
231
     * @expectedException \EasyDictionary\Exception\InvalidConfigurationException
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 8 spaces but found 1
Loading history...
232
     * @expectedExceptionMessage Class "/bad/dictionary/class" not found
233
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
234 View Code Duplication
    public function testGetExceptionOfUndefinedDictionaryClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
235
    {
236
        $config = $this->createMock(ConfigInterface::class);
237
        $config->method('getDictionaryConfig')->willReturn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
238
            'test' => [
239
                'class' => '/bad/dictionary/class',
240
                'data' => [
241
                    'class' => Simple::class,
242
                ]
243
            ]
244
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
245
246
        $manager = new Manager();
247
        $manager->setConfig($config);
0 ignored issues
show
Documentation introduced by
$config is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\Interfaces\ConfigInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
248
        $manager->get('test');
249
    }
250
251
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
252
     * @covers \EasyDictionary\DataProvider\Simple
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
253
     * @covers ::<public>
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
254
     * @covers ::create
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
255
     * @covers ::createDataProvider
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 19 spaces but found 1
Loading history...
256
     * @expectedException \EasyDictionary\Exception\InvalidConfigurationException
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 8 spaces but found 1
Loading history...
257
     * @expectedExceptionMessage Class "stdClass" not found
258
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
259 View Code Duplication
    public function testGetExceptionOfBadDictionaryClass()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
260
    {
261
        $config = $this->createMock(ConfigInterface::class);
262
        $config->method('getDictionaryConfig')->willReturn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
263
            'test' => [
264
                'class' => \stdClass::class,
265
                'data' => [
266
                    'class' => Simple::class,
267
                ]
268
            ]
269
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
270
271
        $manager = new Manager();
272
        $manager->setConfig($config);
0 ignored issues
show
Documentation introduced by
$config is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<EasyDictionary\Interfaces\ConfigInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
273
        $manager->get('test');
274
    }
275
}
276