mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
* Don't parse info.xml but reuse already cached app infos - fixes #25603 * Use === in InfoParser. Fixes test * InfoParser should not depend on UrlGenerator - fixes issue with session being closed too early
44 lines
910 B
PHP
44 lines
910 B
PHP
<?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;
|
|
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");
|
|
|
|
$this->assertEquals($expectedData, $data);
|
|
}
|
|
|
|
function providesInfoXml() {
|
|
return array(
|
|
array('expected-info.json', 'valid-info.xml'),
|
|
array(null, 'invalid-info.xml'),
|
|
);
|
|
}
|
|
}
|