Completed
Push — master ( c6433c...a8c688 )
by Gerrit
38:24
created

shouldRejectNonExistingFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 23
Ratio 100 %

Importance

Changes 0
Metric Value
dl 23
loc 23
c 0
b 0
f 0
rs 9.552
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright (C) 2017  Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks\SymfonyGenerics\Tests\Unit\Controllers;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\SymfonyGenerics\Controllers\GenericEntityCreateController;
15
use Addiks\SymfonyGenerics\Services\ArgumentCompilerInterface;
16
use Addiks\SymfonyGenerics\Controllers\ControllerHelperInterface;
17
use Symfony\Component\HttpFoundation\Request;
18
use Psr\Container\ContainerInterface;
19
use Symfony\Component\HttpFoundation\Response;
20
use Addiks\SymfonyGenerics\Tests\Unit\Controllers\SampleEntity;
21
use Webmozart\Assert\Assert;
22
use Serializable;
23
use stdClass;
24
use InvalidArgumentException;
25
use Symfony\Component\Finder\Exception\AccessDeniedException;
26
27
final class GenericEntityCreateControllerTest extends TestCase
28
{
29
30
    /**
31
     * @var ControllerHelperInterface
32
     */
33
    private $controllerHelper;
34
35
    /**
36
     * @var ArgumentCompilerInterface
37
     */
38
    private $argumentBuilder;
39
40
    /**
41
     * @var ContainerInterface
42
     */
43
    private $container;
44
45
    public function setUp()
46
    {
47
        $this->controllerHelper = $this->createMock(ControllerHelperInterface::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(\Addik...HelperInterface::class) of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<Addiks\SymfonyGen...trollerHelperInterface> of property $controllerHelper.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
48
        $this->container = $this->createMock(ContainerInterface::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(\Psr\C...tainerInterface::class) of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<Psr\Container\ContainerInterface> of property $container.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
        $this->argumentBuilder = $this->createMock(ArgumentCompilerInterface::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(\Addik...mpilerInterface::class) of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<Addiks\SymfonyGen...umentCompilerInterface> of property $argumentBuilder.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
50
    }
51
52
    /**
53
     * @test
54
     */
55
    public function shouldCreateAnEntity()
56
    {
57
        $controller = new GenericEntityCreateController(
58
            $this->controllerHelper,
59
            $this->argumentBuilder,
60
            $this->container,
61
            [
62
                'entity-class' => SampleEntity::class
63
            ]
64
        );
65
66
        $this->controllerHelper->expects($this->once())->method('flushORM');
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Addiks\SymfonyGen...trollerHelperInterface>.

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...
67
        $this->controllerHelper->expects($this->once())->method('persistEntity')->with(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Addiks\SymfonyGen...trollerHelperInterface>.

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...
68
            $this->equalTo(new SampleEntity())
69
        );
70
71
        /** @var Request $request */
72
        $request = $this->createMock(Request::class);
73
74
        /** @var Response $response */
75
        $response = $controller->createEntity($request);
76
77
        $this->assertEquals(200, $response->getStatusCode());
78
    }
79
80
    /**
81
     * @test
82
     */
83
    public function shouldRejectNonExistingEntityClass()
84
    {
85
        $this->expectException(InvalidArgumentException::class);
86
87
        $controller = new GenericEntityCreateController(
0 ignored issues
show
Unused Code introduced by
$controller is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
88
            $this->controllerHelper,
89
            $this->argumentBuilder,
90
            $this->container,
91
            [
92
                'entity-class' => "\\ClassDoes\\NotExist"
93
            ]
94
        );
95
    }
96
97
    /**
98
     * @test
99
     */
100
    public function shouldRejectMissingEntityClass()
101
    {
102
        $this->expectException(InvalidArgumentException::class);
103
104
        $controller = new GenericEntityCreateController(
0 ignored issues
show
Unused Code introduced by
$controller is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
105
            $this->controllerHelper,
106
            $this->argumentBuilder,
107
            $this->container,
108
            [
109
            ]
110
        );
111
    }
112
113
    /**
114
     * @test
115
     */
116
    public function shouldRejectControllerCalledAgain()
117
    {
118
        $controller = new GenericEntityCreateController(
119
            $this->controllerHelper,
120
            $this->argumentBuilder,
121
            $this->container,
122
            [
123
                'entity-class' => SampleEntity::class
124
            ]
125
        );
126
127
        $this->expectException(InvalidArgumentException::class);
128
129
        $controller->__construct(
130
            $this->controllerHelper,
131
            $this->argumentBuilder,
132
            $this->container,
133
            [
134
                'entity-class' => SampleEntity::class
135
            ]
136
        );
137
    }
138
139
    /**
140
     * @test
141
     */
142
    public function shouldProvideConstructArguments()
143
    {
144
        $controller = new GenericEntityCreateController(
145
            $this->controllerHelper,
146
            $this->argumentBuilder,
147
            $this->container,
148
            [
149
                'entity-class' => SampleEntity::class,
150
                'calls' => [
151
                    'construct' => [
152
                        'foo' => 'bar'
153
                    ]
154
                ]
155
            ]
156
        );
157
158
        /** @var SampleEntity|null $persistedEntity */
159
        $persistedEntity = null;
160
161
        $this->controllerHelper->expects($this->once())->method('flushORM');
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Addiks\SymfonyGen...trollerHelperInterface>.

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...
162
        $this->controllerHelper->method('persistEntity')->will($this->returnCallback(
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Addiks\SymfonyGen...trollerHelperInterface>.

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...
163
            function (SampleEntity $entity) use (&$persistedEntity) {
164
                $persistedEntity = $entity;
165
            }
166
        ));
167
168
        $this->argumentBuilder->method('buildCallArguments')->willReturn([
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Addiks\SymfonyGen...umentCompilerInterface>.

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...
169
            'bar'
170
        ]);
171
172
        /** @var Request $request */
173
        $request = $this->createMock(Request::class);
174
175
        /** @var Response $response */
176
        $response = $controller->createEntity($request);
0 ignored issues
show
Unused Code introduced by
$response is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
177
178
        $this->assertEquals('bar', $persistedEntity->constructArgument);
179
    }
180
181
    /**
182
     * @test
183
     */
184
    public function shouldExecuteACall()
185
    {
186
        $controller = new GenericEntityCreateController(
187
            $this->controllerHelper,
188
            $this->argumentBuilder,
189
            $this->container,
190
            [
191
                'entity-class' => SampleEntity::class,
192
                'calls' => [
193
                    'doFoo' => []
194
                ]
195
            ]
196
        );
197
198
        /** @var SampleEntity|null $persistedEntity */
199
        $persistedEntity = null;
200
201
        $this->controllerHelper->method('persistEntity')->will($this->returnCallback(
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Addiks\SymfonyGen...trollerHelperInterface>.

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...
202
            function (SampleEntity $entity) use (&$persistedEntity) {
203
                $persistedEntity = $entity;
204
            }
205
        ));
206
207
        /** @var Request $request */
208
        $request = $this->createMock(Request::class);
209
210
        $this->assertNull($persistedEntity);
211
212
        $controller->createEntity($request);
213
214
        $this->assertTrue($persistedEntity instanceof SampleEntity);
215
        $this->assertTrue($persistedEntity->fooCalled);
216
    }
217
218
    /**
219
     * @test
220
     */
221 View Code Duplication
    public function shouldRejectCallToNonExistingMethod()
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...
222
    {
223
        $this->expectException(InvalidArgumentException::class);
224
225
        $controller = new GenericEntityCreateController(
0 ignored issues
show
Unused Code introduced by
$controller is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
226
            $this->controllerHelper,
227
            $this->argumentBuilder,
228
            $this->container,
229
            [
230
                'entity-class' => SampleEntity::class,
231
                'calls' => [
232
                    'doNonExistingThing' => []
233
                ]
234
            ]
235
        );
236
    }
237
238
    /**
239
     * @test
240
     */
241 View Code Duplication
    public function shouldRejectCallWithNonArrayParameters()
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...
242
    {
243
        $this->expectException(InvalidArgumentException::class);
244
245
        $controller = new GenericEntityCreateController(
0 ignored issues
show
Unused Code introduced by
$controller is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
246
            $this->controllerHelper,
247
            $this->argumentBuilder,
248
            $this->container,
249
            [
250
                'entity-class' => SampleEntity::class,
251
                'calls' => [
252
                    'doFoo' => "notAnArray"
253
                ]
254
            ]
255
        );
256
    }
257
258
    /**
259
     * @test
260
     */
261 View Code Duplication
    public function shouldRejectCallWithIntegerMethod()
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...
262
    {
263
        $this->expectException(InvalidArgumentException::class);
264
265
        $controller = new GenericEntityCreateController(
0 ignored issues
show
Unused Code introduced by
$controller is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
266
            $this->controllerHelper,
267
            $this->argumentBuilder,
268
            $this->container,
269
            [
270
                'entity-class' => SampleEntity::class,
271
                'calls' => [
272
                    0 => []
273
                ]
274
            ]
275
        );
276
    }
277
278
    /**
279
     * @test
280
     */
281
    public function shouldUseFactoryObject()
282
    {
283
        $controller = new GenericEntityCreateController(
284
            $this->controllerHelper,
285
            $this->argumentBuilder,
286
            $this->container,
287
            [
288
                'entity-class' => SampleEntity::class,
289
                'factory' => '@some_factory_service::serialize'
290
            ]
291
        );
292
293
        $expectedEntity = new SampleEntity();
294
295
        /** @var SampleEntity|null $actualEntity */
296
        $actualEntity = null;
297
298
        /** @var Serializable $factoryMock */
299
        $factoryMock = $this->createMock(Serializable::class);
300
        $factoryMock->method("serialize")->willReturn($expectedEntity);
301
302
        $this->container->expects($this->once())->method('get')->with(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Psr\Container\ContainerInterface>.

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...
303
            $this->equalTo('some_factory_service')
304
        )->willReturn($factoryMock);
305
306
        $this->controllerHelper->method('persistEntity')->will($this->returnCallback(
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Addiks\SymfonyGen...trollerHelperInterface>.

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...
307
            function (SampleEntity $entity) use (&$actualEntity) {
308
                $actualEntity = $entity;
309
            }
310
        ));
311
312
        /** @var Request $request */
313
        $request = $this->createMock(Request::class);
314
315
        $controller->createEntity($request);
316
317
        $this->assertSame($expectedEntity, $actualEntity);
318
    }
319
320
    /**
321
     * @test
322
     */
323
    public function shouldRejectWrongEntityCreated()
324
    {
325
        $controller = new GenericEntityCreateController(
326
            $this->controllerHelper,
327
            $this->argumentBuilder,
328
            $this->container,
329
            [
330
                'entity-class' => SampleEntity::class,
331
                'factory' => '@some_factory_service::serialize'
332
            ]
333
        );
334
335
        /** @var Serializable $factoryMock */
336
        $factoryMock = $this->createMock(Serializable::class);
337
        $factoryMock->method("serialize")->willReturn(new stdClass());
338
339
        $this->container->expects($this->once())->method('get')->with(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Psr\Container\ContainerInterface>.

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...
340
            $this->equalTo('some_factory_service')
341
        )->willReturn($factoryMock);
342
343
        /** @var Request $request */
344
        $request = $this->createMock(Request::class);
345
346
        $this->expectException(InvalidArgumentException::class);
347
348
        $controller->createEntity($request);
349
    }
350
351
    /**
352
     * @test
353
     */
354 View Code Duplication
    public function shouldRejectNonExistingFactory()
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...
355
    {
356
        $controller = new GenericEntityCreateController(
357
            $this->controllerHelper,
358
            $this->argumentBuilder,
359
            $this->container,
360
            [
361
                'entity-class' => SampleEntity::class,
362
                'factory' => '@some_factory_service::serialize'
363
            ]
364
        );
365
366
        $this->container->expects($this->once())->method('get')->with(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Psr\Container\ContainerInterface>.

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...
367
            $this->equalTo('some_factory_service')
368
        )->willReturn(null);
369
370
        /** @var Request $request */
371
        $request = $this->createMock(Request::class);
372
373
        $this->expectException(InvalidArgumentException::class);
374
375
        $controller->createEntity($request);
376
    }
377
378
    /**
379
     * @test
380
     */
381 View Code Duplication
    public function shouldRejectInvalidFactory()
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...
382
    {
383
        $controller = new GenericEntityCreateController(
384
            $this->controllerHelper,
385
            $this->argumentBuilder,
386
            $this->container,
387
            [
388
                'entity-class' => SampleEntity::class,
389
                'factory' => '::serialize'
390
            ]
391
        );
392
393
        /** @var Request $request */
394
        $request = $this->createMock(Request::class);
395
396
        $this->expectException(InvalidArgumentException::class);
397
398
        $controller->createEntity($request);
399
    }
400
401
    /**
402
     * @test
403
     */
404 View Code Duplication
    public function shouldRejectNonExistingFactoryMethod()
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...
405
    {
406
        $controller = new GenericEntityCreateController(
407
            $this->controllerHelper,
408
            $this->argumentBuilder,
409
            $this->container,
410
            [
411
                'entity-class' => SampleEntity::class,
412
                'factory' => '@some_factory_service::MethodDoesNotExist'
413
            ]
414
        );
415
416
        /** @var Serializable $factoryMock */
417
        $factoryMock = $this->createMock(Serializable::class);
418
419
        $this->container->expects($this->once())->method('get')->with(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Psr\Container\ContainerInterface>.

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...
420
            $this->equalTo('some_factory_service')
421
        )->willReturn($factoryMock);
422
423
        /** @var Request $request */
424
        $request = $this->createMock(Request::class);
425
426
        $this->expectException(InvalidArgumentException::class);
427
428
        $controller->createEntity($request);
429
    }
430
431
    /**
432
     * @test
433
     */
434
    public function shouldCorrectlyDetectFactoryMethod()
435
    {
436
        $controller = new GenericEntityCreateController(
437
            $this->controllerHelper,
438
            $this->argumentBuilder,
439
            $this->container,
440
            [
441
                'entity-class' => SampleEntity::class,
442
                'factory' => '@some_factory_service::serialize::thisShouldCauseAnError'
443
            ]
444
        );
445
446
        /** @var Serializable $factoryMock */
447
        $factoryMock = $this->createMock(Serializable::class);
448
        $factoryMock->method("serialize")->willReturn(new SampleEntity());
449
450
        $this->container->expects($this->once())->method('get')->with(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Psr\Container\ContainerInterface>.

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...
451
            $this->equalTo('some_factory_service')
452
        )->willReturn($factoryMock);
453
454
        /** @var Request $request */
455
        $request = $this->createMock(Request::class);
456
457
        $this->expectException(InvalidArgumentException::class);
458
459
        $controller->createEntity($request);
460
    }
461
462
    /**
463
     * @test
464
     */
465
    public function shouldCheckIfAccessIsGranted()
466
    {
467
        $this->expectException(AccessDeniedException::class);
468
469
        $this->controllerHelper->expects($this->once())->method('denyAccessUnlessGranted')->will($this->returnCallback(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Addiks\SymfonyGen...trollerHelperInterface>.

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...
470
            function () {
471
                throw new AccessDeniedException('Lorem ipsum!');
472
            }
473
        ));
474
475
        /** @var Serializable $factoryMock */
476
        $factoryMock = $this->createMock(Serializable::class);
477
        $factoryMock->method("serialize")->willReturn(new SampleEntity());
478
479
        $this->container->expects($this->once())->method('get')->with(
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Psr\Container\ContainerInterface>.

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...
480
            $this->equalTo('some_factory_service')
481
        )->willReturn($factoryMock);
482
483
        /** @var mixed $controller */
484
        $controller = new GenericEntityCreateController(
485
            $this->controllerHelper,
486
            $this->argumentBuilder,
487
            $this->container,
488
            [
489
                'entity-class' => SampleEntity::class,
490
                'factory' => '@some_factory_service::serialize',
491
                'authorization-attribute' => 'some-attribute',
492
            ]
493
        );
494
495
        /** @var Request $request */
496
        $request = $this->createMock(Request::class);
497
498
        $controller->createEntity($request);
499
    }
500
501
}
502