From: saper Date: Fri, 14 Nov 2014 00:56:47 +0000 (+0100) Subject: Use ImportStringSource for simple import sources X-Git-Tag: 1.31.0-rc.0~9208^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/supprimer.php?a=commitdiff_plain;h=0dceb135e0dd30e02d69c61f374f28498afed786;p=lhc%2Fweb%2Fwiklou.git Use ImportStringSource for simple import sources Bug: T75283 Change-Id: I61c94202467ae6729ae52684a6477f7cbd8e00b7 --- diff --git a/tests/phpunit/includes/ImportTest.php b/tests/phpunit/includes/ImportTest.php index 8ee2ad5aca..9c224309bb 100644 --- a/tests/phpunit/includes/ImportTest.php +++ b/tests/phpunit/includes/ImportTest.php @@ -9,16 +9,8 @@ */ class ImportTest extends MediaWikiLangTestCase { - private function getInputStreamSource( $xml ) { - if ( ini_get( 'allow_url_fopen' ) != 1 ) { - $this->markTestSkipped( 'bug 73283: this test needs allow_url_fopen to be enabled' ); - } - $file = 'data:application/xml,' . $xml; - $status = ImportStreamSource::newFromFile( $file ); - if ( !$status->isGood() ) { - throw new MWException( "Cannot create InputStreamSource." ); - } - return $status->value; + private function getDataSource( $xml ) { + return new ImportStringSource( $xml ); } /** @@ -28,7 +20,7 @@ class ImportTest extends MediaWikiLangTestCase { * @param string|null $redirectTitle */ public function testHandlePageContainsRedirect( $xml, $redirectTitle ) { - $source = $this->getInputStreamSource( $xml ); + $source = $this->getDataSource( $xml ); $redirect = null; $callback = function ( Title $title, ForeignTitle $foreignTitle, $revCount, @@ -114,7 +106,7 @@ EOF * @param array|null $namespaces */ public function testSiteInfoContainsNamespaces( $xml, $namespaces ) { - $source = $this->getInputStreamSource( $xml ); + $source = $this->getDataSource( $xml ); $importNamespaces = null; $callback = function ( array $siteinfo, $innerImporter ) use ( &$importNamespaces ) {