Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2017-09-20 13:32:41 +0300
committerJulius Härtl <jus@bitgrid.net>2017-10-03 16:32:50 +0300
commitc337c8fa454366384bec12e889e4dd371c0a67f7 (patch)
tree7019ce7d0fdf93b6a4a5d5af53fc2209b9201483 /apps/theming/tests
parent42bd94261904574d807d9cf1917f6283b08287ac (diff)
Theming: Handle errors on uploaded files properly
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/tests')
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php41
1 files changed, 25 insertions, 16 deletions
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index c03eccb6eef..96a742cfa37 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -131,8 +131,9 @@ class ThemingControllerTest extends TestCase {
$this->l10n
->expects($this->once())
->method('t')
- ->with($message)
- ->willReturn($message);
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$this->scssCacher
->expects($this->once())
->method('getCachedSCSS')
@@ -183,8 +184,9 @@ class ThemingControllerTest extends TestCase {
$this->l10n
->expects($this->once())
->method('t')
- ->with($message)
- ->willReturn($message);
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$expected = new DataResponse(
[
@@ -215,10 +217,11 @@ class ThemingControllerTest extends TestCase {
->with('upload-login-background')
->willReturn(null);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('No file uploaded')
- ->willReturn('No file uploaded');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$expected = new DataResponse(
[
@@ -282,6 +285,7 @@ class ThemingControllerTest extends TestCase {
'tmp_name' => $tmpLogo,
'type' => 'text/svg',
'name' => 'logo.svg',
+ 'error' => 0,
]);
$this->request
->expects($this->at(2))
@@ -289,10 +293,11 @@ class ThemingControllerTest extends TestCase {
->with('upload-login-background')
->willReturn(null);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('Saved')
- ->willReturn('Saved');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$file = $this->createMock(ISimpleFile::class);
@@ -357,12 +362,14 @@ class ThemingControllerTest extends TestCase {
'tmp_name' => $tmpLogo,
'type' => 'text/svg',
'name' => 'logo.svg',
+ 'error' => 0,
]);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('Saved')
- ->willReturn('Saved');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
@@ -425,12 +432,14 @@ class ThemingControllerTest extends TestCase {
'tmp_name' => $tmpLogo,
'type' => 'text/svg',
'name' => 'logo.svg',
+ 'error' => 0,
]);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('Unsupported image type')
- ->willReturn('Unsupported image type');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$folder = $this->createMock(ISimpleFolder::class);
$this->appData