Code Duplication    Length = 39-39 lines in 2 locations

eZ/Publish/Core/MVC/Symfony/View/Tests/Builder/ContentViewBuilderTest.php 2 locations

@@ 242-280 (lines=39) @@
239
        $this->contentViewBuilder->buildView($parameters);
240
    }
241
242
    public function testBuildViewWithDeprecatedControllerReference(): void
243
    {
244
        $contentInfo = new ContentInfo(['id' => 120]);
245
        $content = new Content([
246
            'versionInfo' => new VersionInfo([
247
                'contentInfo' => $contentInfo,
248
            ]),
249
        ]);
250
        $location = new Location(
251
            [
252
                'invisible' => false,
253
                'contentInfo' => $contentInfo,
254
                'content' => $content,
255
            ]
256
        );
257
258
        $expectedView = new ContentView(null, [], 'full');
259
        $expectedView->setControllerReference(new ControllerReference('ez_content:viewAction'));
260
        $expectedView->setLocation($location);
261
        $expectedView->setContent($content);
262
263
        $parameters = [
264
            'viewType' => 'full',
265
            '_controller' => 'ez_content:viewLocation',
266
            'locationId' => 2,
267
        ];
268
269
        $this->repository
270
            ->expects($this->once())
271
            ->method('sudo')
272
            ->willReturn($location);
273
274
        $this->authorizationChecker
275
            ->expects($this->at(0))
276
            ->method('isGranted')
277
            ->willReturn(true);
278
279
        $this->assertEquals($expectedView, $this->contentViewBuilder->buildView($parameters));
280
    }
281
282
    public function testBuildView(): void
283
    {
@@ 282-320 (lines=39) @@
279
        $this->assertEquals($expectedView, $this->contentViewBuilder->buildView($parameters));
280
    }
281
282
    public function testBuildView(): void
283
    {
284
        $contentInfo = new ContentInfo(['id' => 120]);
285
        $content = new Content([
286
            'versionInfo' => new VersionInfo([
287
                'contentInfo' => $contentInfo,
288
            ]),
289
        ]);
290
        $location = new Location(
291
            [
292
                'invisible' => false,
293
                'contentInfo' => $contentInfo,
294
                'content' => $content,
295
            ]
296
        );
297
298
        $expectedView = new ContentView(null, [], 'full');
299
        $expectedView->setControllerReference(new ControllerReference('ez_content:viewAction'));
300
        $expectedView->setLocation($location);
301
        $expectedView->setContent($content);
302
303
        $parameters = [
304
            'viewType' => 'full',
305
            '_controller' => 'ez_content:viewContent',
306
            'locationId' => 2,
307
        ];
308
309
        $this->repository
310
            ->expects($this->once())
311
            ->method('sudo')
312
            ->willReturn($location);
313
314
        $this->authorizationChecker
315
            ->expects($this->at(0))
316
            ->method('isGranted')
317
            ->willReturn(true);
318
319
        $this->assertEquals($expectedView, $this->contentViewBuilder->buildView($parameters));
320
    }
321
}
322