summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/apps/testapp-infoxml-version-different/appinfo/info.xml9
-rw-r--r--tests/apps/testapp-infoxml-version-different/appinfo/version1
-rw-r--r--tests/apps/testapp-infoxml-version/appinfo/info.xml9
-rw-r--r--tests/apps/testapp-infoxml-version/appinfo/version1
-rw-r--r--tests/apps/testapp-infoxml/appinfo/info.xml9
-rw-r--r--tests/apps/testapp-name-missing/appinfo/info.xml8
-rw-r--r--tests/apps/testapp-version-missing/appinfo/info.xml8
-rw-r--r--tests/apps/testapp-version/appinfo/info.xml8
-rw-r--r--tests/apps/testapp-version/appinfo/version1
-rw-r--r--tests/lib/app/codechecker/infocheckertest.php73
10 files changed, 127 insertions, 0 deletions
diff --git a/tests/apps/testapp-infoxml-version-different/appinfo/info.xml b/tests/apps/testapp-infoxml-version-different/appinfo/info.xml
new file mode 100644
index 00000000000..c765400a76f
--- /dev/null
+++ b/tests/apps/testapp-infoxml-version-different/appinfo/info.xml
@@ -0,0 +1,9 @@
+<?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-version-different/appinfo/version b/tests/apps/testapp-infoxml-version-different/appinfo/version
new file mode 100644
index 00000000000..e8ea05db814
--- /dev/null
+++ b/tests/apps/testapp-infoxml-version-different/appinfo/version
@@ -0,0 +1 @@
+1.2.4
diff --git a/tests/apps/testapp-infoxml-version/appinfo/info.xml b/tests/apps/testapp-infoxml-version/appinfo/info.xml
new file mode 100644
index 00000000000..c765400a76f
--- /dev/null
+++ b/tests/apps/testapp-infoxml-version/appinfo/info.xml
@@ -0,0 +1,9 @@
+<?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-version/appinfo/version b/tests/apps/testapp-infoxml-version/appinfo/version
new file mode 100644
index 00000000000..0495c4a88ca
--- /dev/null
+++ b/tests/apps/testapp-infoxml-version/appinfo/version
@@ -0,0 +1 @@
+1.2.3
diff --git a/tests/apps/testapp-infoxml/appinfo/info.xml b/tests/apps/testapp-infoxml/appinfo/info.xml
new file mode 100644
index 00000000000..cb63a0fc76e
--- /dev/null
+++ b/tests/apps/testapp-infoxml/appinfo/info.xml
@@ -0,0 +1,9 @@
+<?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>
+</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..f0a62b8d380
--- /dev/null
+++ b/tests/apps/testapp-name-missing/appinfo/info.xml
@@ -0,0 +1,8 @@
+<?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>
+</info>
diff --git a/tests/apps/testapp-version-missing/appinfo/info.xml b/tests/apps/testapp-version-missing/appinfo/info.xml
new file mode 100644
index 00000000000..d7da3e07e36
--- /dev/null
+++ b/tests/apps/testapp-version-missing/appinfo/info.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<info>
+ <id>testapp-version</id>
+ <author>Jane</author>
+ <description>A b c</description>
+ <licence>Abc</licence>
+ <name>Test app</name>
+</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..d7da3e07e36
--- /dev/null
+++ b/tests/apps/testapp-version/appinfo/info.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<info>
+ <id>testapp-version</id>
+ <author>Jane</author>
+ <description>A b c</description>
+ <licence>Abc</licence>
+ <name>Test app</name>
+</info>
diff --git a/tests/apps/testapp-version/appinfo/version b/tests/apps/testapp-version/appinfo/version
new file mode 100644
index 00000000000..0495c4a88ca
--- /dev/null
+++ b/tests/apps/testapp-version/appinfo/version
@@ -0,0 +1 @@
+1.2.3
diff --git a/tests/lib/app/codechecker/infocheckertest.php b/tests/lib/app/codechecker/infocheckertest.php
new file mode 100644
index 00000000000..59c1316b769
--- /dev/null
+++ b/tests/lib/app/codechecker/infocheckertest.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\App\CodeChecker;
+
+use OC\App\InfoParser;
+use Test\TestCase;
+
+class InfoCheckerTest extends TestCase {
+ /** @var InfoChecker */
+ protected $infoChecker;
+
+ public static function setUpBeforeClass() {
+ \OC::$APPSROOTS[] = [
+ 'path' => \OC::$SERVERROOT . '/tests/apps',
+ 'url' => '/apps-test',
+ 'writable' => false,
+ ];
+ }
+
+ public static function tearDownAfterClass() {
+ // remove last element
+ array_pop(\OC::$APPSROOTS);
+ }
+
+ protected function setUp() {
+ parent::setUp();
+ $infoParser = new InfoParser(\OC::$server->getHTTPHelper(), \OC::$server->getURLGenerator());
+
+ $this->infoChecker = new InfoChecker($infoParser);
+ }
+
+ public function appInfoData() {
+ return [
+ ['testapp-infoxml', []],
+ ['testapp-version', []],
+ ['testapp-infoxml-version', []],
+ ['testapp-infoxml-version-different', [['type' => 'differentVersions', 'message' => 'appinfo/version: 1.2.4 - appinfo/info.xml: 1.2.3']]],
+ ['testapp-version-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'version']]],
+ ['testapp-name-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'name']]],
+ ];
+ }
+
+ /**
+ * @dataProvider appInfoData
+ *
+ * @param $appId
+ * @param $expectedErrors
+ */
+ public function testApps($appId, $expectedErrors) {
+ $errors = $this->infoChecker->analyse($appId);
+
+ $this->assertEquals($expectedErrors, $errors);
+ }
+}