Fix tests

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-01-11 10:57:26 +01:00 committed by Lukas Reschke
parent 1a7d713883
commit fcfb4205bc
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
2 changed files with 20 additions and 16 deletions

View File

@ -1304,10 +1304,10 @@ class OC_App {
$data['summary'] = self::findBestL10NOption($data['summary'], $lang); $data['summary'] = self::findBestL10NOption($data['summary'], $lang);
} }
if ($lang && isset($data['description']) && is_array($data['description'])) { if ($lang && isset($data['description']) && is_array($data['description'])) {
$data['description'] = self::findBestL10NOption($data['description'], $lang); $data['description'] = trim(self::findBestL10NOption($data['description'], $lang));
} } else if (isset($data['description']) && is_string($data['description'])) {
$data['description'] = trim($data['description']);
if (!isset($data['description'])) { } else {
$data['description'] = ''; $data['description'] = '';
} }
@ -1315,10 +1315,10 @@ class OC_App {
} }
/** /**
* @param $config * @param \OCP\IConfig $config
* @param $l * @param \OCP\IL10N $l
* @param $info * @param array $info
* @throws Exception * @throws \Exception
*/ */
protected static function checkAppDependencies($config, $l, $info) { protected static function checkAppDependencies($config, $l, $info) {
$dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l); $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l);

View File

@ -8,6 +8,7 @@
*/ */
namespace Test; namespace Test;
use OC\AppConfig; use OC\AppConfig;
use OCP\IAppConfig; use OCP\IAppConfig;
@ -24,7 +25,7 @@ class AppTest extends \Test\TestCase {
const TEST_GROUP1 = 'group1'; const TEST_GROUP1 = 'group1';
const TEST_GROUP2 = 'group2'; const TEST_GROUP2 = 'group2';
function appVersionsProvider() { public function appVersionsProvider() {
return array( return array(
// exact match // exact match
array( array(
@ -338,7 +339,7 @@ class AppTest extends \Test\TestCase {
/** /**
* Providers for the app config values * Providers for the app config values
*/ */
function appConfigValuesProvider() { public function appConfigValuesProvider() {
return array( return array(
// logged in user1 // logged in user1
array( array(
@ -561,27 +562,30 @@ class AppTest extends \Test\TestCase {
/** /**
* Providers for the app data values * Providers for the app data values
*/ */
function appDataProvider() { public function appDataProvider() {
return [ return [
[ [
['description' => " \t This is a multiline \n test with \n \t \n \n some new lines "], ['description' => " \t This is a multiline \n test with \n \t \n \n some new lines "],
['description' => "This is a multiline test with\n\nsome new lines"] ['description' => "This is a multiline \n test with \n \t \n \n some new lines"],
], ],
[ [
['description' => " \t This is a multiline \n test with \n \t some new lines "], ['description' => " \t This is a multiline \n test with \n \t some new lines "],
['description' => "This is a multiline test with some new lines"] ['description' => "This is a multiline \n test with \n \t some new lines"],
], ],
[ [
['description' => hex2bin('5065726d657420646520732761757468656e7469666965722064616e732070697769676f20646972656374656d656e74206176656320736573206964656e74696669616e7473206f776e636c6f75642073616e73206c65732072657461706572206574206d657420c3a0206a6f757273206365757820636920656e20636173206465206368616e67656d656e74206465206d6f742064652070617373652e0d0a0d')], ['description' => hex2bin('5065726d657420646520732761757468656e7469666965722064616e732070697769676f20646972656374656d656e74206176656320736573206964656e74696669616e7473206f776e636c6f75642073616e73206c65732072657461706572206574206d657420c3a0206a6f757273206365757820636920656e20636173206465206368616e67656d656e74206465206d6f742064652070617373652e0d0a0d')],
['description' => "Permet de s'authentifier dans piwigo directement avec ses identifiants owncloud sans les retaper et met à jours ceux ci en cas de changement de mot de passe."] ['description' => "Permet de s'authentifier dans piwigo directement avec ses identifiants owncloud sans les retaper et met à jours ceux ci en cas de changement de mot de passe."],
], ],
[ [
['not-a-description' => " \t This is a multiline \n test with \n \t some new lines "], ['not-a-description' => " \t This is a multiline \n test with \n \t some new lines "],
['not-a-description' => " \t This is a multiline \n test with \n \t some new lines "] [
'not-a-description' => " \t This is a multiline \n test with \n \t some new lines ",
'description' => '',
],
], ],
[ [
['description' => [100, 'bla']], ['description' => [100, 'bla']],
['description' => ""] ['description' => ''],
], ],
]; ];
} }