diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-14 12:52:05 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-14 12:52:05 +0200 |
commit | e24007b5301f7381d4121ed915ed05909c34e755 (patch) | |
tree | 25ccd660254b7b55824eda46a631279953b2117d /tests | |
parent | 30a7eabad3f00fe10fa2d66725297a559aa82c3c (diff) | |
download | nextcloud-server-e24007b5301f7381d4121ed915ed05909c34e755.tar.gz nextcloud-server-e24007b5301f7381d4121ed915ed05909c34e755.zip |
Remove deprecated at matcher in tests/lib/InstallerTest.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/InstallerTest.php | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index 60c8ac1cc94..4e622dca6d1 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -576,30 +576,30 @@ MPLX6f5V9tCJtlH6ztmEcDROfvuVc0U3rEhqx2hphoyo+MZrPFpdcJL8KkIdMKbY ], ]; $this->appFetcher - ->expects($this->atLeastOnce()) + ->expects($this->once()) ->method('get') - ->willReturnOnConsecutiveCalls($appArray); + ->willReturn($appArray); $realTmpFile = \OC::$server->getTempManager()->getTemporaryFile('.tar.gz'); copy(__DIR__ . '/../data/testapp.tar.gz', $realTmpFile); $this->tempManager - ->expects($this->atLeastOnce()) + ->expects($this->once()) ->method('getTemporaryFile') ->with('.tar.gz') - ->willReturnOnConsecutiveCalls($realTmpFile); + ->willReturn($realTmpFile); $realTmpFolder = \OC::$server->getTempManager()->getTemporaryFolder(); $this->tempManager - ->expects($this->atLeastOnce()) + ->expects($this->once()) ->method('getTemporaryFolder') - ->willReturnOnConsecutiveCalls($realTmpFolder); + ->willReturn($realTmpFolder); $client = $this->createMock(IClient::class); $client ->expects($this->once()) ->method('get') ->with('https://example.com', ['sink' => $realTmpFile, 'timeout' => 120]); $this->clientService - ->expects($this->atLeastOnce()) + ->expects($this->once()) ->method('newClient') - ->willReturnOnConsecutiveCalls($client); + ->willReturn($client); $installer = $this->getInstaller(); $installer->downloadApp('testapp'); @@ -610,6 +610,14 @@ MPLX6f5V9tCJtlH6ztmEcDROfvuVc0U3rEhqx2hphoyo+MZrPFpdcJL8KkIdMKbY public function testDownloadAppWithDowngrade() { + // Use previous test to download the application in version 0.9 + $this->testDownloadAppSuccessful(); + + // Reset mocks + $this->appFetcher = $this->createMock(AppFetcher::class); + $this->clientService = $this->createMock(IClientService::class); + $this->tempManager = $this->createMock(ITempManager::class); + $this->expectException(\Exception::class); $this->expectExceptionMessage('App for id testapp has version 0.9 and tried to update to lower version 0.8'); @@ -662,19 +670,19 @@ JXhrdaWDZ8fzpUjugrtC3qslsqL0dzgU37anS3HwrT8=', ], ]; $this->appFetcher - ->expects($this->at(1)) + ->expects($this->once()) ->method('get') ->willReturn($appArray); $realTmpFile = \OC::$server->getTempManager()->getTemporaryFile('.tar.gz'); copy(__DIR__ . '/../data/testapp.0.8.tar.gz', $realTmpFile); $this->tempManager - ->expects($this->at(2)) + ->expects($this->once()) ->method('getTemporaryFile') ->with('.tar.gz') ->willReturn($realTmpFile); $realTmpFolder = \OC::$server->getTempManager()->getTemporaryFolder(); $this->tempManager - ->expects($this->at(3)) + ->expects($this->once()) ->method('getTemporaryFolder') ->willReturn($realTmpFolder); $client = $this->createMock(IClient::class); @@ -683,10 +691,9 @@ JXhrdaWDZ8fzpUjugrtC3qslsqL0dzgU37anS3HwrT8=', ->method('get') ->with('https://example.com', ['sink' => $realTmpFile, 'timeout' => 120]); $this->clientService - ->expects($this->at(1)) + ->expects($this->once()) ->method('newClient') ->willReturn($client); - $this->testDownloadAppSuccessful(); $this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml')); $this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); |