diff options
author | Joas Schilling <coding@schilljs.com> | 2018-02-07 16:03:21 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-02-16 10:23:51 +0100 |
commit | 17a26dfcc1f4d02b54e6cbb500f41bbe25609f1e (patch) | |
tree | 045682f754bec9284239df359715660148251011 /tests/lib/App/CodeChecker/InfoCheckerTest.php | |
parent | 620ee00ac5d176e85ba0dd9dd10cff6d1ef5172f (diff) | |
download | nextcloud-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/lib/App/CodeChecker/InfoCheckerTest.php')
-rw-r--r-- | tests/lib/App/CodeChecker/InfoCheckerTest.php | 19 |
1 files changed, 11 insertions, 8 deletions
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); } |