mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #40419 from nextcloud/fix/remove-at-matcher-in-installer-test
Remove deprecated at matcher in tests/lib/InstallerTest.php
This commit is contained in:
commit
b36fb96984
1 changed files with 20 additions and 13 deletions
|
|
@ -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/'));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue