RevisionTest: Make @covers tags absolute (re-apply)
[lhc/web/wiklou.git] / tests / phpunit / includes / ExportTest.php
index 2026030..a5d3570 100644 (file)
@@ -11,11 +11,9 @@ class ExportTest extends MediaWikiLangTestCase {
 
        protected function setUp() {
                parent::setUp();
-               $this->setMwGlobals( array(
-                       'wgContLang' => Language::factory( 'en' ),
-                       'wgLanguageCode' => 'en',
+               $this->setMwGlobals( [
                        'wgCapitalLinks' => true,
-               ) );
+               ] );
        }
 
        /**
@@ -32,39 +30,37 @@ class ExportTest extends MediaWikiLangTestCase {
 
                $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
-                * FIXME: PHP 5.3 support. When we don't support PHP 5.3,
-                * add ->namespace to object and remove from array
                 */
-               $xmlNamespaces = (array) $xmlObject->siteinfo->namespaces;
-               $xmlNamespaces = str_replace( ' ', '_', $xmlNamespaces['namespace'] );
-               unset ( $xmlNamespaces[ '@attributes' ] );
+               $xmlNamespaces = (array)$xmlObject->siteinfo->namespaces->namespace;
+               $xmlNamespaces = str_replace( ' ', '_', $xmlNamespaces );
+               unset( $xmlNamespaces[ '@attributes' ] );
                foreach ( $xmlNamespaces as &$namespaceObject ) {
                        if ( is_object( $namespaceObject ) ) {
                                $namespaceObject = '';
                        }
                }
 
-               $actualNamespaces = (array) $wgContLang->getNamespaces();
+               $actualNamespaces = (array)$wgContLang->getNamespaces();
                $actualNamespaces = array_values( $actualNamespaces );
                $this->assertEquals( $actualNamespaces, $xmlNamespaces );
 
                // Check xml page title correct
-               $xmlTitle = (array) $xmlObject->page->title;
+               $xmlTitle = (array)$xmlObject->page->title;
                $this->assertEquals( $pageTitle, $xmlTitle[0] );
 
                // Check xml page text is not empty
-               $text = (array) $xmlObject->page->revision->text;
+               $text = (array)$xmlObject->page->revision->text;
                $this->assertNotEquals( '', $text[0] );
        }