diff options
author | Robin Appelman <robin@icewind.nl> | 2018-04-12 13:28:25 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-04-18 18:32:19 +0300 |
commit | 5fbba7854b433e8b77ecb09edf0b804c233ae2aa (patch) | |
tree | 5fa67df7ed63c097e69b515626c11de55f47ebd3 /tests | |
parent | fa65aaf1fc8836e1a0e5ee1ffe38ee032a487892 (diff) |
fix appinfo parsing when a single localized option is provided
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/app/description-multi-lang.xml | 8 | ||||
-rw-r--r-- | tests/data/app/description-single-lang.xml | 7 | ||||
-rw-r--r-- | tests/lib/AppTest.php | 14 |
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/data/app/description-multi-lang.xml b/tests/data/app/description-multi-lang.xml new file mode 100644 index 00000000000..e7eee3bcb8b --- /dev/null +++ b/tests/data/app/description-multi-lang.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<info> + <id>files_encryption</id> + <name>Server-side Encryption</name> + <description lang="en">English</description> + <description lang="de">German</description> + <licence>AGPL</licence> +</info> diff --git a/tests/data/app/description-single-lang.xml b/tests/data/app/description-single-lang.xml new file mode 100644 index 00000000000..5fb1ba07e8e --- /dev/null +++ b/tests/data/app/description-single-lang.xml @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<info> + <id>files_encryption</id> + <name>Server-side Encryption</name> + <description lang="en">English</description> + <licence>AGPL</licence> +</info> diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index 620e9344c43..03e7a70f7be 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -9,6 +9,7 @@ namespace Test; +use OC\App\InfoParser; use OC\AppConfig; use OCP\IAppConfig; @@ -605,5 +606,18 @@ class AppTest extends \Test\TestCase { public function testParseAppInfo(array $data, array $expected) { $this->assertSame($expected, \OC_App::parseAppInfo($data)); } + + public function testParseAppInfoL10N() { + $parser = new InfoParser(); + $data = $parser->parse(\OC::$SERVERROOT. "/tests/data/app/description-multi-lang.xml"); + $this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']); + $this->assertEquals('German', \OC_App::parseAppInfo($data, 'de')['description']); + } + + public function testParseAppInfoL10NSingleLanguage() { + $parser = new InfoParser(); + $data = $parser->parse(\OC::$SERVERROOT. "/tests/data/app/description-single-lang.xml"); + $this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']); + } } |