diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-08-11 20:36:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-11 20:36:40 +0200 |
commit | 68c4df0aa8eb7447eb7667b18dce4bbbaec6887b (patch) | |
tree | e0fb290666baa13d52d60a914db032da33245192 | |
parent | d2d96516a6197b28abbbe89aee1fbf402de9f7e1 (diff) | |
parent | 13ca01ee1256dba54d1e2793bd409d3b7c8d6058 (diff) | |
download | nextcloud-server-68c4df0aa8eb7447eb7667b18dce4bbbaec6887b.tar.gz nextcloud-server-68c4df0aa8eb7447eb7667b18dce4bbbaec6887b.zip |
Merge pull request #33510 from nextcloud/fix/nodb-tests
Fix unit tests for the theming app
-rw-r--r-- | apps/theming/css/default.css | 6 | ||||
-rw-r--r-- | apps/theming/lib/Themes/DefaultTheme.php | 1 | ||||
-rw-r--r-- | apps/theming/tests/ImageManagerTest.php | 2 | ||||
-rw-r--r-- | apps/theming/tests/Themes/DefaultThemeTest.php | 19 |
4 files changed, 25 insertions, 3 deletions
diff --git a/apps/theming/css/default.css b/apps/theming/css/default.css index fb541b7aca9..bf7ad0f89cc 100644 --- a/apps/theming/css/default.css +++ b/apps/theming/css/default.css @@ -59,4 +59,10 @@ --primary-invert-if-bright: no; --background-invert-if-dark: no; --background-invert-if-bright: invert(100%); + --image-logo: url('/core/img/logo/logo.png?v=0'); + --image-logoheader: url('/core/img/logo/logo.png?v=0'); + --image-favicon: url('/core/img/logo/logo.png?v=0'); + --image-background-size: cover; + --image-background: url('/core/img/background.png?v=0'); + --image-login-background: url('/core/img/background.png?v=0'); } diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index df444ebe2d2..d327b7db6d4 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -191,7 +191,6 @@ class DefaultTheme implements ITheme { '--background-invert-if-bright' => 'invert(100%)', ]; - // Register image variables only if custom-defined $backgroundDeleted = $this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor'; foreach(['logo', 'logoheader', 'favicon', 'background'] as $image) { // If primary as background has been request, let's not define the background image diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index 6a9b77234bb..0f22a774a39 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -307,7 +307,7 @@ class ImageManagerTest extends TestCase { foreach ($folders as $index => $folder) { $folder->expects($this->any()) ->method('getName') - ->willReturn($index); + ->willReturn((string)$index); } $folders[0]->expects($this->once())->method('delete'); $folders[1]->expects($this->once())->method('delete'); diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php index 160efdba142..5086c5da8ee 100644 --- a/apps/theming/tests/Themes/DefaultThemeTest.php +++ b/apps/theming/tests/Themes/DefaultThemeTest.php @@ -20,7 +20,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -namespace OCA\Theming\Tests\Service; +namespace OCA\Theming\Tests; use OC\App\AppManager; use OCA\Theming\ImageManager; @@ -68,6 +68,23 @@ class DefaultThemeTest extends TestCase { ->method('getColorPrimary') ->willReturn('#0082c9'); + $this->imageManager->expects($this->any()) + ->method('getImageUrl') + ->willReturnCallback(function (string $name): string { + switch ($name) { + case 'logo': + case 'logoheader': + case 'favicon': + return '/core/img/logo/logo.png?v=0'; + case 'background': + case 'login-background': + return '/core/img/background.png?v=0'; + default: + return ''; + } + }); + + $this->l10n ->expects($this->any()) ->method('t') |