Code Duplication    Length = 22-30 lines in 3 locations

tests/FwlibTest/Html/ListView/RendererTest.php 3 locations

@@ 38-59 (lines=22) @@
35
    }
36
37
38
    public function testAddOrderByLink()
39
    {
40
        $renderer = $this->buildMock();
41
42
        /** @var MockObject|Request $request */
43
        $request = $this->getMock(Request::class, ['getBaseUrl']);
44
        $request->expects($this->any())
45
            ->method('getBaseUrl')
46
            ->willReturn('http://domain.tld/');
47
        $request->setOrderByParameter('ob')
48
            ->setOrderByDirectionParameter('od');
49
        $renderer->setRequest($request);
50
51
        $this->assertEquals(
52
            "<a href='http://domain.tld/?ob=foo&od=DESC'>head(asc)</a>",
53
            $this->reflectionCall(
54
                $renderer,
55
                'addOrderByLink',
56
                ['foo', 'head(asc)', 'ASC']
57
            )
58
        );
59
    }
60
61
62
    public function testAddOrderByText()
@@ 284-313 (lines=30) @@
281
    }
282
283
284
    public function testGetListTable()
285
    {
286
        /** @var MockObject|Renderer $renderer */
287
        $renderer = $this->getMock(
288
            Renderer::class,
289
            ['getListHead', 'getListBody']
290
        );
291
292
        $renderer->expects($this->any())
293
            ->method('getListHead')
294
            ->willReturn("<thead>\n</thead>");
295
296
        $renderer->expects($this->any())
297
            ->method('getListBody')
298
            ->willReturn("<tbody>\n</tbody>");
299
300
        $renderer->setClass('listTable')->setId(1);
301
302
        $html = "<table class='listTable__table' id='listTable-1__table'>
303
  <thead>
304
  </thead>
305
306
  <tbody>
307
  </tbody>
308
</table>";
309
        $this->assertEquals(
310
            $html,
311
            $this->reflectionCall($renderer, 'getListTable')
312
        );
313
    }
314
315
316
    public function testGetPager()
@@ 386-408 (lines=23) @@
383
    }
384
385
386
    public function testGetSafePage()
387
    {
388
        $renderer = $this->buildMock();
389
390
        /** @var MockObject|RequestInterface $request */
391
        $request = $this->getMock(Request::class, ['getPage']);
392
        $request->expects($this->any())
393
            ->method('getPage')
394
            ->willReturn(3);
395
        $renderer->setRequest($request);
396
397
        // In max page
398
        $this->assertEquals(
399
            3,
400
            $this->reflectionCall($renderer, 'getSafePage', ['3'])
401
        );
402
403
        // Exceed max page
404
        $this->assertEquals(
405
            2,
406
            $this->reflectionCall($renderer, 'getSafePage', ['2'])
407
        );
408
    }
409
}
410