]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add message for DoesNotExistException 19817/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>
Fri, 6 Mar 2020 14:36:39 +0000 (14:36 +0000)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
lib/private/Updater/ChangesCheck.php
tests/lib/Updater/ChangesCheckTest.php

index 575a9ceadaf34d4c86e25c686ac8aed2822a518e..a47eb7d5f0875747d441759929e66aecd75098de 100644 (file)
@@ -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;
        }
index 2b1954ee48f2312b16987f04c8f09b5b1c24827d..2e8ff9255d8818bf4799cc782666a0f01ce9c59d 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');
+       }
 }