Code Duplication    Length = 12-18 lines in 3 locations

tests/unit/Controllers/GenericTemplateRenderControllerTest.php 2 locations

@@ 108-119 (lines=12) @@
105
    /**
106
     * @test
107
     */
108
    public function shouldRejectConstructorCalledAgain()
109
    {
110
        $this->expectException(InvalidArgumentException::class);
111
112
        $controller = new GenericTemplateRenderController($this->controllerHelper, $this->argumentCompiler, [
113
            'template' => "@foo/bar/baz.html",
114
        ]);
115
116
        $controller->__construct($this->controllerHelper, $this->argumentCompiler, [
117
            'template' => "@foo/bar/baz.html",
118
        ]);
119
    }
120
121
    /**
122
     * @test
@@ 173-185 (lines=13) @@
170
    /**
171
     * @test
172
     */
173
    public function shouldRejectCallWithoutRequest()
174
    {
175
        $this->expectException(InvalidArgumentException::class);
176
177
        $controller = new GenericTemplateRenderController($this->controllerHelper, $this->argumentCompiler, [
178
            'template' => "@foo/bar/baz.html",
179
            'arguments' => []
180
        ]);
181
182
        $this->controllerHelper->method('getCurrentRequest')->willReturn(null);
183
184
        $controller();
185
    }
186
187
}
188

tests/unit/Controllers/API/GenericServiceInvokeControllerTest.php 1 location

@@ 316-333 (lines=18) @@
313
    /**
314
     * @test
315
     */
316
    public function shouldRejectCallWithoutRequest()
317
    {
318
        $this->expectException(InvalidArgumentException::class);
319
320
        $controller = new GenericServiceInvokeController(
321
            $this->controllerHelper,
322
            $this->argumentCompiler,
323
            $this->container,
324
            [
325
                'service' => 'some_service',
326
                'method' => 'doFoo',
327
            ]
328
        );
329
330
        $this->controllerHelper->method('getCurrentRequest')->willReturn(null);
331
332
        $controller();
333
    }
334
335
}
336