Skip to content

Commit 13ca01e

Browse files
committed
Fix unit tests for the theming app
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent a61331f commit 13ca01e

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

apps/theming/css/default.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,10 @@
5959
--primary-invert-if-bright: no;
6060
--background-invert-if-dark: no;
6161
--background-invert-if-bright: invert(100%);
62+
--image-logo: url('/core/img/logo/logo.png?v=0');
63+
--image-logoheader: url('/core/img/logo/logo.png?v=0');
64+
--image-favicon: url('/core/img/logo/logo.png?v=0');
65+
--image-background-size: cover;
66+
--image-background: url('/core/img/background.png?v=0');
67+
--image-login-background: url('/core/img/background.png?v=0');
6268
}

apps/theming/lib/Themes/DefaultTheme.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ public function getCSSVariables(): array {
191191
'--background-invert-if-bright' => 'invert(100%)',
192192
];
193193

194-
// Register image variables only if custom-defined
195194
$backgroundDeleted = $this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor';
196195
foreach(['logo', 'logoheader', 'favicon', 'background'] as $image) {
197196
// If primary as background has been request, let's not define the background image

apps/theming/tests/ImageManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public function testCleanup() {
307307
foreach ($folders as $index => $folder) {
308308
$folder->expects($this->any())
309309
->method('getName')
310-
->willReturn($index);
310+
->willReturn((string)$index);
311311
}
312312
$folders[0]->expects($this->once())->method('delete');
313313
$folders[1]->expects($this->once())->method('delete');

apps/theming/tests/Themes/DefaultThemeTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
*
2222
*/
23-
namespace OCA\Theming\Tests\Service;
23+
namespace OCA\Theming\Tests;
2424

2525
use OC\App\AppManager;
2626
use OCA\Theming\ImageManager;
@@ -68,6 +68,23 @@ protected function setUp(): void {
6868
->method('getColorPrimary')
6969
->willReturn('#0082c9');
7070

71+
$this->imageManager->expects($this->any())
72+
->method('getImageUrl')
73+
->willReturnCallback(function (string $name): string {
74+
switch ($name) {
75+
case 'logo':
76+
case 'logoheader':
77+
case 'favicon':
78+
return '/core/img/logo/logo.png?v=0';
79+
case 'background':
80+
case 'login-background':
81+
return '/core/img/background.png?v=0';
82+
default:
83+
return '';
84+
}
85+
});
86+
87+
7188
$this->l10n
7289
->expects($this->any())
7390
->method('t')

0 commit comments

Comments
 (0)