Code Duplication    Length = 23-26 lines in 2 locations

tests/unit/Controllers/GenericEntityCreateControllerTest.php 2 locations

@@ 354-376 (lines=23) @@
351
    /**
352
     * @test
353
     */
354
    public function shouldRejectNonExistingFactory()
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(
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
@@ 404-429 (lines=26) @@
401
    /**
402
     * @test
403
     */
404
    public function shouldRejectNonExistingFactoryMethod()
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(
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