Merge pull request #21269 from owncloud/we-shall-cleanup-xml-parser-errors
Assert that there are no xml error left
This commit is contained in:
commit
1456e910ad
|
@ -59,6 +59,7 @@ class InfoParser {
|
|||
$xml = simplexml_load_file($file);
|
||||
libxml_disable_entity_loader($loadEntities);
|
||||
if ($xml == false) {
|
||||
libxml_clear_errors();
|
||||
return null;
|
||||
}
|
||||
$array = $this->xmlToArray($xml);
|
||||
|
|
|
@ -97,6 +97,7 @@ class OCSClient {
|
|||
libxml_disable_entity_loader($loadEntities);
|
||||
|
||||
if($data === false) {
|
||||
libxml_clear_errors();
|
||||
$this->logger->error(
|
||||
sprintf('Could not get %s, content was no valid XML', $action),
|
||||
[
|
||||
|
|
|
@ -177,6 +177,8 @@ class Updater extends BasicEmitter {
|
|||
$tmp['versionstring'] = (string)$data->versionstring;
|
||||
$tmp['url'] = (string)$data->url;
|
||||
$tmp['web'] = (string)$data->web;
|
||||
} else {
|
||||
libxml_clear_errors();
|
||||
}
|
||||
} else {
|
||||
$data = [];
|
||||
|
|
|
@ -12,8 +12,9 @@ namespace Test\App;
|
|||
use OC;
|
||||
use OC\App\Platform;
|
||||
use OCP\IL10N;
|
||||
use Test\TestCase;
|
||||
|
||||
class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
|
||||
class DependencyAnalyzer extends TestCase {
|
||||
|
||||
/** @var Platform */
|
||||
private $platformMock;
|
||||
|
|
|
@ -10,8 +10,9 @@
|
|||
namespace Test\App;
|
||||
|
||||
use OC;
|
||||
use Test\TestCase;
|
||||
|
||||
class InfoParser extends \PHPUnit_Framework_TestCase {
|
||||
class InfoParser extends TestCase {
|
||||
|
||||
/**
|
||||
* @var \OC\App\InfoParser
|
||||
|
|
|
@ -11,8 +11,9 @@ namespace Test\App;
|
|||
|
||||
use OC\Group\Group;
|
||||
use OC\User\User;
|
||||
use Test\TestCase;
|
||||
|
||||
class Manager extends \PHPUnit_Framework_TestCase {
|
||||
class Manager extends TestCase {
|
||||
/**
|
||||
* @return \OCP\IAppConfig | \PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
|
|
|
@ -92,6 +92,12 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
|
|||
throw $hookExceptions[0];
|
||||
}
|
||||
|
||||
// fail hard if xml errors have not been cleaned up
|
||||
$errors = libxml_get_errors();
|
||||
libxml_clear_errors();
|
||||
$this->assertEquals([], $errors);
|
||||
|
||||
// tearDown the traits
|
||||
$traits = $this->getTestTraits();
|
||||
foreach ($traits as $trait) {
|
||||
$methodName = 'tearDown' . basename(str_replace('\\', '/', $trait));
|
||||
|
@ -150,11 +156,13 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
public static function tearDownAfterClass() {
|
||||
$dataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data-autotest');
|
||||
$queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder();
|
||||
if (\OC::$server->getDatabaseConnection()) {
|
||||
$queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder();
|
||||
|
||||
self::tearDownAfterClassCleanShares($queryBuilder);
|
||||
self::tearDownAfterClassCleanStorages($queryBuilder);
|
||||
self::tearDownAfterClassCleanFileCache($queryBuilder);
|
||||
self::tearDownAfterClassCleanShares($queryBuilder);
|
||||
self::tearDownAfterClassCleanStorages($queryBuilder);
|
||||
self::tearDownAfterClassCleanFileCache($queryBuilder);
|
||||
}
|
||||
self::tearDownAfterClassCleanStrayDataFiles($dataDir);
|
||||
self::tearDownAfterClassCleanStrayHooks();
|
||||
self::tearDownAfterClassCleanStrayLocks();
|
||||
|
|
Loading…
Reference in New Issue