<?php
+use MediaWiki\MediaWikiServices;
+
/**
* Test class for Export methods.
*
* @covers WikiExporter::pageByTitle
*/
public function testPageByTitle() {
- global $wgContLang;
$pageTitle = 'UTPage';
$exporter = new WikiExporter(
$title = Title::newFromText( $pageTitle );
- ob_start();
+ $sink = new DumpStringOutput;
+ $exporter->setOutputSink( $sink );
$exporter->openStream();
$exporter->pageByTitle( $title );
$exporter->closeStream();
- $xmlString = ob_get_clean();
// This throws error if invalid xml output
- $xmlObject = simplexml_load_string( $xmlString );
+ $xmlObject = simplexml_load_string( $sink );
/**
* Check namespaces match xml
}
}
- $actualNamespaces = (array)$wgContLang->getNamespaces();
+ $actualNamespaces = (array)MediaWikiServices::getInstance()->getContentLanguage()->
+ getNamespaces();
$actualNamespaces = array_values( $actualNamespaces );
$this->assertEquals( $actualNamespaces, $xmlNamespaces );