nextcloud/tests/lib/App/InfoParserTest.php

45 lines
910 B
PHP
Raw Normal View History

<?php
/**
* @author Thomas Müller
* @copyright 2014 Thomas Müller deepdiver@owncloud.com
* later.
* See the COPYING-README file.
*/
namespace Test\App;
use OC;
use OC\App\InfoParser;
2015-12-17 19:29:17 +03:00
use Test\TestCase;
class InfoParserTest extends TestCase {
/** @var InfoParser */
private $parser;
public function setUp() {
$this->parser = new InfoParser();
}
/**
* @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");
2014-11-24 19:26:07 +03:00
$this->assertEquals($expectedData, $data);
}
2014-11-25 12:22:06 +03:00
function providesInfoXml() {
return array(
array('expected-info.json', 'valid-info.xml'),
array(null, 'invalid-info.xml'),
);
2014-11-25 12:22:06 +03:00
}
}