|
|
|
|
@ -28,8 +28,7 @@ use Test\TestCase;
|
|
|
|
|
class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
private IAppConfig&MockObject $appConfig;
|
|
|
|
|
private IConfig&MockObject $config;
|
|
|
|
|
private \OC_Defaults $defaults;
|
|
|
|
|
private IL10N|MockObject $l10n;
|
|
|
|
|
private IL10N&MockObject $l10n;
|
|
|
|
|
private IUserSession&MockObject $userSession;
|
|
|
|
|
private IURLGenerator&MockObject $urlGenerator;
|
|
|
|
|
private ICacheFactory&MockObject $cacheFactory;
|
|
|
|
|
@ -39,6 +38,8 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
private ImageManager&MockObject $imageManager;
|
|
|
|
|
private INavigationManager&MockObject $navigationManager;
|
|
|
|
|
private BackgroundService&MockObject $backgroundService;
|
|
|
|
|
|
|
|
|
|
private \OC_Defaults $defaults;
|
|
|
|
|
private ThemingDefaults $template;
|
|
|
|
|
|
|
|
|
|
protected function setUp(): void {
|
|
|
|
|
@ -76,9 +77,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetNameWithDefault(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('Nextcloud');
|
|
|
|
|
|
|
|
|
|
@ -86,9 +87,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetNameWithCustom(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('MyCustomCloud');
|
|
|
|
|
|
|
|
|
|
@ -96,9 +97,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetHTMLNameWithDefault(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('Nextcloud');
|
|
|
|
|
|
|
|
|
|
@ -106,9 +107,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetHTMLNameWithCustom(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('MyCustomCloud');
|
|
|
|
|
|
|
|
|
|
@ -116,9 +117,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetTitleWithDefault(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('Nextcloud');
|
|
|
|
|
|
|
|
|
|
@ -126,9 +127,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetTitleWithCustom(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('MyCustomCloud');
|
|
|
|
|
|
|
|
|
|
@ -137,9 +138,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testGetEntityWithDefault(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('Nextcloud');
|
|
|
|
|
|
|
|
|
|
@ -147,9 +148,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetEntityWithCustom(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('MyCustomCloud');
|
|
|
|
|
|
|
|
|
|
@ -157,9 +158,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetBaseUrlWithDefault(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'url', $this->defaults->getBaseUrl())
|
|
|
|
|
->willReturn($this->defaults->getBaseUrl());
|
|
|
|
|
|
|
|
|
|
@ -167,9 +168,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetBaseUrlWithCustom(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'url', $this->defaults->getBaseUrl())
|
|
|
|
|
->willReturn('https://example.com/');
|
|
|
|
|
|
|
|
|
|
@ -185,9 +186,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('legalUrlProvider')]
|
|
|
|
|
public function testGetImprintURL(string $imprintUrl): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'imprintUrl', '')
|
|
|
|
|
->willReturn($imprintUrl);
|
|
|
|
|
|
|
|
|
|
@ -196,9 +197,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('legalUrlProvider')]
|
|
|
|
|
public function testGetPrivacyURL(string $privacyUrl): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'privacyUrl', '')
|
|
|
|
|
->willReturn($privacyUrl);
|
|
|
|
|
|
|
|
|
|
@ -206,9 +207,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetSloganWithDefault(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'slogan', $this->defaults->getSlogan())
|
|
|
|
|
->willReturn($this->defaults->getSlogan());
|
|
|
|
|
|
|
|
|
|
@ -216,9 +217,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetSloganWithCustom(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'slogan', $this->defaults->getSlogan())
|
|
|
|
|
->willReturn('My custom Slogan');
|
|
|
|
|
|
|
|
|
|
@ -226,9 +227,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetShortFooter(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -242,9 +243,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
public function testGetShortFooterEmptyUrl(): void {
|
|
|
|
|
$this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), ''],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -258,9 +259,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
public function testGetShortFooterEmptySlogan(): void {
|
|
|
|
|
$this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -274,9 +275,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
public function testGetShortFooterImprint(): void {
|
|
|
|
|
$this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -295,9 +296,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
public function testGetShortFooterPrivacy(): void {
|
|
|
|
|
$this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -316,9 +317,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
public function testGetShortFooterAllLegalLinks(): void {
|
|
|
|
|
$this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -345,9 +346,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('invalidLegalUrlProvider')]
|
|
|
|
|
public function testGetShortFooterInvalidImprint(string $invalidImprintUrl): void {
|
|
|
|
|
$this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -362,9 +363,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('invalidLegalUrlProvider')]
|
|
|
|
|
public function testGetShortFooterInvalidPrivacy(string $invalidPrivacyUrl): void {
|
|
|
|
|
$this->navigationManager->expects($this->once())->method('getAll')->with(INavigationManager::TYPE_GUEST)->willReturn([]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->exactly(5))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), 'url'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Name'],
|
|
|
|
|
@ -476,19 +477,19 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testSet(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setAppValue')
|
|
|
|
|
->method('setValueInt')
|
|
|
|
|
->with('theming', 'cachebuster', 16);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setValueString')
|
|
|
|
|
->with('theming', 'MySetting', 'MyValue');
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->with('theming', 'cachebuster', '0')
|
|
|
|
|
->willReturn('15');
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(15);
|
|
|
|
|
$this->cacheFactory
|
|
|
|
|
->expects($this->exactly(2))
|
|
|
|
|
->method('createDistributed')
|
|
|
|
|
@ -504,96 +505,105 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUndoName(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('deleteAppValue')
|
|
|
|
|
->method('deleteKey')
|
|
|
|
|
->with('theming', 'name');
|
|
|
|
|
$this->config
|
|
|
|
|
->expects($this->exactly(2))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'cachebuster', '0', '15'],
|
|
|
|
|
['theming', 'name', 'Nextcloud', 'Nextcloud'],
|
|
|
|
|
]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(15);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'name', 'Nextcloud')
|
|
|
|
|
->willReturn('Nextcloud');
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setValueInt')
|
|
|
|
|
->with('theming', 'cachebuster', 16);
|
|
|
|
|
|
|
|
|
|
$this->assertSame('Nextcloud', $this->template->undo('name'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUndoBaseUrl(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('deleteAppValue')
|
|
|
|
|
->method('deleteKey')
|
|
|
|
|
->with('theming', 'url');
|
|
|
|
|
$this->config
|
|
|
|
|
->expects($this->exactly(2))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'cachebuster', '0', '15'],
|
|
|
|
|
['theming', 'url', $this->defaults->getBaseUrl(), $this->defaults->getBaseUrl()],
|
|
|
|
|
]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setAppValue')
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(15);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'url', $this->defaults->getBaseUrl())
|
|
|
|
|
->willReturn($this->defaults->getBaseUrl());
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setValueInt')
|
|
|
|
|
->with('theming', 'cachebuster', 16);
|
|
|
|
|
|
|
|
|
|
$this->assertSame($this->defaults->getBaseUrl(), $this->template->undo('url'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUndoSlogan(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('deleteAppValue')
|
|
|
|
|
->method('deleteKey')
|
|
|
|
|
->with('theming', 'slogan');
|
|
|
|
|
$this->config
|
|
|
|
|
->expects($this->exactly(2))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'cachebuster', '0', '15'],
|
|
|
|
|
['theming', 'slogan', $this->defaults->getSlogan(), $this->defaults->getSlogan()],
|
|
|
|
|
]);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(15);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'slogan', $this->defaults->getSlogan())
|
|
|
|
|
->willReturn($this->defaults->getSlogan());
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setValueInt')
|
|
|
|
|
->with('theming', 'cachebuster', 16);
|
|
|
|
|
|
|
|
|
|
$this->assertSame($this->defaults->getSlogan(), $this->template->undo('slogan'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUndoPrimaryColor(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('deleteAppValue')
|
|
|
|
|
->method('deleteKey')
|
|
|
|
|
->with('theming', 'primary_color');
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->with('theming', 'cachebuster', '0')
|
|
|
|
|
->willReturn('15');
|
|
|
|
|
$this->config
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(15);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setAppValue')
|
|
|
|
|
->method('setValueInt')
|
|
|
|
|
->with('theming', 'cachebuster', 16);
|
|
|
|
|
|
|
|
|
|
$this->assertSame($this->defaults->getColorPrimary(), $this->template->undo('primary_color'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUndoDefaultAction(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('deleteAppValue')
|
|
|
|
|
->method('deleteKey')
|
|
|
|
|
->with('theming', 'defaultitem');
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster', '0')
|
|
|
|
|
->willReturn('15');
|
|
|
|
|
$this->config
|
|
|
|
|
->willReturn(15);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('setAppValue')
|
|
|
|
|
->method('setValueInt')
|
|
|
|
|
->with('theming', 'cachebuster', 16);
|
|
|
|
|
|
|
|
|
|
$this->assertSame('', $this->template->undo('defaultitem'));
|
|
|
|
|
@ -613,13 +623,16 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
->method('getImage')
|
|
|
|
|
->with('logo')
|
|
|
|
|
->willThrowException(new NotFoundException());
|
|
|
|
|
$this->config
|
|
|
|
|
->expects($this->exactly(2))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'logoMime', '', ''],
|
|
|
|
|
['theming', 'cachebuster', '0', '0'],
|
|
|
|
|
]);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'logoMime', '')
|
|
|
|
|
->willReturn('');
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(0);
|
|
|
|
|
$this->urlGenerator->expects($this->once())
|
|
|
|
|
->method('imagePath')
|
|
|
|
|
->with('core', $withName)
|
|
|
|
|
@ -636,13 +649,16 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetLogoCustom(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
->expects($this->exactly(2))
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'logoMime', '', 'image/svg+xml'],
|
|
|
|
|
['theming', 'cachebuster', '0', '0'],
|
|
|
|
|
]);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'logoMime', '')
|
|
|
|
|
->willReturn('image/svg+xml');
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(0);
|
|
|
|
|
$this->urlGenerator->expects($this->once())
|
|
|
|
|
->method('linkToRoute')
|
|
|
|
|
->with('theming.Theming.getImage')
|
|
|
|
|
@ -651,7 +667,10 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetScssVariablesCached(): void {
|
|
|
|
|
$this->config->expects($this->any())->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('1');
|
|
|
|
|
$this->appConfig->expects($this->any())
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(1);
|
|
|
|
|
$this->cacheFactory->expects($this->once())
|
|
|
|
|
->method('createDistributed')
|
|
|
|
|
->with('theming-1-')
|
|
|
|
|
@ -661,21 +680,20 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetScssVariables(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig->expects($this->any())
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(0);
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->any())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'cachebuster', '0', '0'],
|
|
|
|
|
['theming', 'imprintUrl', '', ''],
|
|
|
|
|
['theming', 'privacyUrl', '', ''],
|
|
|
|
|
['theming', 'logoMime', '', 'jpeg'],
|
|
|
|
|
['theming', 'backgroundMime', '', 'jpeg'],
|
|
|
|
|
['theming', 'logoheaderMime', '', 'jpeg'],
|
|
|
|
|
['theming', 'faviconMime', '', 'jpeg'],
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects(self::atLeastOnce())
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->willReturnMap([
|
|
|
|
|
['theming', 'primary_color', '', false, $this->defaults->getColorPrimary()],
|
|
|
|
|
['theming', 'primary_color', $this->defaults->getColorPrimary(), false, $this->defaults->getColorPrimary()],
|
|
|
|
|
]);
|
|
|
|
|
@ -716,9 +734,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetDefaultAndroidURL(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'AndroidClientUrl', 'https://play.google.com/store/apps/details?id=com.nextcloud.client')
|
|
|
|
|
->willReturn('https://play.google.com/store/apps/details?id=com.nextcloud.client');
|
|
|
|
|
|
|
|
|
|
@ -726,9 +744,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetCustomAndroidURL(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'AndroidClientUrl', 'https://play.google.com/store/apps/details?id=com.nextcloud.client')
|
|
|
|
|
->willReturn('https://play.google.com/store/apps/details?id=com.mycloud.client');
|
|
|
|
|
|
|
|
|
|
@ -736,9 +754,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetDefaultiOSURL(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'iOSClientUrl', 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8')
|
|
|
|
|
->willReturn('https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8');
|
|
|
|
|
|
|
|
|
|
@ -746,9 +764,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetCustomiOSURL(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'iOSClientUrl', 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8')
|
|
|
|
|
->willReturn('https://geo.itunes.apple.com/us/app/nextcloud/id1234567890?mt=8');
|
|
|
|
|
|
|
|
|
|
@ -756,9 +774,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetDefaultiTunesAppId(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'iTunesAppId', '1125420102')
|
|
|
|
|
->willReturn('1125420102');
|
|
|
|
|
|
|
|
|
|
@ -766,9 +784,9 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetCustomiTunesAppId(): void {
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->method('getValueString')
|
|
|
|
|
->with('theming', 'iTunesAppId', '1125420102')
|
|
|
|
|
->willReturn('1234567890');
|
|
|
|
|
|
|
|
|
|
@ -790,11 +808,11 @@ class ThemingDefaultsTest extends TestCase {
|
|
|
|
|
->method('get')
|
|
|
|
|
->with('shouldReplaceIcons')
|
|
|
|
|
->willReturn(true);
|
|
|
|
|
$this->config
|
|
|
|
|
$this->appConfig
|
|
|
|
|
->expects($this->any())
|
|
|
|
|
->method('getAppValue')
|
|
|
|
|
->with('theming', 'cachebuster', '0')
|
|
|
|
|
->willReturn('0');
|
|
|
|
|
->method('getValueInt')
|
|
|
|
|
->with('theming', 'cachebuster')
|
|
|
|
|
->willReturn(0);
|
|
|
|
|
$this->urlGenerator
|
|
|
|
|
->expects($this->any())
|
|
|
|
|
->method('linkToRoute')
|
|
|
|
|
|