Work around change in SimpleXMLElement behavior introduced in PHP 7.3.17
[lhc/web/wiklou.git] / tests / phpunit / includes / ExportTest.php
index af10b9c..e17479a 100644 (file)
@@ -43,14 +43,11 @@ class ExportTest extends MediaWikiLangTestCase {
                /**
                 * Check namespaces match xml
                 */
-               $xmlNamespaces = (array)$xmlObject->siteinfo->namespaces->namespace;
-               $xmlNamespaces = str_replace( ' ', '_', $xmlNamespaces );
-               unset( $xmlNamespaces[ '@attributes' ] );
-               foreach ( $xmlNamespaces as &$namespaceObject ) {
-                       if ( is_object( $namespaceObject ) ) {
-                               $namespaceObject = '';
-                       }
+               foreach ( $xmlObject->siteinfo->namespaces->children() as $namespace ) {
+                       // Get the text content of the SimpleXMLElement
+                       $xmlNamespaces[] = (string)$namespace;
                }
+               $xmlNamespaces = str_replace( ' ', '_', $xmlNamespaces );
 
                $actualNamespaces = (array)MediaWikiServices::getInstance()->getContentLanguage()->
                        getNamespaces();