From 419ffd94c82c2a7a44c4e01294c76d95e3ec1ded Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Fri, 1 Dec 2023 17:44:20 +0100 Subject: [PATCH] [Tests] Added coverage for merging of pager options in MyDraftsTab --- tests/lib/Tab/Dashboard/MyDraftsTabTest.php | 68 +++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/lib/Tab/Dashboard/MyDraftsTabTest.php diff --git a/tests/lib/Tab/Dashboard/MyDraftsTabTest.php b/tests/lib/Tab/Dashboard/MyDraftsTabTest.php new file mode 100644 index 0000000000..b39c7aeb66 --- /dev/null +++ b/tests/lib/Tab/Dashboard/MyDraftsTabTest.php @@ -0,0 +1,68 @@ + $templateMock, + ] + ) + ); + + $requestStackMock = $this->createMock(RequestStack::class); + $configResolverMock = $this->createMock(ConfigResolverInterface::class); + $tab = new MyDraftsTab( + $twigStub, + $this->createMock(TranslatorInterface::class), + $this->createMock(ContentService::class), + $this->createMock(ContentTypeService::class), + $this->createMock(PermissionResolver::class), + $this->createMock(DatasetFactory::class), + $requestStackMock, + $configResolverMock + ); + + $configResolverMock->method('getParameter')->with('pagination.content_draft_limit')->willReturn(10); + $requestStackMock->method('getCurrentRequest')->willReturn(new Request()); + + self::assertSame( + // see $templateMock + 'app.page | [mydrafts-page]', + $tab->renderView( + [ + 'pager_options' => [ + 'routeName' => 'app.page', + ], + ] + ) + ); + } +}