Code Duplication    Length = 18-22 lines in 3 locations

tests/Unit/Controller/ArchiveControllerTest.php 1 location

@@ 46-64 (lines=19) @@
43
        $this->assertInstanceOf(Response::class, $response);
44
    }
45
46
    private function createArchiveController(Environment $twig, SlidingPagination $slidingPagination): ArchiveController
47
    {
48
        $articleRepository = $this->createMock(ArticleRepository::class);
49
        $breadCrumbsManager = $this->createMock(BreadCrumbsManager::class);
50
        $knpPaginator = $this->createMock(PaginatorInterface::class);
51
        $knpPaginator
52
            ->method('paginate')
53
            ->willReturn($slidingPagination)
54
        ;
55
56
        $paginator = new Paginator($knpPaginator, 123);
57
58
        $controller = new ArchiveController($articleRepository, $breadCrumbsManager, $paginator);
59
        $container = new Container();
60
        $container->set('twig', $twig);
61
        $controller->setContainer($container);
62
63
        return $controller;
64
    }
65
}
66

tests/Unit/Controller/CategoryControllerTest.php 1 location

@@ 83-104 (lines=22) @@
80
        $categoryController($request, 'parent-slug/child-slug');
81
    }
82
83
    private function createCategoryController(
84
        Environment $twig,
85
        SlidingPagination $slidingPagination,
86
        CategoryRepository $categoryRepository
87
    ): CategoryController {
88
        $articleRepository = $this->createMock(ArticleRepository::class);
89
        $breadCrumbsManager = $this->createMock(BreadCrumbsManager::class);
90
        $knpPaginator = $this->createMock(PaginatorInterface::class);
91
        $knpPaginator
92
            ->method('paginate')
93
            ->willReturn($slidingPagination)
94
        ;
95
96
        $paginator = new Paginator($knpPaginator, 123);
97
98
        $controller = new CategoryController($articleRepository, $categoryRepository, $breadCrumbsManager, $paginator);
99
        $container = new Container();
100
        $container->set('twig', $twig);
101
        $controller->setContainer($container);
102
103
        return $controller;
104
    }
105
}
106

tests/Unit/Controller/TagControllerTest.php 1 location

@@ 46-63 (lines=18) @@
43
        $this->assertInstanceOf(Response::class, $response);
44
    }
45
46
    private function createTagController(Environment $twig, SlidingPagination $slidingPagination): TagController
47
    {
48
        $articleRepository = $this->createMock(ArticleRepository::class);
49
        $breadCrumbsManager = $this->createMock(BreadCrumbsManager::class);
50
        $knpPaginator = $this->createMock(PaginatorInterface::class);
51
        $knpPaginator
52
            ->method('paginate')
53
            ->willReturn($slidingPagination)
54
        ;
55
56
        $paginator = new Paginator($knpPaginator, 123);
57
        $controller = new TagController($articleRepository, $breadCrumbsManager, $paginator);
58
        $container = new Container();
59
        $container->set('twig', $twig);
60
        $controller->setContainer($container);
61
62
        return $controller;
63
    }
64
}
65