From 4925223004567c4447ca79810351d29af1201338 Mon Sep 17 00:00:00 2001 From: webeweb Date: Fri, 28 Sep 2018 12:32:09 +0200 Subject: [PATCH] Refactoring Theme manager --- EventListener/KernelEventListener.php | 2 +- Manager/ThemeManager.php | 277 +++++++++----------------- Resources/config/services.yml | 18 +- Tests/Manager/ThemeManagerTest.php | 176 ++++++++-------- 4 files changed, 198 insertions(+), 275 deletions(-) diff --git a/EventListener/KernelEventListener.php b/EventListener/KernelEventListener.php index 70f7f097..6e9e9279 100644 --- a/EventListener/KernelEventListener.php +++ b/EventListener/KernelEventListener.php @@ -154,7 +154,7 @@ public function onKernelRequest(GetResponseEvent $event) { $this->setRequest($event->getRequest()); // Register the providers. - $this->getThemeManager()->register(); + $this->getThemeManager()->addGlobal(); } /** diff --git a/Manager/ThemeManager.php b/Manager/ThemeManager.php index de32c68b..81754d1a 100644 --- a/Manager/ThemeManager.php +++ b/Manager/ThemeManager.php @@ -11,16 +11,16 @@ namespace WBW\Bundle\BootstrapBundle\Manager; -use Twig_Environment; use WBW\Bundle\BootstrapBundle\Provider\Theme\ApplicationThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\BreadcrumbsThemeProviderInterface; -use WBW\Bundle\BootstrapBundle\Provider\Theme\DropDownHookThemeProviderInterface; -use WBW\Bundle\BootstrapBundle\Provider\Theme\DropDownNotificationsThemeProviderInterface; -use WBW\Bundle\BootstrapBundle\Provider\Theme\DropDownTasksThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\FooterThemeProviderInterface; +use WBW\Bundle\BootstrapBundle\Provider\Theme\HookDropDownThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\NavigationThemeProviderInterface; +use WBW\Bundle\BootstrapBundle\Provider\Theme\NotificationsDropDownThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\SearchThemeProviderInterface; +use WBW\Bundle\BootstrapBundle\Provider\Theme\TasksDropDownThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\UserInfoThemeProviderInterface; +use WBW\Library\Core\Argument\ObjectHelper; /** * Theme manager. @@ -28,7 +28,7 @@ * @author webeweb * @package WBW\Bundle\BootstrapBundle\Manager */ -class ThemeManager { +class ThemeManager extends AbstractThemeManager { /** * Service name. @@ -38,278 +38,199 @@ class ThemeManager { const SERVICE_NAME = "webeweb.bootstrap.manager.theme"; /** - * Application provider. + * Get the application theme provider. * - * @var ApplicationThemeProviderInterface + * @return ApplicationThemeProviderInterface Returns the application theme provider. */ - private $applicationProvider; - - /** - * Breadcrumbs provider. - * - * @var BreadcrumbsThemeProviderInterface - */ - private $breadcrumbsProvider; - - /** - * Drop down hook provider. - * - * @var DropDownHookThemeProviderInterface - */ - private $dropDownHookProvider; - - /** - * Drop down notifications provider. - * - * @var DropDownNotificationsThemeProviderInterface - */ - private $dropDownNotificationsProvider; - - /** - * Drop down tasks provider. - * - * @var DropDownTasksThemeProviderInterface - */ - private $dropDownTasksProvider; - - /** - * Footer provider. - * - * @var FooterThemeProviderInterface - */ - private $footerProvider; - - /** - * Navigation provider. - * - * @var NavigationThemeProviderInterface - */ - private $navigationProvider; - - /** - * Search provider. - * - * @var SearchThemeProviderInterface - */ - private $searchProvider; - - /** - * Twig service. - * - * @var Twig_Environment - */ - private $twig; - - /** - * User info provider. - * - * @var UserInfoThemeProviderInterface - */ - private $userInfoProvider; - - /** - * Constructor. - * - * @param Twig_Environment $twig The Twig service. - */ - public function __construct(Twig_Environment $twig) { - $this->twig = $twig; + public function getApplicationThemeProvider() { + return $this->getProvider(ApplicationThemeProviderInterface::class); } /** - * Get the application provider. + * Get the breadcrumbs theme provider. * - * @return ApplicationThemeProviderInterface Returns the application provider. + * @return BreadcrumbsThemeProviderInterface Returns the breadcrumbs theme provider. */ - public function getApplicationProvider() { - return $this->applicationProvider; + public function getBreadcrumbsThemeProvider() { + return $this->getProvider(BreadcrumbsThemeProviderInterface::class); } /** - * Get the breadcrumbs provider. + * Get the footer theme provider. * - * @return BreadcrumbsThemeProviderInterface Returns the breadcrumbs provider. + * @return FooterThemeProviderInterface Returns the footer theme provider. */ - public function getBreadcrumbsProvider() { - return $this->breadcrumbsProvider; + public function getFooterThemeProvider() { + return $this->getProvider(FooterThemeProviderInterface::class); } /** - * Get the drop down hook provider. + * Get the hook drop down theme provider. * - * @return DropDownHookThemeProviderInterface Returns the drop down hook provider. + * @return HookDropDownThemeProviderInterface Returns the hook drop down theme provider. */ - public function getDropDownHookProvider() { - return $this->dropDownHookProvider; + public function getHookDropDownThemeProvider() { + return $this->getProvider(HookDropDownThemeProviderInterface::class); } /** - * Get the drop down notifications provider. + * Get the navigation theme provider. * - * @return DropDownNotificationsThemeProviderInterface Returns the drop down notifications provider. + * @return NavigationThemeProviderInterface Returns the navigation theme provider. */ - public function getDropDownNotificationsProvider() { - return $this->dropDownNotificationsProvider; + public function getNavigationThemeProvider() { + return $this->getProvider(NavigationThemeProviderInterface::class); } /** - * Get the drop down tasks provider. + * Get the notifications drop down theme provider. * - * @return DropDownTasksThemeProviderInterface Returns the drop down tasks provider. + * @return NotificationsDropDownThemeProviderInterface Returns the Notifications drop down theme provider. */ - public function getDropDownTasksProvider() { - return $this->dropDownTasksProvider; + public function getNotificationsDropDownThemeProvider() { + return $this->getProvider(NotificationsDropDownThemeProviderInterface::class); } /** - * Get the footer provider. + * Get the search theme provider. * - * @return FooterThemeProviderInterface Returns the footer provider. + * @return SearchThemeProviderInterface Returns the search theme provider. */ - public function getFooterProvider() { - return $this->footerProvider; + public function getSearchThemeProvider() { + return $this->getProvider(SearchThemeProviderInterface::class); } /** - * Get the navigation provider. + * Get the tasks drop down theme provider. * - * @return NavigationThemeProviderInterface Returns the navigation provider. + * @return TasksDropDownThemeProviderInterface Returns the tasks drop down theme provider. */ - public function getNavigationProvider() { - return $this->navigationProvider; + public function getTasksDropDownThemeProvider() { + return $this->getProvider(TasksDropDownThemeProviderInterface::class); } /** - * Get the search provider. + * Get the user info theme provider. * - * @return SearchThemeProviderInterface Returns the search provider. + * @return UserInfoThemeProviderInterface Returns the user info theme provider. */ - public function getSearchProvider() { - return $this->searchProvider; + public function getUserInfoThemeProvider() { + return $this->getProvider(UserInfoThemeProviderInterface::class); } /** - * Get the user info provider. - * - * @return UserInfoThemeProviderInterface Returns the user info provider. - */ - public function getUserInfoProvider() { - return $this->userInfoProvider; - } - - /** - * Register the providers. - * - * @return void + * {@inheritdoc} */ - public function register() { - $this->twig->addGlobal("ApplicationProvider", $this->applicationProvider); - $this->twig->addGlobal("BreadcrumbsProvider", $this->breadcrumbsProvider); - $this->twig->addGlobal("DropDownHookProvider", $this->dropDownHookProvider); - $this->twig->addGlobal("DropDownNotificationsProvider", $this->dropDownNotificationsProvider); - $this->twig->addGlobal("DropDownTasksProvider", $this->dropDownTasksProvider); - $this->twig->addGlobal("FooterProvider", $this->footerProvider); - $this->twig->addGlobal("NavigationProvider", $this->navigationProvider); - $this->twig->addGlobal("SearchProvider", $this->searchProvider); - $this->twig->addGlobal("UserInfoProvider", $this->userInfoProvider); + protected function initIndex() { + return [ + ObjectHelper::getShortName(ApplicationThemeProviderInterface::class) => null, + ObjectHelper::getShortName(BreadcrumbsThemeProviderInterface::class) => null, + ObjectHelper::getShortName(FooterThemeProviderInterface::class) => null, + ObjectHelper::getShortName(HookDropDownThemeProviderInterface::class) => null, + ObjectHelper::getShortName(NavigationThemeProviderInterface::class) => null, + ObjectHelper::getShortName(NotificationsDropDownThemeProviderInterface::class) => null, + ObjectHelper::getShortName(SearchThemeProviderInterface::class) => null, + ObjectHelper::getShortName(TasksDropDownThemeProviderInterface::class) => null, + ObjectHelper::getShortName(UserInfoThemeProviderInterface::class) => null, + ]; } /** - * Set the application provider. + * Set the application theme provider. * - * @param ApplicationThemeProviderInterface $applicationProvider The application provider. - * @return ProvidersManager Returns the providers manager. + * @param ApplicationThemeProviderInterface $provider The application theme provider. + * @return ManagerInterface Returns this manager. */ - public function setApplicationProvider(ApplicationThemeProviderInterface $applicationProvider) { - $this->applicationProvider = $applicationProvider; + public function setApplicationThemeProvider(ApplicationThemeProviderInterface $provider) { + $this->setProvider(ApplicationThemeProviderInterface::class, $provider); return $this; } /** - * Set the breadcrumbs provider. + * Set the breadcrumbs theme provider. * - * @param BreadcrumbsThemeProviderInterface $breadcrumbsProvider The breadcrumbs provider. - * @return ProvidersManager Returns the providers manager. + * @param BreadcrumbsThemeProviderInterface $provider The breadcrumbs theme provider. + * @return ManagerInterface Returns this manager. */ - public function setBreadcrumbsProvider(BreadcrumbsThemeProviderInterface $breadcrumbsProvider) { - $this->breadcrumbsProvider = $breadcrumbsProvider; + public function setBreadcrumbsThemeProvider(BreadcrumbsThemeProviderInterface $provider) { + $this->setProvider(BreadcrumbsThemeProviderInterface::class, $provider); return $this; } /** - * Set the drop down hook provider. + * Set the footer theme provider. * - * @param DropDownHookThemeProviderInterface $dropDownHookProvider The drop down hook provider. - * @return ProvidersManager Returns the providers manager. + * @param FooterThemeProviderInterface $provider The footer theme provider. + * @return ManagerInterface Returns this manager. */ - public function setDropDownHookProvider(DropDownHookThemeProviderInterface $dropDownHookProvider) { - $this->dropDownHookProvider = $dropDownHookProvider; + public function setFooterThemeProvider(FooterThemeProviderInterface $provider) { + $this->setProvider(FooterThemeProviderInterface::class, $provider); return $this; } /** - * Set the drop down notifications provider. + * Set the hook drop down theme provider. * - * @param DropDownNotificationsThemeProviderInterface $dropDownNotificationsProvider The drop down notifications provider. - * @return ProvidersManager Returns the providers manager. + * @param HookDropDownThemeProviderInterface $provider The hook drop down theme provider. + * @return ManagerInterface Returns this manager. */ - public function setDropDownNotificationsProvider(DropDownNotificationsThemeProviderInterface $dropDownNotificationsProvider) { - $this->dropDownNotificationsProvider = $dropDownNotificationsProvider; + public function setHookDropDownThemeProvider(HookDropDownThemeProviderInterface $provider) { + $this->setProvider(HookDropDownThemeProviderInterface::class, $provider); return $this; } /** - * Set the drop down tasks provider. + * Set the navigation theme provider. * - * @param DropDownTasksThemeProviderInterface $dropDownTasksProvider The drop down task provider. - * @return ProvidersManager Returns the providers manager. + * @param NavigationThemeProviderInterface $provider The navigation theme provider. + * @return ManagerInterface Returns this manager. */ - public function setDropDownTasksProvider(DropDownTasksThemeProviderInterface $dropDownTasksProvider) { - $this->dropDownTasksProvider = $dropDownTasksProvider; + public function setNavigationThemeProvider(NavigationThemeProviderInterface $provider) { + $this->setProvider(NavigationThemeProviderInterface::class, $provider); return $this; } /** - * Set the footer provider. + * Set the notifications drop down theme provider. * - * @param FooterThemeProviderInterface $footerProvider The footer priovider. - * @return ProvidersManager Returns the providers manager. + * @param NotificationsDropDownThemeProviderInterface $provider The notifications drop down theme provider. + * @return ManagerInterface Returns this manager. */ - public function setFooterProvider(FooterThemeProviderInterface $footerProvider) { - $this->footerProvider = $footerProvider; + public function setNotificationsDropDownThemeProvider(NotificationsDropDownThemeProviderInterface $provider) { + $this->setProvider(NotificationsDropDownThemeProviderInterface::class, $provider); return $this; } /** - * Set the navigation provider. + * Set the search theme provider. * - * @param NavigationThemeProviderInterface $navigationProvider The navigation provider. - * @return ProvidersManager Returns the providers manager. + * @param SearchThemeProviderInterface $provider The search theme provider. + * @return ManagerInterface Returns this manager. */ - public function setNavigationProvider(NavigationThemeProviderInterface $navigationProvider) { - $this->navigationProvider = $navigationProvider; + public function setSearchThemeProvider(SearchThemeProviderInterface $provider) { + $this->setProvider(SearchThemeProviderInterface::class, $provider); return $this; } /** - * Set the search provider. + * Set the tasks drop down theme provider. * - * @param SearchThemeProviderInterface $searchProvider The search provider. - * @return ProvidersManager Returns the providers manager. + * @param TasksDropDownThemeProviderInterface $provider The tasks drop down theme provider. + * @return ManagerInterface Returns this manager. */ - public function setSearchProvider(SearchThemeProviderInterface $searchProvider) { - $this->searchProvider = $searchProvider; + public function setTasksDropDownThemeProvider(TasksDropDownThemeProviderInterface $provider) { + $this->setProvider(TasksDropDownThemeProviderInterface::class, $provider); return $this; } /** - * Set the user info provider. + * Set the user info theme provider. * - * @param UserInfoThemeProviderInterface $userInfoProvider The user info provider. - * @return ProvidersManager Returns the providers manager. + * @param UserInfoThemeProviderInterface $provider The user info theme provider. + * @return ManagerInterface Returns this manager. */ - public function setUserInfoProvider(UserInfoThemeProviderInterface $userInfoProvider) { - $this->userInfoProvider = $userInfoProvider; + public function setUserInfoThemeProvider(UserInfoThemeProviderInterface $provider) { + $this->setProvider(UserInfoThemeProviderInterface::class, $provider); return $this; } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index a5980cc1..b879aad2 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -28,15 +28,15 @@ services: arguments: ["@twig"] public: true calls: - - ["setApplicationProvider", ["@?webeweb.bootstrap.provider.application"]] - - ["setBreadcrumbsProvider", ["@?webeweb.bootstrap.provider.breadcrumbs"]] - - ["setDropDownHookProvider", ["@?webeweb.bootstrap.provider.dropdownhook"]] - - ["setDropDownNotificationsProvider", ["@?webeweb.bootstrap.provider.dropdownnotifications"]] - - ["setDropDownTasksProvider", ["@?webeweb.bootstrap.provider.dropdowntasks"]] - - ["setFooterProvider", ["@?webeweb.bootstrap.provider.footer"]] - - ["setNavigationProvider", ["@?webeweb.bootstrap.provider.navigation"]] - - ["setSearchProvider", ["@?webeweb.bootstrap.provider.search"]] - - ["setUserInfoProvider", ["@?webeweb.bootstrap.provider.userinfo"]] + - ["setApplicationThemeProvider", ["@?webeweb.bootstrap.provider.theme.application"]] + - ["setBreadcrumbsThemeProvider", ["@?webeweb.bootstrap.provider.theme.breadcrumbs"]] + - ["setDropDownHookThemeProvider", ["@?webeweb.bootstrap.provider.theme.dropdownhook"]] + - ["setDropDownNotificationsThemeProvider", ["@?webeweb.bootstrap.provider.theme.dropdownnotifications"]] + - ["setDropDownTasksThemeProvider", ["@?webeweb.bootstrap.provider.theme.dropdowntasks"]] + - ["setFooterThemeProvider", ["@?webeweb.bootstrap.provider.theme.footer"]] + - ["setNavigationThemeProvider", ["@?webeweb.bootstrap.provider.theme.navigation"]] + - ["setSearchThemeProvider", ["@?webeweb.bootstrap.provider.theme.search"]] + - ["setUserInfoThemeProvider", ["@?webeweb.bootstrap.provider.theme.userinfo"]] webeweb.bootstrap.twig.extension.css.button: class: WBW\Bundle\BootstrapBundle\Twig\Extension\CSS\ButtonTwigExtension diff --git a/Tests/Manager/ThemeManagerTest.php b/Tests/Manager/ThemeManagerTest.php index 1bc438b6..e94967ee 100644 --- a/Tests/Manager/ThemeManagerTest.php +++ b/Tests/Manager/ThemeManagerTest.php @@ -14,12 +14,12 @@ use WBW\Bundle\BootstrapBundle\Manager\ThemeManager; use WBW\Bundle\BootstrapBundle\Provider\Theme\ApplicationThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\BreadcrumbsThemeProviderInterface; -use WBW\Bundle\BootstrapBundle\Provider\Theme\DropDownHookThemeProviderInterface; -use WBW\Bundle\BootstrapBundle\Provider\Theme\DropDownNotificationsThemeProviderInterface; -use WBW\Bundle\BootstrapBundle\Provider\Theme\DropDownTasksThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\FooterThemeProviderInterface; +use WBW\Bundle\BootstrapBundle\Provider\Theme\HookDropDownThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\NavigationThemeProviderInterface; +use WBW\Bundle\BootstrapBundle\Provider\Theme\NotificationsDropDownThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\SearchThemeProviderInterface; +use WBW\Bundle\BootstrapBundle\Provider\Theme\TasksDropDownThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Provider\Theme\UserInfoThemeProviderInterface; use WBW\Bundle\BootstrapBundle\Tests\AbstractFrameworkTestCase; @@ -48,221 +48,223 @@ public function testConstruct() { $obj = new ThemeManager($this->twigEnvironment); - $this->assertNull($obj->getApplicationProvider()); - $this->assertNull($obj->getBreadcrumbsProvider()); - $this->assertNull($obj->getDropDownHookProvider()); - $this->assertNull($obj->getDropDownNotificationsProvider()); - $this->assertNull($obj->getDropDownTasksProvider()); - $this->assertNull($obj->getFooterProvider()); - $this->assertNull($obj->getNavigationProvider()); - $this->assertNull($obj->getSearchProvider()); - $this->assertNull($obj->getUserInfoProvider()); + $this->assertNull($obj->getApplicationThemeProvider()); + $this->assertNull($obj->getBreadcrumbsThemeProvider()); + $this->assertNull($obj->getFooterThemeProvider()); + $this->assertNull($obj->getHookDropDownThemeProvider()); + $this->assertNull($obj->getNavigationThemeProvider()); + $this->assertNull($obj->getNotificationsDropDownThemeProvider()); + $this->assertNull($obj->getSearchThemeProvider()); + $this->assertNull($obj->getTasksDropDownThemeProvider()); + $this->assertNull($obj->getUserInfoThemeProvider()); } /** - * Tests the register() method. + * Tests the addGlobal() method. * * @return void * @depends testConstruct */ - public function testRegister() { + public function testAddGlobal() { $obj = new ThemeManager($this->twigEnvironment); - $obj->setApplicationProvider($this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock()); - $obj->setBreadcrumbsProvider($this->getMockBuilder(BreadcrumbsThemeProviderInterface::class)->getMock()); - $obj->setDropDownHookProvider($this->getMockBuilder(DropDownHookThemeProviderInterface::class)->getMock()); - $obj->setDropDownNotificationsProvider($this->getMockBuilder(DropDownNotificationsThemeProviderInterface::class)->getMock()); - $obj->setDropDownTasksProvider($this->getMockBuilder(DropDownTasksThemeProviderInterface::class)->getMock()); - $obj->setFooterProvider($this->getMockBuilder(FooterThemeProviderInterface::class)->getMock()); - $obj->setNavigationProvider($this->getMockBuilder(NavigationThemeProviderInterface::class)->getMock()); - $obj->setSearchProvider($this->getMockBuilder(SearchThemeProviderInterface::class)->getMock()); - $obj->setUserInfoProvider($this->getMockBuilder(UserInfoThemeProviderInterface::class)->getMock()); - - $obj->register(); + + // Set the Theme provider mocks. + $obj->setApplicationThemeProvider($this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock()); + $obj->setBreadcrumbsThemeProvider($this->getMockBuilder(BreadcrumbsThemeProviderInterface::class)->getMock()); + $obj->setHookDropDownThemeProvider($this->getMockBuilder(HookDropDownThemeProviderInterface::class)->getMock()); + $obj->setFooterThemeProvider($this->getMockBuilder(FooterThemeProviderInterface::class)->getMock()); + $obj->setNavigationThemeProvider($this->getMockBuilder(NavigationThemeProviderInterface::class)->getMock()); + $obj->setNotificationsDropDownThemeProvider($this->getMockBuilder(NotificationsDropDownThemeProviderInterface::class)->getMock()); + $obj->setSearchThemeProvider($this->getMockBuilder(SearchThemeProviderInterface::class)->getMock()); + $obj->setTasksDropDownThemeProvider($this->getMockBuilder(TasksDropDownThemeProviderInterface::class)->getMock()); + $obj->setUserInfoThemeProvider($this->getMockBuilder(UserInfoThemeProviderInterface::class)->getMock()); + + $obj->addGlobal(); $res = $this->twigEnvironment->getGlobals(); $this->assertCount(9, $res); - $this->assertArrayHasKey("ApplicationProvider", $res); - $this->assertInstanceOf(ApplicationThemeProviderInterface::class, $res["ApplicationProvider"]); + $this->assertArrayHasKey("ApplicationThemeProvider", $res); + $this->assertInstanceOf(ApplicationThemeProviderInterface::class, $res["ApplicationThemeProvider"]); - $this->assertArrayHasKey("BreadcrumbsProvider", $res); - $this->assertInstanceOf(BreadcrumbsThemeProviderInterface::class, $res["BreadcrumbsProvider"]); + $this->assertArrayHasKey("BreadcrumbsThemeProvider", $res); + $this->assertInstanceOf(BreadcrumbsThemeProviderInterface::class, $res["BreadcrumbsThemeProvider"]); - $this->assertArrayHasKey("DropDownHookProvider", $res); - $this->assertInstanceOf(DropDownHookThemeProviderInterface::class, $res["DropDownHookProvider"]); + $this->assertArrayHasKey("FooterThemeProvider", $res); + $this->assertInstanceOf(FooterThemeProviderInterface::class, $res["FooterThemeProvider"]); - $this->assertArrayHasKey("DropDownNotificationsProvider", $res); - $this->assertInstanceOf(DropDownNotificationsThemeProviderInterface::class, $res["DropDownNotificationsProvider"]); + $this->assertArrayHasKey("HookDropDownThemeProvider", $res); + $this->assertInstanceOf(HookDropDownThemeProviderInterface::class, $res["HookDropDownThemeProvider"]); - $this->assertArrayHasKey("DropDownTasksProvider", $res); - $this->assertInstanceOf(DropDownTasksThemeProviderInterface::class, $res["DropDownTasksProvider"]); + $this->assertArrayHasKey("NavigationThemeProvider", $res); + $this->assertInstanceOf(NavigationThemeProviderInterface::class, $res["NavigationThemeProvider"]); - $this->assertArrayHasKey("FooterProvider", $res); - $this->assertInstanceOf(FooterThemeProviderInterface::class, $res["FooterProvider"]); + $this->assertArrayHasKey("NotificationsDropDownThemeProvider", $res); + $this->assertInstanceOf(NotificationsDropDownThemeProviderInterface::class, $res["NotificationsDropDownThemeProvider"]); - $this->assertArrayHasKey("NavigationProvider", $res); - $this->assertInstanceOf(NavigationThemeProviderInterface::class, $res["NavigationProvider"]); + $this->assertArrayHasKey("TasksDropDownThemeProvider", $res); + $this->assertInstanceOf(TasksDropDownThemeProviderInterface::class, $res["TasksDropDownThemeProvider"]); - $this->assertArrayHasKey("SearchProvider", $res); - $this->assertInstanceOf(SearchThemeProviderInterface::class, $res["SearchProvider"]); + $this->assertArrayHasKey("SearchThemeProvider", $res); + $this->assertInstanceOf(SearchThemeProviderInterface::class, $res["SearchThemeProvider"]); - $this->assertArrayHasKey("UserInfoProvider", $res); - $this->assertInstanceOf(UserInfoThemeProviderInterface::class, $res["UserInfoProvider"]); + $this->assertArrayHasKey("UserInfoThemeProvider", $res); + $this->assertInstanceOf(UserInfoThemeProviderInterface::class, $res["UserInfoThemeProvider"]); } /** - * Tests the setApplicationProvider() method. + * Tests the setApplicationThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetApplicationProvider() { + public function testSetApplicationThemeProvider() { - // Set the mocks. + // Set the Application theme provider mock. $provider = $this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setApplicationProvider($provider); - $this->assertSame($provider, $obj->getApplicationProvider()); + $obj->setApplicationThemeProvider($provider); + $this->assertSame($provider, $obj->getApplicationThemeProvider()); } /** - * Tests the setBreadcrumbsProvider() method. + * Tests the setBreadcrumbsThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetBreadcrumbsProvider() { + public function testSetBreadcrumbsThemeProvider() { - // Set the mocks. + // Set the Breadcrumbs theme provider mock. $provider = $this->getMockBuilder(BreadcrumbsThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setBreadcrumbsProvider($provider); - $this->assertSame($provider, $obj->getBreadcrumbsProvider()); + $obj->setBreadcrumbsThemeProvider($provider); + $this->assertSame($provider, $obj->getBreadcrumbsThemeProvider()); } /** - * Tests the setDropDownHookProvider() method. + * Tests the setFooterThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetDropDownHookProvider() { + public function testSetFooterThemeProvider() { // Set the mocks. - $provider = $this->getMockBuilder(DropDownHookThemeProviderInterface::class)->getMock(); + $provider = $this->getMockBuilder(FooterThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setDropDownHookProvider($provider); - $this->assertSame($provider, $obj->getDropDownHookProvider()); + $obj->setFooterThemeProvider($provider); + $this->assertSame($provider, $obj->getFooterThemeProvider()); } /** - * Tests the setDropDownNotificationsProvider() method. + * Tests the setHookDropDownThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetDropDownNotificationsProvider() { + public function testSetHookDropDownThemeProvider() { // Set the mocks. - $provider = $this->getMockBuilder(DropDownNotificationsThemeProviderInterface::class)->getMock(); + $provider = $this->getMockBuilder(HookDropDownThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setDropDownNotificationsProvider($provider); - $this->assertSame($provider, $obj->getDropDownNotificationsProvider()); + $obj->setHookDropDownThemeProvider($provider); + $this->assertSame($provider, $obj->getHookDropDownThemeProvider()); } /** - * Tests the setDropDownTasksProvider() method. + * Tests the setNavigationThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetDropDownTasksProvider() { + public function testSetNavigationThemeProvider() { // Set the mocks. - $provider = $this->getMockBuilder(DropDownTasksThemeProviderInterface::class)->getMock(); + $provider = $this->getMockBuilder(NavigationThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setDropDownTasksProvider($provider); - $this->assertSame($provider, $obj->getDropDownTasksProvider()); + $obj->setNavigationThemeProvider($provider); + $this->assertSame($provider, $obj->getNavigationThemeProvider()); } /** - * Tests the setFooterProvider() method. + * Tests the setNotificationsDropDownThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetFooterProvider() { + public function testSetNotificationsDropDownThemeProvider() { // Set the mocks. - $provider = $this->getMockBuilder(FooterThemeProviderInterface::class)->getMock(); + $provider = $this->getMockBuilder(NotificationsDropDownThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setFooterProvider($provider); - $this->assertSame($provider, $obj->getFooterProvider()); + $obj->setNotificationsDropDownThemeProvider($provider); + $this->assertSame($provider, $obj->getNotificationsDropDownThemeProvider()); } /** - * Tests the setNavigationProvider() method. + * Tests the setSearchThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetNavigationProvider() { + public function testSetSearchThemeProvider() { // Set the mocks. - $provider = $this->getMockBuilder(NavigationThemeProviderInterface::class)->getMock(); + $provider = $this->getMockBuilder(SearchThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setNavigationProvider($provider); - $this->assertSame($provider, $obj->getNavigationProvider()); + $obj->setSearchThemeProvider($provider); + $this->assertSame($provider, $obj->getSearchThemeProvider()); } /** - * Tests the setSearchProvider() method. + * Tests the setTasksDropDownThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetSearchProvider() { + public function testSetTasksDropDownThemeProvider() { // Set the mocks. - $provider = $this->getMockBuilder(SearchThemeProviderInterface::class)->getMock(); + $provider = $this->getMockBuilder(TasksDropDownThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setSearchProvider($provider); - $this->assertSame($provider, $obj->getSearchProvider()); + $obj->setTasksDropDownThemeProvider($provider); + $this->assertSame($provider, $obj->getTasksDropDownThemeProvider()); } /** - * Tests the setUserInfoProvider() method. + * Tests the setUserInfoThemeProvider() method. * * @return void * @depends testConstruct */ - public function testSetUserInfoProvider() { + public function testSetUserInfoThemeProvider() { // Set the mocks. $provider = $this->getMockBuilder(UserInfoThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); - $obj->setUserInfoProvider($provider); - $this->assertSame($provider, $obj->getUserInfoProvider()); + $obj->setUserInfoThemeProvider($provider); + $this->assertSame($provider, $obj->getUserInfoThemeProvider()); } }