summaryrefslogtreecommitdiffstats
path: root/tests/lib/app/infoparser.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/app/infoparser.php')
-rw-r--r--tests/lib/app/infoparser.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/lib/app/infoparser.php b/tests/lib/app/infoparser.php
index 277e1582e45..20668c05086 100644
--- a/tests/lib/app/infoparser.php
+++ b/tests/lib/app/infoparser.php
@@ -39,15 +39,24 @@ class InfoParser extends \PHPUnit_Framework_TestCase {
$this->parser = new \OC\App\InfoParser($httpHelper, $urlGenerator);
}
- public function testParsingValidXml() {
- $expectedData = json_decode(file_get_contents(OC::$SERVERROOT.'/tests/data/app/expected-info.json'), true);
- $data = $this->parser->parse(OC::$SERVERROOT.'/tests/data/app/valid-info.xml');
+ /**
+ * @dataProvider providesInfoXml
+ */
+ public function testParsingValidXml($expectedJson, $xmlFile) {
+ $expectedData = null;
+ if (!is_null($expectedJson)) {
+ $expectedData = json_decode(file_get_contents(OC::$SERVERROOT . "/tests/data/app/$expectedJson"), true);
+ }
+ $data = $this->parser->parse(OC::$SERVERROOT. "/tests/data/app/$xmlFile");
$this->assertEquals($expectedData, $data);
}
- public function testParsingInvalidXml() {
- $data = $this->parser->parse(OC::$SERVERROOT.'/tests/data/app/invalid-info.xml');
- $this->assertNull($data);
+ function providesInfoXml() {
+ return array(
+ array('expected-info.json', 'valid-info.xml'),
+ array('strange-types-info.json', 'strange-types-info.xml'),
+ array(null, 'invalid-info.xml'),
+ );
}
}