<?php
+use MediaWiki\MediaWikiServices;
+
/**
* Test class for Export methods.
*
* @covers WikiExporter::pageByTitle
*/
public function testPageByTitle() {
- global $wgContLang;
$pageTitle = 'UTPage';
$exporter = new WikiExporter(
/**
* 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)$wgContLang->getNamespaces();
+ $actualNamespaces = (array)MediaWikiServices::getInstance()->getContentLanguage()->
+ getNamespaces();
$actualNamespaces = array_values( $actualNamespaces );
$this->assertEquals( $actualNamespaces, $xmlNamespaces );