diff options
author | Olivier Paroz <github@oparoz.com> | 2015-08-23 17:13:11 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-08-23 17:13:11 +0300 |
commit | 0a567eefd204c771a7b5309b6cdec744da19c6bb (patch) | |
tree | 6ede6be1261ae2e2b41362659bc6a16d088101b9 /tests/unit | |
parent | 67aa384099f6625ddbfa67c4a13c1db108aeb809 (diff) |
Test for ConfigController with a broken system
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/controller/ConfigControllerTest.php | 18 |
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 * |