Completed
Push — refonte ( 64e01a...7173e3 )
by Arnaud
03:31
created

testBeforeConfigurationWithoutFields()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 81

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 81
rs 8.4145
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace LAG\AdminBundle\Tests\AdminBundle\Event\Subscriber;
4
5
use Doctrine\Bundle\DoctrineBundle\Registry;
6
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
7
use Doctrine\ORM\EntityManager;
8
use Doctrine\ORM\Mapping\ClassMetadataFactory;
9
use LAG\AdminBundle\Action\Event\ActionEvents;
10
use LAG\AdminBundle\Action\Event\BeforeConfigurationEvent;
11
use LAG\AdminBundle\Admin\AdminInterface;
12
use LAG\AdminBundle\Admin\Configuration\AdminConfiguration;
13
use LAG\AdminBundle\Admin\Event\AdminCreateEvent;
14
use LAG\AdminBundle\Admin\Event\AdminEvents;
15
use LAG\AdminBundle\Application\Configuration\ApplicationConfiguration;
16
use LAG\AdminBundle\Application\Configuration\ApplicationConfigurationStorage;
17
use LAG\AdminBundle\Event\Subscriber\ExtraConfigurationSubscriber;
18
use LAG\AdminBundle\Tests\AdminTestBase;
19
use LAG\AdminBundle\Tests\Entity\TestSimpleEntity;
20
21
class ExtraConfigurationSubscriberTest extends AdminTestBase
22
{
23
    /**
24
     * ExtraConfigurationSubscriber SHOULD subscribe to the Admin creation and the Action creation event.
25
     */
26
    public function testGetSubscribedEvents()
27
    {
28
        $subscribedEvents = ExtraConfigurationSubscriber::getSubscribedEvents();
29
        
30
        $this->assertArrayHasKey(AdminEvents::ADMIN_CREATE, $subscribedEvents);
31
        $this->assertArrayHasKey(ActionEvents::BEFORE_CONFIGURATION, $subscribedEvents);
32
        $this->assertContains('beforeActionConfiguration', $subscribedEvents);
33
        $this->assertContains('adminCreate', $subscribedEvents);
34
    }
35
    
36
    /**
37
     * With extra configuration disabled, adminCreate method SHOULD not modify the configuration.
38
     */
39 View Code Duplication
    public function testAdminCreateWithoutExtraConfiguration()
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...
40
    {
41
        $doctrine = $this->getMockWithoutConstructor(Registry::class);
42
        $event = $this->getMockWithoutConstructor(AdminCreateEvent::class);
43
        $event
44
            ->expects($this->never())
45
            ->method('setAdminConfiguration')
46
        ;
47
        $storage = $this->getMockWithoutConstructor(ApplicationConfigurationStorage::class);
48
        
49
        $subscriber = new ExtraConfigurationSubscriber(
0 ignored issues
show
Bug introduced by
The call to ExtraConfigurationSubscriber::__construct() misses a required argument $configurationFactory.

This check looks for function calls that miss required arguments.

Loading history...
50
            false,
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a object<LAG\AdminBundle\C...onConfigurationStorage>.

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...
51
            $doctrine,
0 ignored issues
show
Documentation introduced by
$doctrine is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

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...
52
            $storage
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<LAG\AdminBundle\R...rce\ResourceCollection>.

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...
53
        );
54
        $subscriber->adminCreate($event);
0 ignored issues
show
Bug introduced by
The method adminCreate() does not seem to exist on object<LAG\AdminBundle\E...onfigurationSubscriber>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
55
    }
56
    
57
    /**
58
     * with extra configuration enabled, adminCreate method SHOULD fill action configuration if it is empty.
59
     */
60
    public function testAdminCreateWithExtraConfiguration()
61
    {
62
        $doctrine = $this->getMockWithoutConstructor(Registry::class);
63
        $event = $this->getMockWithoutConstructor(AdminCreateEvent::class);
64
        $event
65
            ->expects($this->once())
66
            ->method('getAdminConfiguration')
67
            ->willReturn([
68
                'my_config' => [
69
                    'a_normal_key' => 'a_value',
70
                ],
71
            ])
72
        ;
73
        $event
74
            ->expects($this->once())
75
            ->method('setAdminConfiguration')
76
            ->with([
77
                'my_config' => [
78
                    'a_normal_key' => 'a_value',
79
                ],
80
                'actions' => [
81
                    'create' => [],
82
                    'list' => [],
83
                    'edit' => [],
84
                    'delete' => [],
85
                ]
86
            ])
87
        ;
88
        $storage = $this->getMockWithoutConstructor(ApplicationConfigurationStorage::class);
89
        
90
        $subscriber = new ExtraConfigurationSubscriber(
0 ignored issues
show
Bug introduced by
The call to ExtraConfigurationSubscriber::__construct() misses a required argument $configurationFactory.

This check looks for function calls that miss required arguments.

Loading history...
91
            true,
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a object<LAG\AdminBundle\C...onConfigurationStorage>.

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...
92
            $doctrine,
0 ignored issues
show
Documentation introduced by
$doctrine is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

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...
93
            $storage
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<LAG\AdminBundle\R...rce\ResourceCollection>.

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...
94
        );
95
        $subscriber->adminCreate($event);
0 ignored issues
show
Bug introduced by
The method adminCreate() does not seem to exist on object<LAG\AdminBundle\E...onfigurationSubscriber>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
96
    }
97
98
    public function testMenuConfiguration()
99
    {
100
        $doctrine = $this->getMockWithoutConstructor(Registry::class);
101
        $adminConfiguration = $this->getMockWithoutConstructor(AdminConfiguration::class);
102
        $adminConfiguration
103
            ->method('getParameter')
104
            ->willReturnMap([
105
                ['actions', [
106
                    'list',
107
                    'create',
108
                    'edit',
109
                    'delete',
110
                ]],
111
            ])
112
        ;
113
        $admin = $this->getMockWithoutConstructor(AdminInterface::class);
114
        $admin
115
            ->expects($this->exactly(2))
116
            ->method('getConfiguration')
117
            ->willReturn($adminConfiguration)
118
        ;
119
        $admin
120
            ->method('getName')
121
            ->willReturn('my_admin')
122
        ;
123
        
124
        $event = $this->getMockWithoutConstructor(BeforeConfigurationEvent::class);
125
        $event
126
            ->expects($this->once())
127
            ->method('getActionConfiguration')
128
            ->willReturn([
129
                'fields' => [
130
                    'test' => []
131
                ]
132
            ])
133
        ;
134
        $event
135
            ->expects($this->once())
136
            ->method('setActionConfiguration')
137
            ->with([
138
                'menus' => [
139
                    'top' => [
140
                        'items' => [
141
                            'create' => [
142
                                'admin' => 'my_admin',
143
                                'action' => 'create',
144
                                'icon' => 'fa fa-plus',
145
                            ]
146
                        ]
147
                    ]
148
                ],
149
                'fields' => [
150
                    'test' => [],
151
                ]
152
            ])
153
        ;
154
        $event
155
            ->expects($this->once())
156
            ->method('getAdmin')
157
            ->willReturn($admin)
158
        ;
159
        $event
160
            ->expects($this->exactly(3))
161
            ->method('getActionName')
162
            ->willReturn('list')
163
        ;
164
        $storage = $this->getMockWithoutConstructor(ApplicationConfigurationStorage::class);
165
        
166
        $subscriber = new ExtraConfigurationSubscriber(
0 ignored issues
show
Bug introduced by
The call to ExtraConfigurationSubscriber::__construct() misses a required argument $configurationFactory.

This check looks for function calls that miss required arguments.

Loading history...
167
            true,
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a object<LAG\AdminBundle\C...onConfigurationStorage>.

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...
168
            $doctrine,
0 ignored issues
show
Documentation introduced by
$doctrine is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

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...
169
            $storage
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<LAG\AdminBundle\R...rce\ResourceCollection>.

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...
170
        );
171
        $subscriber->beforeActionConfiguration($event);
0 ignored issues
show
Bug introduced by
The method beforeActionConfiguration() does not seem to exist on object<LAG\AdminBundle\E...onfigurationSubscriber>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
172
    }
173
174
    public function testLinkedActionsForListAction()
175
    {
176
        $applicationConfiguration = $this->getMockWithoutConstructor(ApplicationConfiguration::class);
177
        $applicationConfiguration
178
            ->method('getParameter')
179
            ->willReturnMap([
180
                ['translation', [
181
                    'pattern' => '{admin}.{key}'
182
                ]],
183
            ])
184
        ;
185
        
186
        $classMetadata = $this->getMockWithoutConstructor(ClassMetadata::class);
187
        $classMetadata
188
            ->method('getFieldNames')
189
            ->willReturn([
190
                'id'
191
            ])
192
        ;
193
        $classMetadata
194
            ->method('getTypeOfField')
195
            ->willReturn('string')
196
        ;
197
198
        $metadataFactory = $this->getMockWithoutConstructor(ClassMetadataFactory::class);
199
        $metadataFactory
200
            ->method('getMetadataFor')
201
            ->willReturn($classMetadata)
202
        ;
203
204
        $entityManager = $this->getMockWithoutConstructor(EntityManager::class);
205
        $entityManager
206
            ->method('getMetadataFactory')
207
            ->willReturn($metadataFactory)
208
        ;
209
210
        $doctrine = $this->getMockWithoutConstructor(Registry::class);
211
        $doctrine
212
            ->method('getManager')
213
            ->willReturn($entityManager)
214
        ;
215
    
216
        $adminConfiguration = $this->getMockWithoutConstructor(AdminConfiguration::class);
217
        $adminConfiguration
218
            ->method('getParameter')
219
            ->willReturnMap([
220
                ['actions', [
221
                    'list' => [],
222
                    'create' => [],
223
                    'edit' => [],
224
                    'delete' => [],
225
                ]],
226
            ])
227
        ;
228
        $adminConfiguration
229
            ->expects($this->once())
230
            ->method('isResolved')
231
            ->willReturn(true)
232
        ;
233
        
234
        $admin = $this->getMockWithoutConstructor(AdminInterface::class);
235
        $admin
236
            ->expects($this->exactly(3))
237
            ->method('getConfiguration')
238
            ->willReturn($adminConfiguration)
239
        ;
240
        $admin
241
            ->method('getName')
242
            ->willReturn('my_admin')
243
        ;
244
        
245
        $event = $this->getMockWithoutConstructor(BeforeConfigurationEvent::class);
246
        $event
247
            ->expects($this->atLeast(1))
248
            ->method('getAdmin')
249
            ->willReturn($admin)
250
        ;
251
        $event
252
            ->expects($this->once())
253
            ->method('getActionConfiguration')
254
            ->willReturn([])
255
        ;
256
        $event
257
            ->method('getActionName')
258
            ->willReturn('list')
259
        ;
260
        $storage = $this->getMockWithoutConstructor(ApplicationConfigurationStorage::class);
261
        $storage
262
            ->expects($this->once())
263
            ->method('getApplicationConfiguration')
264
            ->willReturn($applicationConfiguration)
265
        ;
266
267
        $subscriber = new ExtraConfigurationSubscriber(
0 ignored issues
show
Bug introduced by
The call to ExtraConfigurationSubscriber::__construct() misses a required argument $configurationFactory.

This check looks for function calls that miss required arguments.

Loading history...
268
            true,
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a object<LAG\AdminBundle\C...onConfigurationStorage>.

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...
269
            $doctrine,
0 ignored issues
show
Documentation introduced by
$doctrine is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

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...
270
            $storage
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<LAG\AdminBundle\R...rce\ResourceCollection>.

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...
271
        );
272
        $subscriber->beforeActionConfiguration($event);
0 ignored issues
show
Bug introduced by
The method beforeActionConfiguration() does not seem to exist on object<LAG\AdminBundle\E...onfigurationSubscriber>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
273
    }
274
275 View Code Duplication
    public function testBeforeConfigurationWithoutExtraConfigurationEnabled()
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...
276
    {
277
        $doctrine = $this->getMockWithoutConstructor(Registry::class);
278
        $event = $this->getMockWithoutConstructor(BeforeConfigurationEvent::class);
279
        $event
280
            ->expects($this->never())
281
            ->method('getActionConfiguration')
282
        ;
283
        $storage = $this->getMockWithoutConstructor(ApplicationConfigurationStorage::class);
284
    
285
        $subscriber = new ExtraConfigurationSubscriber(
0 ignored issues
show
Bug introduced by
The call to ExtraConfigurationSubscriber::__construct() misses a required argument $configurationFactory.

This check looks for function calls that miss required arguments.

Loading history...
286
            false,
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a object<LAG\AdminBundle\C...onConfigurationStorage>.

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...
287
            $doctrine,
0 ignored issues
show
Documentation introduced by
$doctrine is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

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...
288
            $storage
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<LAG\AdminBundle\R...rce\ResourceCollection>.

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...
289
        );
290
        $subscriber->beforeActionConfiguration($event);
0 ignored issues
show
Bug introduced by
The method beforeActionConfiguration() does not seem to exist on object<LAG\AdminBundle\E...onfigurationSubscriber>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
291
    }
292
293
    public function testBeforeConfigurationWithoutFields()
294
    {
295
        $applicationConfiguration = $this->getMockWithoutConstructor(ApplicationConfiguration::class);
296
        $applicationConfiguration
297
            ->method('getParameter')
298
            ->willReturnMap([
299
                ['translation', [
300
                    'pattern' => '{admin}.{key}'
301
                ]],
302
            ])
303
        ;
304
        
305
        $adminConfiguration = $this->getMockWithoutConstructor(AdminConfiguration::class);
306
        $adminConfiguration
307
            ->expects($this->exactly(2))
308
            ->method('getParameter')
309
            ->willReturnMap([
310
                ['actions', []],
311
                ['entity', TestSimpleEntity::class],
312
            ])
313
        ;
314
        $metadata = $this->getMockWithoutConstructor(ClassMetadata::class);
315
        $metadata
316
            ->expects($this->once())
317
            ->method('getFieldNames')
318
            ->willReturn([
319
                'id' => [],
320
                'name' => [],
321
            ])
322
        ;
323
        $metadataFactory = $this->getMockWithoutConstructor(ClassMetadataFactory::class);
324
        $metadataFactory
325
            ->expects($this->once())
326
            ->method('getMetadataFor')
327
            ->willReturn($metadata)
328
        ;
329
        $entityManager = $this->getMockWithoutConstructor(EntityManager::class);
330
        $entityManager
331
            ->expects($this->once())
332
            ->method('getMetadataFactory')
333
            ->willReturn($metadataFactory)
334
        ;
335
        $doctrine = $this->getMockWithoutConstructor(Registry::class);
336
        $doctrine
337
            ->expects($this->once())
338
            ->method('getManager')
339
            ->willReturn($entityManager)
340
        ;
341
        $admin = $this->getMockWithoutConstructor(AdminInterface::class);
342
        $admin
343
            ->expects($this->exactly(2))
344
            ->method('getConfiguration')
345
            ->willReturn($adminConfiguration)
346
        ;
347
348
        $event = $this->getMockWithoutConstructor(BeforeConfigurationEvent::class);
349
        $event
350
            ->expects($this->once())
351
            ->method('getActionConfiguration')
352
            ->willReturn([])
353
        ;
354
        $event
355
            ->expects($this->once())
356
            ->method('getAdmin')
357
            ->willReturn($admin)
358
        ;
359
        $storage = $this->getMockWithoutConstructor(ApplicationConfigurationStorage::class);
360
        $storage
361
            ->expects($this->once())
362
            ->method('getApplicationConfiguration')
363
            ->willReturn($applicationConfiguration)
364
        ;
365
366
        $subscriber = new ExtraConfigurationSubscriber(
0 ignored issues
show
Bug introduced by
The call to ExtraConfigurationSubscriber::__construct() misses a required argument $configurationFactory.

This check looks for function calls that miss required arguments.

Loading history...
367
            true,
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a object<LAG\AdminBundle\C...onConfigurationStorage>.

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...
368
            $doctrine,
0 ignored issues
show
Documentation introduced by
$doctrine is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

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...
369
            $storage
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<LAG\AdminBundle\R...rce\ResourceCollection>.

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...
370
        );
371
372
        $subscriber->beforeActionConfiguration($event);
0 ignored issues
show
Bug introduced by
The method beforeActionConfiguration() does not seem to exist on object<LAG\AdminBundle\E...onfigurationSubscriber>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
373
    }
374
}
375