Selaa lähdekoodia

Remove deprecated at matcher in Updater/VersionCheckTest.php

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v25.0.0beta4
Côme Chilliet 1 vuosi sitten
vanhempi
commit
791e021455
No account linked to committer's email address
1 muutettua tiedostoa jossa 111 lisäystä ja 107 poistoa
  1. 111
    107
      tests/lib/Updater/VersionCheckTest.php

+ 111
- 107
tests/lib/Updater/VersionCheckTest.php Näytä tiedosto

]; ];


$this->config $this->config
->expects($this->at(0))
->expects($this->once())
->method('getSystemValueBool') ->method('getSystemValueBool')
->with('has_internet_connection', true) ->with('has_internet_connection', true)
->willReturn(true); ->willReturn(true);
$this->config $this->config
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn(time());
$this->config
->expects($this->at(2))
->expects($this->exactly(2))
->method('getAppValue') ->method('getAppValue')
->with('core', 'lastupdateResult')
->willReturn(json_encode($expectedResult));
->withConsecutive(
['core', 'lastupdatedat'],
['core', 'lastupdateResult']
)
->willReturnOnConsecutiveCalls(
time(),
json_encode($expectedResult)
);


$this->assertSame($expectedResult, $this->updater->check()); $this->assertSame($expectedResult, $this->updater->check());
} }
]; ];


$this->config $this->config
->expects($this->at(0))
->expects($this->once())
->method('getSystemValueBool') ->method('getSystemValueBool')
->with('has_internet_connection', true) ->with('has_internet_connection', true)
->willReturn(true); ->willReturn(true);
$this->config $this->config
->expects($this->at(1))
->expects($this->exactly(4))
->method('getAppValue') ->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn(0);
->withConsecutive(
['core', 'lastupdatedat'],
['core', 'installedat'],
['core', 'installedat'],
['core', 'lastupdatedat'],
)
->willReturnOnConsecutiveCalls(
0,
'installedat',
'installedat',
'lastupdatedat'
);
$this->config $this->config
->expects($this->at(2))
->expects($this->once())
->method('getSystemValue') ->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/') ->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1); ->willReturnArgument(1);
$this->config $this->config
->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->expects($this->exactly(2))
->method('setAppValue') ->method('setAppValue')
->with('core', 'lastupdateResult', json_encode($expectedResult));
->withConsecutive(
['core', 'lastupdatedat', $this->isType('integer')],
['core', 'lastupdateResult', json_encode($expectedResult)]
);


$updateXml = '<?xml version="1.0"?> $updateXml = '<?xml version="1.0"?>
<owncloud> <owncloud>


public function testCheckWithInvalidXml() { public function testCheckWithInvalidXml() {
$this->config $this->config
->expects($this->at(0))
->expects($this->once())
->method('getSystemValueBool') ->method('getSystemValueBool')
->with('has_internet_connection', true) ->with('has_internet_connection', true)
->willReturn(true); ->willReturn(true);
$this->config $this->config
->expects($this->at(1))
->expects($this->exactly(4))
->method('getAppValue') ->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn(0);
->withConsecutive(
['core', 'lastupdatedat'],
['core', 'installedat'],
['core', 'installedat'],
['core', 'lastupdatedat'],
)
->willReturnOnConsecutiveCalls(
0,
'installedat',
'installedat',
'lastupdatedat'
);
$this->config $this->config
->expects($this->at(2))
->expects($this->once())
->method('getSystemValue') ->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/') ->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1); ->willReturnArgument(1);
$this->config $this->config
->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->expects($this->exactly(2))
->method('setAppValue') ->method('setAppValue')
->with('core', 'lastupdateResult', '[]');
->withConsecutive(
['core', 'lastupdatedat', $this->isType('integer')],
['core', 'lastupdateResult', '[]']
);


$updateXml = 'Invalid XML Response!'; $updateXml = 'Invalid XML Response!';
$this->updater $this->updater
]; ];


$this->config $this->config
->expects($this->at(0))
->expects($this->once())
->method('getSystemValueBool') ->method('getSystemValueBool')
->with('has_internet_connection', true) ->with('has_internet_connection', true)
->willReturn(true); ->willReturn(true);
$this->config $this->config
->expects($this->at(1))
->expects($this->exactly(4))
->method('getAppValue') ->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn(0);
->withConsecutive(
['core', 'lastupdatedat'],
['core', 'installedat'],
['core', 'installedat'],
['core', 'lastupdatedat'],
)
->willReturnOnConsecutiveCalls(
0,
'installedat',
'installedat',
'lastupdatedat'
);
$this->config $this->config
->expects($this->at(2))
->expects($this->once())
->method('getSystemValue') ->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/') ->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1); ->willReturnArgument(1);
$this->config $this->config
->expects($this->at(3))
->expects($this->exactly(2))
->method('setAppValue') ->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn('lastupdatedat');
->withConsecutive(
['core', 'lastupdatedat', $this->isType('integer')],
['core', 'lastupdateResult', $this->isType('string')]
);


$updateXml = '<?xml version="1.0"?> $updateXml = '<?xml version="1.0"?>
<owncloud> <owncloud>
$expectedResult = []; $expectedResult = [];


$this->config $this->config
->expects($this->at(0))
->expects($this->once())
->method('getSystemValueBool') ->method('getSystemValueBool')
->with('has_internet_connection', true) ->with('has_internet_connection', true)
->willReturn(true); ->willReturn(true);
$this->config $this->config
->expects($this->at(1))
->expects($this->exactly(4))
->method('getAppValue') ->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn(0);
->withConsecutive(
['core', 'lastupdatedat'],
['core', 'installedat'],
['core', 'installedat'],
['core', 'lastupdatedat'],
)
->willReturnOnConsecutiveCalls(
0,
'installedat',
'installedat',
'lastupdatedat'
);
$this->config $this->config
->expects($this->at(2))
->expects($this->once())
->method('getSystemValue') ->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/') ->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1); ->willReturnArgument(1);
$this->config $this->config
->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->expects($this->exactly(2))
->method('setAppValue') ->method('setAppValue')
->with('core', 'lastupdateResult', json_encode($expectedResult));
->withConsecutive(
['core', 'lastupdatedat', $this->isType('integer')],
['core', 'lastupdateResult', json_encode($expectedResult)]
);


$updateXml = ''; $updateXml = '';
$this->updater $this->updater
]; ];


$this->config $this->config
->expects($this->at(0))
->expects($this->once())
->method('getSystemValueBool') ->method('getSystemValueBool')
->with('has_internet_connection', true) ->with('has_internet_connection', true)
->willReturn(true); ->willReturn(true);
$this->config $this->config
->expects($this->at(1))
->expects($this->exactly(4))
->method('getAppValue') ->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn(0);
->withConsecutive(
['core', 'lastupdatedat'],
['core', 'installedat'],
['core', 'installedat'],
['core', 'lastupdatedat'],
)
->willReturnOnConsecutiveCalls(
0,
'installedat',
'installedat',
'lastupdatedat'
);
$this->config $this->config
->expects($this->at(2))
->expects($this->once())
->method('getSystemValue') ->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/') ->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1); ->willReturnArgument(1);
$this->config $this->config
->expects($this->at(3))
->expects($this->exactly(2))
->method('setAppValue') ->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->willReturn('lastupdatedat');
->withConsecutive(
['core', 'lastupdatedat', $this->isType('integer')],
['core', 'lastupdateResult', $this->isType('string')]
);


// missing autoupdater element should still not fail // missing autoupdater element should still not fail
$updateXml = '<?xml version="1.0"?> $updateXml = '<?xml version="1.0"?>


public function testNoInternet() { public function testNoInternet() {
$this->config $this->config
->expects($this->at(0))
->expects($this->once())
->method('getSystemValueBool') ->method('getSystemValueBool')
->with('has_internet_connection', true) ->with('has_internet_connection', true)
->willReturn(false); ->willReturn(false);

Loading…
Peruuta
Tallenna