Fix tests

This commit is contained in:
Joas Schilling 2016-09-08 11:13:36 +02:00
parent 292b95462e
commit a44c1c748c
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with 15 additions and 7 deletions

View File

@ -110,7 +110,10 @@ class AdminControllerTest extends TestCase {
$this->updateChecker $this->updateChecker
->expects($this->once()) ->expects($this->once())
->method('getUpdateState') ->method('getUpdateState')
->willReturn(['updateVersion' => '8.1.2']); ->willReturn([
'updateVersion' => '8.1.2',
'downloadLink' => 'https://downloads.nextcloud.org/server',
]);
$params = [ $params = [
'isNewVersionAvailable' => true, 'isNewVersionAvailable' => true,
@ -119,6 +122,7 @@ class AdminControllerTest extends TestCase {
'channels' => $channels, 'channels' => $channels,
'newVersionString' => '8.1.2', 'newVersionString' => '8.1.2',
'notify_groups' => 'admin', 'notify_groups' => 'admin',
'downloadLink' => 'https://downloads.nextcloud.org/server',
]; ];
$expected = new TemplateResponse('updatenotification', 'admin', $params, ''); $expected = new TemplateResponse('updatenotification', 'admin', $params, '');
@ -163,6 +167,7 @@ class AdminControllerTest extends TestCase {
'channels' => $channels, 'channels' => $channels,
'newVersionString' => '', 'newVersionString' => '',
'notify_groups' => 'admin', 'notify_groups' => 'admin',
'downloadLink' => '',
]; ];
$expected = new TemplateResponse('updatenotification', 'admin', $params, ''); $expected = new TemplateResponse('updatenotification', 'admin', $params, '');

View File

@ -47,13 +47,14 @@ class UpdateCheckerTest extends TestCase {
->method('check') ->method('check')
->willReturn([ ->willReturn([
'version' => 123, 'version' => 123,
'versionstring' => 'ownCloud 123', 'versionstring' => 'Nextcloud 123',
'web'=> 'javascript:alert(1)', 'web'=> 'javascript:alert(1)',
'url'=> 'javascript:alert(2)',
]); ]);
$expected = [ $expected = [
'updateAvailable' => true, 'updateAvailable' => true,
'updateVersion' => 'ownCloud 123', 'updateVersion' => 'Nextcloud 123',
]; ];
$this->assertSame($expected, $this->updateChecker->getUpdateState()); $this->assertSame($expected, $this->updateChecker->getUpdateState());
} }
@ -64,14 +65,16 @@ class UpdateCheckerTest extends TestCase {
->method('check') ->method('check')
->willReturn([ ->willReturn([
'version' => 123, 'version' => 123,
'versionstring' => 'ownCloud 123', 'versionstring' => 'Nextcloud 123',
'web'=> 'https://owncloud.org/myUrl', 'web'=> 'https://docs.nextcloud.com/myUrl',
'url'=> 'https://downloads.nextcloud.org/server',
]); ]);
$expected = [ $expected = [
'updateAvailable' => true, 'updateAvailable' => true,
'updateVersion' => 'ownCloud 123', 'updateVersion' => 'Nextcloud 123',
'updateLink' => 'https://owncloud.org/myUrl', 'updateLink' => 'https://docs.nextcloud.com/myUrl',
'downloadLink' => 'https://downloads.nextcloud.org/server',
]; ];
$this->assertSame($expected, $this->updateChecker->getUpdateState()); $this->assertSame($expected, $this->updateChecker->getUpdateState());
} }