public function testUpdateLogoNoData() {
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('logo');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn(null);
->willReturn(false);
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('favicon');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn([
public function testUpdateLogoInvalidMimeType() {
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('logo');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn([
touch($tmpLogo);
copy(__DIR__ . '/../../../../tests/data/testimage.png', $tmpLogo);
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('logo');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn([
touch($tmpLogo);
copy(__DIR__ . '/../../../../tests/data/desktopapp.png', $tmpLogo);
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('background');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn([
touch($tmpLogo);
file_put_contents($tmpLogo, file_get_contents(__DIR__ . '/../../../../tests/data/data.zip'));
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('logo');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn([
*/
public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload($error, $expectedErrorMessage) {
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('background');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn([
*/
public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage) {
$this->request
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getParam')
->with('key')
->willReturn('background');
$this->request
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getUploadedFile')
->with('image')
->willReturn([
->method('getName')
->willReturn('Nextcloud');
$this->urlGenerator
- ->expects($this->at(0))
+ ->expects($this->once())
->method('getBaseUrl')
->willReturn('localhost');
$this->urlGenerator
- ->expects($this->at(1))
+ ->expects($this->exactly(2))
->method('linkToRoute')
- ->with('theming.Icon.getTouchIcon', ['app' => 'core'])
- ->willReturn('touchicon');
- $this->urlGenerator
- ->expects($this->at(2))
- ->method('linkToRoute')
- ->with('theming.Icon.getFavicon', ['app' => 'core'])
- ->willReturn('favicon');
+ ->withConsecutive(
+ ['theming.Icon.getTouchIcon', ['app' => 'core']],
+ ['theming.Icon.getFavicon', ['app' => 'core']],
+ )->willReturnOnConsecutiveCalls(
+ 'touchicon',
+ 'favicon',
+ );
$response = new Http\JSONResponse([
'name' => 'Nextcloud',
'start_url' => 'localhost',
public function testSet() {
$this->config
- ->expects($this->at(0))
+ ->expects($this->exactly(2))
->method('setAppValue')
- ->with('theming', 'MySetting', 'MyValue');
+ ->withConsecutive(
+ ['theming', 'MySetting', 'MyValue'],
+ ['theming', 'cachebuster', 16],
+ );
$this->config
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getAppValue')
->with('theming', 'cachebuster', '0')
->willReturn('15');
- $this->config
- ->expects($this->at(2))
- ->method('setAppValue')
- ->with('theming', 'cachebuster', 16);
$this->cacheFactory
- ->expects($this->at(0))
+ ->expects($this->exactly(2))
->method('createDistributed')
- ->with('theming-')
- ->willReturn($this->cache);
- $this->cacheFactory
- ->expects($this->at(1))
- ->method('createDistributed')
- ->with('imagePath')
+ ->withConsecutive(
+ ['theming-'],
+ ['imagePath'],
+ )
->willReturn($this->cache);
$this->cache
->expects($this->any())
public function testUndoName() {
$this->config
- ->expects($this->at(0))
+ ->expects($this->once())
->method('deleteAppValue')
->with('theming', 'name');
$this->config
- ->expects($this->at(1))
+ ->expects($this->exactly(2))
->method('getAppValue')
- ->with('theming', 'cachebuster', '0')
- ->willReturn('15');
+ ->withConsecutive(
+ ['theming', 'cachebuster', '0'],
+ ['theming', 'name', 'Nextcloud'],
+ )->willReturnOnConsecutiveCalls(
+ '15',
+ 'Nextcloud',
+ );
$this->config
- ->expects($this->at(2))
+ ->expects($this->once())
->method('setAppValue')
->with('theming', 'cachebuster', 16);
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('theming', 'name', 'Nextcloud')
- ->willReturn('Nextcloud');
$this->assertSame('Nextcloud', $this->template->undo('name'));
}
public function testUndoBaseUrl() {
$this->config
- ->expects($this->at(0))
+ ->expects($this->once())
->method('deleteAppValue')
->with('theming', 'url');
$this->config
- ->expects($this->at(1))
+ ->expects($this->exactly(2))
->method('getAppValue')
- ->with('theming', 'cachebuster', '0')
- ->willReturn('15');
+ ->withConsecutive(
+ ['theming', 'cachebuster', '0'],
+ ['theming', 'url', $this->defaults->getBaseUrl()],
+ )->willReturnOnConsecutiveCalls(
+ '15',
+ $this->defaults->getBaseUrl(),
+ );
$this->config
- ->expects($this->at(2))
+ ->expects($this->once())
->method('setAppValue')
->with('theming', 'cachebuster', 16);
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('theming', 'url', $this->defaults->getBaseUrl())
- ->willReturn($this->defaults->getBaseUrl());
$this->assertSame($this->defaults->getBaseUrl(), $this->template->undo('url'));
}
public function testUndoSlogan() {
$this->config
- ->expects($this->at(0))
+ ->expects($this->once())
->method('deleteAppValue')
->with('theming', 'slogan');
$this->config
- ->expects($this->at(1))
+ ->expects($this->exactly(2))
->method('getAppValue')
- ->with('theming', 'cachebuster', '0')
- ->willReturn('15');
+ ->withConsecutive(
+ ['theming', 'cachebuster', '0'],
+ ['theming', 'slogan', $this->defaults->getSlogan()],
+ )->willReturnOnConsecutiveCalls(
+ '15',
+ $this->defaults->getSlogan(),
+ );
$this->config
- ->expects($this->at(2))
+ ->expects($this->once())
->method('setAppValue')
->with('theming', 'cachebuster', 16);
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('theming', 'slogan', $this->defaults->getSlogan())
- ->willReturn($this->defaults->getSlogan());
$this->assertSame($this->defaults->getSlogan(), $this->template->undo('slogan'));
}
public function testUndoColor() {
$this->config
- ->expects($this->at(0))
+ ->expects($this->once())
->method('deleteAppValue')
->with('theming', 'color');
$this->config
- ->expects($this->at(1))
+ ->expects($this->exactly(2))
->method('getAppValue')
- ->with('theming', 'cachebuster', '0')
- ->willReturn('15');
+ ->withConsecutive(
+ ['theming', 'cachebuster', '0'],
+ ['theming', 'color', $this->defaults->getColorPrimary()],
+ )->willReturnOnConsecutiveCalls(
+ '15',
+ $this->defaults->getColorPrimary(),
+ );
$this->config
- ->expects($this->at(2))
+ ->expects($this->once())
->method('setAppValue')
->with('theming', 'cachebuster', 16);
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('theming', 'color', $this->defaults->getColorPrimary())
- ->willReturn($this->defaults->getColorPrimary());
$this->assertSame($this->defaults->getColorPrimary(), $this->template->undo('color'));
}
public function testUndoDefaultAction() {
$this->config
- ->expects($this->at(0))
+ ->expects($this->once())
->method('deleteAppValue')
->with('theming', 'defaultitem');
$this->config
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getAppValue')
->with('theming', 'cachebuster', '0')
->willReturn('15');
$this->config
- ->expects($this->at(2))
+ ->expects($this->once())
->method('setAppValue')
->with('theming', 'cachebuster', 16);
->with('logo')
->willThrowException(new NotFoundException());
$this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('theming', 'logoMime')
- ->willReturn('');
- $this->config
- ->expects($this->at(1))
+ ->expects($this->exactly(2))
->method('getAppValue')
- ->with('theming', 'cachebuster', '0')
- ->willReturn('0');
+ ->withConsecutive(
+ ['theming', 'logoMime'],
+ ['theming', 'cachebuster', '0'],
+ )->willReturnOnConsecutiveCalls(
+ '',
+ '0'
+ );
$this->urlGenerator->expects($this->once())
->method('imagePath')
->with('core', $withName)
public function testGetLogoCustom() {
$this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('theming', 'logoMime', false)
- ->willReturn('image/svg+xml');
- $this->config
- ->expects($this->at(1))
+ ->expects($this->exactly(2))
->method('getAppValue')
- ->with('theming', 'cachebuster', '0')
- ->willReturn('0');
+ ->withConsecutive(
+ ['theming', 'logoMime', false],
+ ['theming', 'cachebuster', '0'],
+ )->willReturnOnConsecutiveCalls(
+ 'image/svg+xml',
+ '0',
+ );
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('theming.Theming.getImage')
}
public function testGetScssVariables() {
- $this->config->expects($this->at(0))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0');
- $this->config->expects($this->at(1))->method('getAppValue')->with('theming', 'logoMime', false)->willReturn('jpeg');
- $this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg');
- $this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'logoheaderMime', false)->willReturn('jpeg');
- $this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'faviconMime', false)->willReturn('jpeg');
-
- $this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'color', null)->willReturn($this->defaults->getColorPrimary());
- $this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary());
- $this->config->expects($this->at(7))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary());
- $this->config->expects($this->at(8))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary());
+ $this->config
+ ->expects($this->any())
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['theming', 'cachebuster', '0', '0'],
+ ['theming', 'logoMime', '', 'jpeg'],
+ ['theming', 'backgroundMime', '', 'jpeg'],
+ ['theming', 'logoheaderMime', '', 'jpeg'],
+ ['theming', 'faviconMime', '', 'jpeg'],
+ ['theming', 'color', '', $this->defaults->getColorPrimary()],
+ ['theming', 'color', $this->defaults->getColorPrimary(), $this->defaults->getColorPrimary()],
+ ]);
$this->util->expects($this->any())->method('invertTextColor')->with($this->defaults->getColorPrimary())->willReturn(false);
$this->util->expects($this->any())->method('elementColor')->with($this->defaults->getColorPrimary())->willReturn('#aaaaaa');
->with('theming-0-')
->willReturn($this->cache);
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(null);
- $this->imageManager->expects($this->at(0))->method('getImageUrl')->with('logo')->willReturn('custom-logo?v=0');
- $this->imageManager->expects($this->at(1))->method('getImageUrl')->with('logoheader')->willReturn('custom-logoheader?v=0');
- $this->imageManager->expects($this->at(2))->method('getImageUrl')->with('favicon')->willReturn('custom-favicon?v=0');
- $this->imageManager->expects($this->at(3))->method('getImageUrl')->with('background')->willReturn('custom-background?v=0');
+ $this->imageManager->expects($this->exactly(4))
+ ->method('getImageUrl')
+ ->willReturnMap([
+ ['logo', true, 'custom-logo?v=0'],
+ ['logoheader', true, 'custom-logoheader?v=0'],
+ ['favicon', true, 'custom-favicon?v=0'],
+ ['background', true, 'custom-background?v=0'],
+ ]);
$expected = [
'theming-cachebuster' => '\'0\'',