diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-03-02 13:24:06 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-03-06 14:36:34 +0000 |
commit | e55289572eae862c869e13fd49016bfcb8bccae3 (patch) | |
tree | e92eb5525be797c1cae14d95863921467afebc9d | |
parent | 68f205af5d90e48edb78fc23dd569298a4bf553a (diff) | |
download | nextcloud-server-e55289572eae862c869e13fd49016bfcb8bccae3.tar.gz nextcloud-server-e55289572eae862c869e13fd49016bfcb8bccae3.zip |
Add message for DoesNotExistException
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
-rw-r--r-- | lib/private/Updater/ChangesCheck.php | 4 | ||||
-rw-r--r-- | tests/lib/Updater/ChangesCheckTest.php | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php index 575a9ceadaf..a47eb7d5f08 100644 --- a/lib/private/Updater/ChangesCheck.php +++ b/lib/private/Updater/ChangesCheck.php @@ -54,8 +54,8 @@ class ChangesCheck { $version = $this->normalizeVersion($version); $changesInfo = $this->mapper->getChanges($version); $changesData = json_decode($changesInfo->getData(), true); - if(empty($changesData)) { - throw new DoesNotExistException(); + if (empty($changesData)) { + throw new DoesNotExistException('Unable to decode changes info'); } return $changesData; } diff --git a/tests/lib/Updater/ChangesCheckTest.php b/tests/lib/Updater/ChangesCheckTest.php index 2b1954ee48f..2e8ff9255d8 100644 --- a/tests/lib/Updater/ChangesCheckTest.php +++ b/tests/lib/Updater/ChangesCheckTest.php @@ -380,4 +380,21 @@ class ChangesCheckTest extends TestCase { $this->assertTrue(isset($data['whatsNew']['en']['regular'])); $this->assertTrue(isset($data['changelogURL'])); } + + public function testGetChangesForVersionEmptyData() { + $entry = $this->createMock(ChangesResult::class); + $entry->expects($this->once()) + ->method('__call') + ->with('getData') + ->willReturn(''); + + $this->mapper->expects($this->once()) + ->method('getChanges') + ->with('13.0.7') + ->willReturn($entry); + + $this->expectException(DoesNotExistException::class); + /** @noinspection PhpUnhandledExceptionInspection */ + $this->checker->getChangesForVersion('13.0.7'); + } } |