X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsite%2FSiteExporterTest.php;h=7be19ef9ac802addc217a0deaf90bdecf84c65e0;hb=6b3e5511fb848890f174690885e748b90389c0b8;hp=19dd0aa12c0d318fbaf6ef8e743c2eb1c57129c5;hpb=9440d5228fb44b0217c7fa9e46874152f223a0c2;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/site/SiteExporterTest.php b/tests/phpunit/includes/site/SiteExporterTest.php index 19dd0aa12c..3a41b5fc69 100644 --- a/tests/phpunit/includes/site/SiteExporterTest.php +++ b/tests/phpunit/includes/site/SiteExporterTest.php @@ -31,8 +31,10 @@ */ class SiteExporterTest extends PHPUnit_Framework_TestCase { + use MediaWikiCoversValidator; + public function testConstructor_InvalidArgument() { - $this->setExpectedException( 'InvalidArgumentException' ); + $this->setExpectedException( InvalidArgumentException::class ); new SiteExporter( 'Foo' ); } @@ -50,10 +52,10 @@ class SiteExporterTest extends PHPUnit_Framework_TestCase { $tmp = tmpfile(); $exporter = new SiteExporter( $tmp ); - $exporter->exportSites( array( $foo, $acme ) ); + $exporter->exportSites( [ $foo, $acme ] ); fseek( $tmp, 0 ); - $xml = fread( $tmp, 16*1024 ); + $xml = fread( $tmp, 16 * 1024 ); $this->assertContains( 'assertContains( '', $xml ); @@ -75,7 +77,7 @@ class SiteExporterTest extends PHPUnit_Framework_TestCase { } private function newSiteStore( SiteList $sites ) { - $store = $this->getMock( 'SiteStore' ); + $store = $this->getMockBuilder( SiteStore::class )->getMock(); $store->expects( $this->once() ) ->method( 'saveSites' ) @@ -112,15 +114,15 @@ class SiteExporterTest extends PHPUnit_Framework_TestCase { $dewiki->setPath( MediaWikiSite::PATH_PAGE, 'http://de.wikipedia.org/wiki/' ); $dewiki->setSource( 'meta.wikimedia.org' ); - return array( - 'empty' => array( + return [ + 'empty' => [ new SiteList() - ), + ], - 'some' => array( - new SiteList( array( $foo, $acme, $dewiki ) ), - ), - ); + 'some' => [ + new SiteList( [ $foo, $acme, $dewiki ] ), + ], + ]; } /** @@ -133,7 +135,7 @@ class SiteExporterTest extends PHPUnit_Framework_TestCase { $exporter->exportSites( $sites ); fseek( $tmp, 0 ); - $xml = fread( $tmp, 16*1024 ); + $xml = fread( $tmp, 16 * 1024 ); $actualSites = new SiteList(); $store = $this->newSiteStore( $actualSites );