From 520d8ec53b672e768e59eaf0409559bbecc6c042 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 13 Jan 2015 14:48:30 +0100 Subject: OC_App::parseAppInfo * replace line breaks (on non empty lines) in the app description by spaces * fixes #13315 * includes unit tests --- tests/lib/app.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/lib/app.php b/tests/lib/app.php index 23c1a340e03..529de82e670 100644 --- a/tests/lib/app.php +++ b/tests/lib/app.php @@ -459,5 +459,34 @@ class Test_App extends \Test\TestCase { // Remove the cache of the mocked apps list with a forceRefresh \OC_App::getEnabledApps(true); } + + /** + * Providers for the app data values + */ + function appDataProvider() { + return [ + [ + ['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' => " \t This is a multiline \n test with \n \t some new lines "], + ['description' => "This is a multiline test with 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 "] + ], + ]; + } + + /** + * Test app info parser + * + * @dataProvider appDataProvider + */ + public function testParseAppInfo($data, $expected) { + $this->assertEquals($expected, \OC_App::parseAppInfo($data)); + } } -- cgit v1.2.3