diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-16 22:56:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-16 22:56:10 +0100 |
commit | 57e0881a9eb206cb9c3894af600c5ccf4b8b8ff7 (patch) | |
tree | 5324fd4c47d74e24217fcd2b05558d5f300a5d69 /tests | |
parent | 45e7bb7f409d8d4585ef6f8cea76b422e246c2de (diff) | |
parent | 211212f4b3f2897672e3eec26cd073bbcfe85043 (diff) | |
download | nextcloud-server-57e0881a9eb206cb9c3894af600c5ccf4b8b8ff7.tar.gz nextcloud-server-57e0881a9eb206cb9c3894af600c5ccf4b8b8ff7.zip |
Merge pull request #8232 from nextcloud/bugfix/8007/validate-appinfo-against-appstore-schema
Validate appinfo against appstore schema
Diffstat (limited to 'tests')
-rw-r--r-- | tests/apps/testapp-dependency-missing/appinfo/info.xml | 9 | ||||
-rw-r--r-- | tests/apps/testapp-infoxml/appinfo/info.xml | 12 | ||||
-rw-r--r-- | tests/apps/testapp-name-missing/appinfo/info.xml | 11 | ||||
-rw-r--r-- | tests/apps/testapp-version/appinfo/info.xml | 11 | ||||
-rw-r--r-- | tests/apps/testapp-version/appinfo/version | 1 | ||||
-rw-r--r-- | tests/apps/testapp_dependency_missing/appinfo/info.xml | 13 | ||||
-rw-r--r-- | tests/apps/testapp_infoxml/appinfo/info.xml | 16 | ||||
-rw-r--r-- | tests/apps/testapp_name_missing/appinfo/info.xml | 15 | ||||
-rw-r--r-- | tests/apps/testapp_version/appinfo/info.xml | 15 | ||||
-rw-r--r-- | tests/lib/App/CodeChecker/InfoCheckerTest.php | 19 |
10 files changed, 70 insertions, 52 deletions
diff --git a/tests/apps/testapp-dependency-missing/appinfo/info.xml b/tests/apps/testapp-dependency-missing/appinfo/info.xml deleted file mode 100644 index c765400a76f..00000000000 --- a/tests/apps/testapp-dependency-missing/appinfo/info.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0"?> -<info> - <id>testapp-infoxml-version</id> - <version>1.2.3</version> - <author>Jane</author> - <description>A b c</description> - <licence>Abc</licence> - <name>Test app</name> -</info> diff --git a/tests/apps/testapp-infoxml/appinfo/info.xml b/tests/apps/testapp-infoxml/appinfo/info.xml deleted file mode 100644 index d4df1c3cd3f..00000000000 --- a/tests/apps/testapp-infoxml/appinfo/info.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<info> - <id>testapp-infoxml</id> - <version>1.2.3</version> - <author>Jane</author> - <description>A b c</description> - <licence>Abc</licence> - <name>Test app</name> - <dependencies> - <nextcloud min-version="12.0" max-version="12.0"/> - </dependencies> -</info> diff --git a/tests/apps/testapp-name-missing/appinfo/info.xml b/tests/apps/testapp-name-missing/appinfo/info.xml deleted file mode 100644 index 591c4361899..00000000000 --- a/tests/apps/testapp-name-missing/appinfo/info.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<info> - <id>testapp-version</id> - <version>1.1.1</version> - <author>Jane</author> - <description>A b c</description> - <licence>Abc</licence> - <dependencies> - <nextcloud min-version="12.0" max-version="12.0"/> - </dependencies> -</info> diff --git a/tests/apps/testapp-version/appinfo/info.xml b/tests/apps/testapp-version/appinfo/info.xml deleted file mode 100644 index 28e2475800f..00000000000 --- a/tests/apps/testapp-version/appinfo/info.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<info> - <id>testapp-version</id> - <author>Jane</author> - <description>A b c</description> - <licence>Abc</licence> - <name>Test app</name> - <dependencies> - <nextcloud min-version="12.0" max-version="12.0"/> - </dependencies> -</info> diff --git a/tests/apps/testapp-version/appinfo/version b/tests/apps/testapp-version/appinfo/version deleted file mode 100644 index 0495c4a88ca..00000000000 --- a/tests/apps/testapp-version/appinfo/version +++ /dev/null @@ -1 +0,0 @@ -1.2.3 diff --git a/tests/apps/testapp_dependency_missing/appinfo/info.xml b/tests/apps/testapp_dependency_missing/appinfo/info.xml new file mode 100644 index 00000000000..b0ca188aefc --- /dev/null +++ b/tests/apps/testapp_dependency_missing/appinfo/info.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> + <id>testapp_infoxml</id> + <name>Test app</name> + <summary>A b c</summary> + <description>A b c</description> + <version>1.2.3</version> + <licence>agpl</licence> + <author>Jane</author> + <category>games</category> + <bugs>https://example.org</bugs> +</info> diff --git a/tests/apps/testapp_infoxml/appinfo/info.xml b/tests/apps/testapp_infoxml/appinfo/info.xml new file mode 100644 index 00000000000..b7575687fe5 --- /dev/null +++ b/tests/apps/testapp_infoxml/appinfo/info.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> + <id>testapp_infoxml</id> + <name>Test app</name> + <summary>A b c</summary> + <description>A b c</description> + <version>1.2.3</version> + <licence>agpl</licence> + <author>Jane</author> + <category>games</category> + <bugs>https://example.org</bugs> + <dependencies> + <nextcloud min-version="12.0" max-version="12.0"/> + </dependencies> +</info> diff --git a/tests/apps/testapp_name_missing/appinfo/info.xml b/tests/apps/testapp_name_missing/appinfo/info.xml new file mode 100644 index 00000000000..872c8752c75 --- /dev/null +++ b/tests/apps/testapp_name_missing/appinfo/info.xml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> + <id>testapp_name_missing</id> + <summary>A b c</summary> + <description>A b c</description> + <version>1.2.3</version> + <licence>agpl</licence> + <author>Jane</author> + <category>games</category> + <bugs>https://example.org</bugs> + <dependencies> + <nextcloud min-version="12.0" max-version="12.0"/> + </dependencies> +</info> diff --git a/tests/apps/testapp_version/appinfo/info.xml b/tests/apps/testapp_version/appinfo/info.xml new file mode 100644 index 00000000000..3a48fccd45f --- /dev/null +++ b/tests/apps/testapp_version/appinfo/info.xml @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> + <id>testapp_version</id> + <name>Test app</name> + <summary>A b c</summary> + <description>A b c</description> + <licence>agpl</licence> + <author>Jane</author> + <category>games</category> + <bugs>https://example.org</bugs> + <dependencies> + <nextcloud min-version="12.0" max-version="12.0"/> + </dependencies> +</info> diff --git a/tests/lib/App/CodeChecker/InfoCheckerTest.php b/tests/lib/App/CodeChecker/InfoCheckerTest.php index 760d9880739..3128f902f47 100644 --- a/tests/lib/App/CodeChecker/InfoCheckerTest.php +++ b/tests/lib/App/CodeChecker/InfoCheckerTest.php @@ -44,19 +44,21 @@ class InfoCheckerTest extends TestCase { protected function setUp() { parent::setUp(); - $this->infoChecker = new InfoChecker(new InfoParser()); + $this->infoChecker = new InfoChecker(); } public function appInfoData() { return [ - ['testapp-infoxml', []], - ['testapp-version', [['type' => 'mandatoryFieldMissing', 'field' => 'version']]], - ['testapp-dependency-missing', [ - ['type' => 'missingRequirement', 'field' => 'min'], - ['type' => 'missingRequirement', 'field' => 'max'], - ['type' => 'mandatoryFieldMissing', 'field' => 'dependencies'], + ['testapp_infoxml', []], + ['testapp_version', [ + ['type' => 'parseError', 'field' => 'Element \'licence\': This element is not expected. Expected is one of ( description, version ).' . "\n"], + ]], + ['testapp_dependency_missing', [ + ['type' => 'parseError', 'field' => 'Element \'info\': Missing child element(s). Expected is one of ( repository, screenshot, dependencies ).' . "\n"], + ]], + ['testapp_name_missing', [ + ['type' => 'parseError', 'field' => 'Element \'summary\': This element is not expected. Expected is ( name ).' . "\n"], ]], - ['testapp-name-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'name']]], ]; } @@ -68,6 +70,7 @@ class InfoCheckerTest extends TestCase { */ public function testApps($appId, $expectedErrors) { $errors = $this->infoChecker->analyse($appId); + libxml_clear_errors(); $this->assertEquals($expectedErrors, $errors); } |