summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-02-07 16:03:21 +0100
committerJoas Schilling <coding@schilljs.com>2018-02-16 10:23:51 +0100
commit17a26dfcc1f4d02b54e6cbb500f41bbe25609f1e (patch)
tree045682f754bec9284239df359715660148251011 /tests
parent620ee00ac5d176e85ba0dd9dd10cff6d1ef5172f (diff)
downloadnextcloud-server-17a26dfcc1f4d02b54e6cbb500f41bbe25609f1e.tar.gz
nextcloud-server-17a26dfcc1f4d02b54e6cbb500f41bbe25609f1e.zip
Validate the info.xml against the appstore schema file
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/apps/testapp-dependency-missing/appinfo/info.xml9
-rw-r--r--tests/apps/testapp-infoxml/appinfo/info.xml12
-rw-r--r--tests/apps/testapp-name-missing/appinfo/info.xml11
-rw-r--r--tests/apps/testapp-version/appinfo/info.xml11
-rw-r--r--tests/apps/testapp-version/appinfo/version1
-rw-r--r--tests/apps/testapp_dependency_missing/appinfo/info.xml13
-rw-r--r--tests/apps/testapp_infoxml/appinfo/info.xml16
-rw-r--r--tests/apps/testapp_name_missing/appinfo/info.xml15
-rw-r--r--tests/apps/testapp_version/appinfo/info.xml15
-rw-r--r--tests/lib/App/CodeChecker/InfoCheckerTest.php19
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..9f354a4611c 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(\OC::$server->getAppManager());
}
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);
}