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

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-08-23 17:13:11 +0300
committerOlivier Paroz <github@oparoz.com>2015-08-23 17:13:11 +0300
commit0a567eefd204c771a7b5309b6cdec744da19c6bb (patch)
tree6ede6be1261ae2e2b41362659bc6a16d088101b9 /tests/unit
parent67aa384099f6625ddbfa67c4a13c1db108aeb809 (diff)
Test for ConfigController with a broken system
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/controller/ConfigControllerTest.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/controller/ConfigControllerTest.php b/tests/unit/controller/ConfigControllerTest.php
index 2c300bd6..52e7ceea 100644
--- a/tests/unit/controller/ConfigControllerTest.php
+++ b/tests/unit/controller/ConfigControllerTest.php
@@ -14,6 +14,8 @@ namespace OCA\Gallery\Controller;
use OCP\IRequest;
use OCP\ILogger;
+use OCP\AppFramework\Http\JSONResponse;
+
use OCA\Gallery\Service\ConfigService;
use OCA\Gallery\Service\PreviewService;
use OCA\Gallery\Service\ServiceException;
@@ -169,6 +171,22 @@ class ConfigControllerTest extends \Test\TestCase {
);
}
+ public function testGetConfigWithBrokenSystem() {
+ $slideshow = true;
+ $exceptionMessage = 'Aïe!';
+ $this->configService->expects($this->any())
+ ->method('getFeaturesList')
+ ->willThrowException(new ServiceException($exceptionMessage));
+ $errorMessage = [
+ 'message' => $exceptionMessage,
+ 'success' => false
+ ];
+ /** @type JSONResponse $response */
+ $response = $this->controller->get($slideshow);
+
+ $this->assertEquals($errorMessage, $response->getData());
+ }
+
/**
* Mocks ConfigService->getFeaturesList
*