X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsite%2FSiteImporterTest.php;h=45241c5941cd88afda135ea80defcfca2ee8e902;hb=b86ef89dd17f51841a220e8ef9b3b8b2402e2547;hp=64b195d823adf34605f865002c03e558e4fd403c;hpb=759b2b736fe28a5b2a4c6376bcedfb3ef9bf805f;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/site/SiteImporterTest.php b/tests/phpunit/includes/site/SiteImporterTest.php
index 64b195d823..45241c5941 100644
--- a/tests/phpunit/includes/site/SiteImporterTest.php
+++ b/tests/phpunit/includes/site/SiteImporterTest.php
@@ -34,11 +34,10 @@ class SiteImporterTest extends PHPUnit_Framework_TestCase {
private function newSiteImporter( array $expectedSites, $errorCount ) {
$store = $this->getMock( 'SiteStore' );
- $that = $this;
$store->expects( $this->once() )
->method( 'saveSites' )
- ->will( $this->returnCallback( function ( $sites ) use ( $expectedSites, $that ) {
- $that->assertSitesEqual( $expectedSites, $sites );
+ ->will( $this->returnCallback( function ( $sites ) use ( $expectedSites ) {
+ $this->assertSitesEqual( $expectedSites, $sites );
} ) );
$store->expects( $this->any() )
@@ -50,7 +49,7 @@ class SiteImporterTest extends PHPUnit_Framework_TestCase {
->method( 'error' );
$importer = new SiteImporter( $store );
- $importer->setExceptionCallback( array( $errorHandler, 'error' ) );
+ $importer->setExceptionCallback( [ $errorHandler, 'error' ] );
return $importer;
}
@@ -83,22 +82,22 @@ class SiteImporterTest 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' => [
'',
- array(),
- ),
- 'no sites' => array(
+ [],
+ ],
+ 'no sites' => [
'FooBla',
- array(),
- ),
- 'minimal' => array(
+ [],
+ ],
+ 'minimal' => [
'' .
'Foo' .
'',
- array( $foo ),
- ),
- 'full' => array(
+ [ $foo ],
+ ],
+ 'full' => [
'' .
'Foo' .
'' .
@@ -118,9 +117,9 @@ class SiteImporterTest extends PHPUnit_Framework_TestCase {
'http://de.wikipedia.org/wiki/' .
'' .
'',
- array( $foo, $acme, $dewiki ),
- ),
- 'skip' => array(
+ [ $foo, $acme, $dewiki ],
+ ],
+ 'skip' => [
'' .
'Foo' .
'Foo' .
@@ -132,21 +131,21 @@ class SiteImporterTest extends PHPUnit_Framework_TestCase {
'http://acme.com/' .
'' .
'',
- array( $foo, $acme ),
+ [ $foo, $acme ],
1
- ),
- );
+ ],
+ ];
}
/**
* @dataProvider provideImportFromXML
*/
- public function testImportFromXML( $xml, array $expectedSites, $errorCount = 0 ) {
+ public function testImportFromXML( $xml, array $expectedSites, $errorCount = 0 ) {
$importer = $this->newSiteImporter( $expectedSites, $errorCount );
$importer->importFromXML( $xml );
}
- public function testImportFromXML_malformed() {
+ public function testImportFromXML_malformed() {
$this->setExpectedException( 'Exception' );
$store = $this->getMock( 'SiteStore' );
@@ -154,7 +153,7 @@ class SiteImporterTest extends PHPUnit_Framework_TestCase {
$importer->importFromXML( 'THIS IS NOT XML' );
}
- public function testImportFromFile() {
+ public function testImportFromFile() {
$foo = Site::newForType( Site::TYPE_UNKNOWN );
$foo->setGlobalId( 'Foo' );
@@ -174,7 +173,7 @@ class SiteImporterTest extends PHPUnit_Framework_TestCase {
$dewiki->setPath( MediaWikiSite::PATH_PAGE, 'http://de.wikipedia.org/wiki/' );
$dewiki->setSource( 'meta.wikimedia.org' );
- $importer = $this->newSiteImporter( array( $foo, $acme, $dewiki ), 0 );
+ $importer = $this->newSiteImporter( [ $foo, $acme, $dewiki ], 0 );
$file = __DIR__ . '/SiteImporterTest.xml';
$importer->importFromFile( $file );
@@ -186,7 +185,7 @@ class SiteImporterTest extends PHPUnit_Framework_TestCase {
* @return array[]
*/
private function getSerializedSiteList( $sites ) {
- $serialized = array();
+ $serialized = [];
foreach ( $sites as $site ) {
$key = $site->getGlobalId();