From 77b6b7b23e68878038bab39839b48f1083f6e8b1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 14 Dec 2016 10:45:27 +0100 Subject: [PATCH] Use the mocked config version Signed-off-by: Joas Schilling --- lib/private/App/AppStore/Fetcher/AppFetcher.php | 2 +- tests/lib/App/AppStore/Fetcher/AppFetcherTest.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index bbe75c723d5..b8efdef4336 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -50,7 +50,7 @@ class AppFetcher extends Fetcher { $this->fileName = 'apps.json'; $this->config = $config; - $versionArray = \OC_Util::getVersion(); + $versionArray = explode('.', $this->config->getSystemValue('version')); $this->endpointUrl = sprintf( 'https://apps.nextcloud.com/api/v1/platform/%d.%d.%d/apps.json', $versionArray[0], diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index aa0d50cac97..a9cd5a190d0 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -58,6 +58,12 @@ EOD; $this->timeFactory = $this->createMock(ITimeFactory::class); $this->config = $this->createMock(IConfig::class); + $this->config + ->expects($this->atLeastOnce()) + ->method('getSystemValue') + ->with('version') + ->willReturn('11.0.0.2'); + $this->fetcher = new AppFetcher( $this->appData, $this->clientService, @@ -103,11 +109,6 @@ EOD; ->expects($this->once()) ->method('getTime') ->willReturn(1234); - $this->config - ->expects($this->once()) - ->method('getSystemValue') - ->with('version') - ->willReturn('11.0.0.2'); $expected = array ( 'data' => -- 2.39.5