Code Duplication    Length = 9-12 lines in 4 locations

tests/unit/Controllers/API/GenericEntityFetchControllerTest.php 4 locations

@@ 222-230 (lines=9) @@
219
    /**
220
     * @test
221
     */
222
    public function shouldThrowExceptionOnInvalidNormalizer()
223
    {
224
        $this->expectException(InvalidArgumentException::class);
225
226
        $controller = new GenericEntityFetchController($this->controllerHelper, [
227
            'entity-class' => SampleEntity::class,
228
            'normalizer' => false
229
        ]);
230
    }
231
232
    /**
233
     * @test
@@ 235-243 (lines=9) @@
232
    /**
233
     * @test
234
     */
235
    public function shouldThrowExceptionOnInvalidEncoder()
236
    {
237
        $this->expectException(InvalidArgumentException::class);
238
239
        $controller = new GenericEntityFetchController($this->controllerHelper, [
240
            'entity-class' => SampleEntity::class,
241
            'encoder' => false
242
        ]);
243
    }
244
245
    /**
246
     * @test
@@ 248-259 (lines=12) @@
245
    /**
246
     * @test
247
     */
248
    public function shouldThrowExceptionWhenCallingConstructorAgain()
249
    {
250
        $this->expectException(InvalidArgumentException::class);
251
252
        $controller = new GenericEntityFetchController($this->controllerHelper, [
253
            'entity-class' => SampleEntity::class,
254
        ]);
255
256
        $controller->__construct($this->controllerHelper, [
257
            'entity-class' => SampleEntity::class,
258
        ]);
259
    }
260
261
    /**
262
     * @test
@@ 295-306 (lines=12) @@
292
    /**
293
     * @test
294
     */
295
    public function shouldRejectCallWithoutRequest()
296
    {
297
        $this->expectException(InvalidArgumentException::class);
298
299
        $controller = new GenericEntityFetchController($this->controllerHelper, [
300
            'entity-class' => SampleEntity::class,
301
        ]);
302
303
        $this->controllerHelper->method('getCurrentRequest')->willReturn(null);
304
305
        $controller();
306
    }
307
308
}
309