From e92f8e0b6c02ec4df0043e4f4dce656e400305c1 Mon Sep 17 00:00:00 2001 From: webeweb Date: Fri, 28 Sep 2018 12:55:43 +0200 Subject: [PATCH] Fix theme provider replacement --- Manager/AbstractManager.php | 2 +- Tests/Manager/ThemeManagerTest.php | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Manager/AbstractManager.php b/Manager/AbstractManager.php index 89eea04e..1778fdcd 100644 --- a/Manager/AbstractManager.php +++ b/Manager/AbstractManager.php @@ -52,7 +52,7 @@ public function addProvider(ProviderInterface $provider) { * * @return ProviderInterface[] Returns the provider. */ - public function getProviders() { + public function &getProviders() { return $this->providers; } diff --git a/Tests/Manager/ThemeManagerTest.php b/Tests/Manager/ThemeManagerTest.php index e94967ee..e3817a0e 100644 --- a/Tests/Manager/ThemeManagerTest.php +++ b/Tests/Manager/ThemeManagerTest.php @@ -122,11 +122,14 @@ public function testAddGlobal() { */ public function testSetApplicationThemeProvider() { - // Set the Application theme provider mock. + // Set a Application theme provider mock. $provider = $this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); + $obj->setApplicationThemeProvider($this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock()); + $this->assertNotSame($provider, $obj->getApplicationThemeProvider()); + $obj->setApplicationThemeProvider($provider); $this->assertSame($provider, $obj->getApplicationThemeProvider()); } @@ -139,7 +142,7 @@ public function testSetApplicationThemeProvider() { */ public function testSetBreadcrumbsThemeProvider() { - // Set the Breadcrumbs theme provider mock. + // Set a Breadcrumbs theme provider mock. $provider = $this->getMockBuilder(BreadcrumbsThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); @@ -156,7 +159,7 @@ public function testSetBreadcrumbsThemeProvider() { */ public function testSetFooterThemeProvider() { - // Set the mocks. + // Set a Footer theme provider mock. $provider = $this->getMockBuilder(FooterThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); @@ -173,7 +176,7 @@ public function testSetFooterThemeProvider() { */ public function testSetHookDropDownThemeProvider() { - // Set the mocks. + // Set a Hook drop down theme provider mock. $provider = $this->getMockBuilder(HookDropDownThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); @@ -190,7 +193,7 @@ public function testSetHookDropDownThemeProvider() { */ public function testSetNavigationThemeProvider() { - // Set the mocks. + // Set a Navigation theme provider mock. $provider = $this->getMockBuilder(NavigationThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); @@ -207,7 +210,7 @@ public function testSetNavigationThemeProvider() { */ public function testSetNotificationsDropDownThemeProvider() { - // Set the mocks. + // Set a Notifications drop down theme provider mock. $provider = $this->getMockBuilder(NotificationsDropDownThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); @@ -224,7 +227,7 @@ public function testSetNotificationsDropDownThemeProvider() { */ public function testSetSearchThemeProvider() { - // Set the mocks. + // Set a Search theme provider mock. $provider = $this->getMockBuilder(SearchThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment); @@ -241,7 +244,7 @@ public function testSetSearchThemeProvider() { */ public function testSetTasksDropDownThemeProvider() { - // Set the mocks. + // Set a Tasks drop down theme provider mock. $provider = $this->getMockBuilder(TasksDropDownThemeProviderInterface::class)->getMock(); $obj = new ThemeManager($this->twigEnvironment);