]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add message for DoesNotExistException 19744/head
authorDaniel Kesselberg <mail@danielkesselberg.de>
Mon, 2 Mar 2020 12:24:06 +0000 (13:24 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 2 Mar 2020 15:20:38 +0000 (15:20 +0000)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
lib/private/Updater/ChangesCheck.php
tests/lib/Updater/ChangesCheckTest.php

index 7346ceab6b1ed887e144ab370c83fb3c49447561..259fb750c05f2bbfeb15e99532c36ced9d12a7c5 100644 (file)
@@ -56,8 +56,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;
        }
index 30cb9df2956df415d16506957aa840bec74572ac..1bc8b47e58f51c3a1c015d94b8216dd725fce914 100644 (file)
@@ -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');
+       }
 }