diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php index 7346ceab6b1ed..259fb750c05f2 100644 --- a/lib/private/Updater/ChangesCheck.php +++ b/lib/private/Updater/ChangesCheck.php @@ -56,8 +56,8 @@ public function getChangesForVersion(string $version): array { $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 30cb9df2956df..1bc8b47e58f51 100644 --- a/tests/lib/Updater/ChangesCheckTest.php +++ b/tests/lib/Updater/ChangesCheckTest.php @@ -380,4 +380,21 @@ public function testGetChangesForVersion(string $inputVersion, string $normalize $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'); + } }