adjust tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
bafb6b3c29
commit
1e0761c6b8
|
@ -59,7 +59,7 @@ class UpdateChecker {
|
||||||
if (strpos($data['changelog'], 'https://') === 0) {
|
if (strpos($data['changelog'], 'https://') === 0) {
|
||||||
$result['changelog'] = $data['changelog'];
|
$result['changelog'] = $data['changelog'];
|
||||||
}
|
}
|
||||||
if($data['whatsNew'] !== null) {
|
if (is_array($data['whatsNew']) && count($data['whatsNew']) <= 3) {
|
||||||
$result['whatsNew'] = $data['whatsNew'];
|
$result['whatsNew'] = $data['whatsNew'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,8 @@ class AdminTest extends TestCase {
|
||||||
'updateAvailable' => true,
|
'updateAvailable' => true,
|
||||||
'updateVersion' => '8.1.2',
|
'updateVersion' => '8.1.2',
|
||||||
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
||||||
|
'changelog' => 'https://nextcloud.com/changelog/#8.1.2',
|
||||||
|
'whatsNew' => ['Autoshare to mother-in-law', 'Faster backend', 'Sparkling frontend'],
|
||||||
'updaterEnabled' => true,
|
'updaterEnabled' => true,
|
||||||
'versionIsEol' => false,
|
'versionIsEol' => false,
|
||||||
]);
|
]);
|
||||||
|
@ -124,6 +126,8 @@ class AdminTest extends TestCase {
|
||||||
'channels' => $channels,
|
'channels' => $channels,
|
||||||
'newVersionString' => '8.1.2',
|
'newVersionString' => '8.1.2',
|
||||||
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
||||||
|
'changelogURL' => 'https://nextcloud.com/changelog/#8.1.2',
|
||||||
|
'whatsNew' => ['Autoshare to mother-in-law', 'Faster backend', 'Sparkling frontend'],
|
||||||
'updaterEnabled' => true,
|
'updaterEnabled' => true,
|
||||||
'versionIsEol' => false,
|
'versionIsEol' => false,
|
||||||
'isDefaultUpdateServerURL' => true,
|
'isDefaultUpdateServerURL' => true,
|
||||||
|
|
|
@ -51,6 +51,8 @@ class UpdateCheckerTest extends TestCase {
|
||||||
'versionstring' => 'Nextcloud 123',
|
'versionstring' => 'Nextcloud 123',
|
||||||
'web'=> 'javascript:alert(1)',
|
'web'=> 'javascript:alert(1)',
|
||||||
'url'=> 'javascript:alert(2)',
|
'url'=> 'javascript:alert(2)',
|
||||||
|
'changelog' => 'javascript:alert(3)',
|
||||||
|
'whatsNew' => 'javascript:alert(4)',
|
||||||
'autoupdater'=> '0',
|
'autoupdater'=> '0',
|
||||||
'eol'=> '1',
|
'eol'=> '1',
|
||||||
]);
|
]);
|
||||||
|
@ -73,6 +75,8 @@ class UpdateCheckerTest extends TestCase {
|
||||||
'versionstring' => 'Nextcloud 123',
|
'versionstring' => 'Nextcloud 123',
|
||||||
'web'=> 'https://docs.nextcloud.com/myUrl',
|
'web'=> 'https://docs.nextcloud.com/myUrl',
|
||||||
'url'=> 'https://downloads.nextcloud.org/server',
|
'url'=> 'https://downloads.nextcloud.org/server',
|
||||||
|
'changelog' => 'https://nextcloud.com/changelog/#123.0.0',
|
||||||
|
'whatsNew' => ['Brews coffee', 'Makes appointments', 'Orchestrates Terminators'],
|
||||||
'autoupdater'=> '1',
|
'autoupdater'=> '1',
|
||||||
'eol'=> '0',
|
'eol'=> '0',
|
||||||
]);
|
]);
|
||||||
|
@ -84,6 +88,8 @@ class UpdateCheckerTest extends TestCase {
|
||||||
'versionIsEol' => false,
|
'versionIsEol' => false,
|
||||||
'updateLink' => 'https://docs.nextcloud.com/myUrl',
|
'updateLink' => 'https://docs.nextcloud.com/myUrl',
|
||||||
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
||||||
|
'changelog' => 'https://nextcloud.com/changelog/#123.0.0',
|
||||||
|
'whatsNew' => ['Brews coffee', 'Makes appointments', 'Orchestrates Terminators'],
|
||||||
];
|
];
|
||||||
$this->assertSame($expected, $this->updateChecker->getUpdateState());
|
$this->assertSame($expected, $this->updateChecker->getUpdateState());
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ class VersionCheck {
|
||||||
$tmp['versionstring'] = (string)$data->versionstring;
|
$tmp['versionstring'] = (string)$data->versionstring;
|
||||||
$tmp['url'] = (string)$data->url;
|
$tmp['url'] = (string)$data->url;
|
||||||
$tmp['web'] = (string)$data->web;
|
$tmp['web'] = (string)$data->web;
|
||||||
$tmp['changelog'] = isset($data->changelog) ? (string)$data->changelog : null;
|
$tmp['changelog'] = isset($data->changelog) ? (string)$data->changelog : '';
|
||||||
// TODO: one's it is decided, use the proper field…
|
// TODO: one's it is decided, use the proper field…
|
||||||
$tmp['whatsNew'] = isset($data->whatsNew) ? ((array)$data->whatsNew)['item'] : null;
|
$tmp['whatsNew'] = isset($data->whatsNew) ? ((array)$data->whatsNew)['item'] : null;
|
||||||
$tmp['whatsNew'] = isset($data->whatsNew_admin) ? ((array)$data->whatsNew_admin)['item'] : (string)$data->whatsNew;
|
$tmp['whatsNew'] = isset($data->whatsNew_admin) ? ((array)$data->whatsNew_admin)['item'] : (string)$data->whatsNew;
|
||||||
|
|
|
@ -84,6 +84,8 @@ class VersionCheckTest extends \Test\TestCase {
|
||||||
'versionstring' => 'ownCloud 8.0.4',
|
'versionstring' => 'ownCloud 8.0.4',
|
||||||
'url' => 'https://download.example.org/community/owncloud-8.0.4.zip',
|
'url' => 'https://download.example.org/community/owncloud-8.0.4.zip',
|
||||||
'web' => 'http://doc.example.org/server/8.0/admin_manual/maintenance/upgrade.html',
|
'web' => 'http://doc.example.org/server/8.0/admin_manual/maintenance/upgrade.html',
|
||||||
|
'changelog' => '',
|
||||||
|
'whatsNew' => '',
|
||||||
'autoupdater' => '0',
|
'autoupdater' => '0',
|
||||||
'eol' => '1',
|
'eol' => '1',
|
||||||
];
|
];
|
||||||
|
@ -181,6 +183,8 @@ class VersionCheckTest extends \Test\TestCase {
|
||||||
'versionstring' => '',
|
'versionstring' => '',
|
||||||
'url' => '',
|
'url' => '',
|
||||||
'web' => '',
|
'web' => '',
|
||||||
|
'changelog' => '',
|
||||||
|
'whatsNew' => '',
|
||||||
'autoupdater' => '',
|
'autoupdater' => '',
|
||||||
'eol' => '0',
|
'eol' => '0',
|
||||||
];
|
];
|
||||||
|
@ -275,6 +279,8 @@ class VersionCheckTest extends \Test\TestCase {
|
||||||
'versionstring' => '',
|
'versionstring' => '',
|
||||||
'url' => '',
|
'url' => '',
|
||||||
'web' => '',
|
'web' => '',
|
||||||
|
'changelog' => '',
|
||||||
|
'whatsNew' => '',
|
||||||
'autoupdater' => '',
|
'autoupdater' => '',
|
||||||
'eol' => '0',
|
'eol' => '0',
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue