dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCase
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
site
/
SiteImporterTest.php
diff --git
a/tests/phpunit/includes/site/SiteImporterTest.php
b/tests/phpunit/includes/site/SiteImporterTest.php
index
a49f06c
..
8a43bf8
100644
(file)
--- a/
tests/phpunit/includes/site/SiteImporterTest.php
+++ b/
tests/phpunit/includes/site/SiteImporterTest.php
@@
-31,8
+31,10
@@
*/
class SiteImporterTest extends PHPUnit_Framework_TestCase {
*/
class SiteImporterTest extends PHPUnit_Framework_TestCase {
+ use MediaWikiCoversValidator;
+
private function newSiteImporter( array $expectedSites, $errorCount ) {
private function newSiteImporter( array $expectedSites, $errorCount ) {
- $store = $this->getMock
( 'SiteStore'
);
+ $store = $this->getMock
Builder( 'SiteStore' )->getMock(
);
$store->expects( $this->once() )
->method( 'saveSites' )
$store->expects( $this->once() )
->method( 'saveSites' )
@@
-44,12
+46,12
@@
class SiteImporterTest extends PHPUnit_Framework_TestCase {
->method( 'getSites' )
->will( $this->returnValue( new SiteList() ) );
->method( 'getSites' )
->will( $this->returnValue( new SiteList() ) );
- $errorHandler = $this->getMock
( 'Psr\Log\LoggerInterface'
);
+ $errorHandler = $this->getMock
Builder( 'Psr\Log\LoggerInterface' )->getMock(
);
$errorHandler->expects( $this->exactly( $errorCount ) )
->method( 'error' );
$importer = new SiteImporter( $store );
$errorHandler->expects( $this->exactly( $errorCount ) )
->method( 'error' );
$importer = new SiteImporter( $store );
- $importer->setExceptionCallback(
array( $errorHandler, 'error' )
);
+ $importer->setExceptionCallback(
[ $errorHandler, 'error' ]
);
return $importer;
}
return $importer;
}
@@
-82,22
+84,22
@@
class SiteImporterTest extends PHPUnit_Framework_TestCase {
$dewiki->setPath( MediaWikiSite::PATH_PAGE, 'http://de.wikipedia.org/wiki/' );
$dewiki->setSource( 'meta.wikimedia.org' );
$dewiki->setPath( MediaWikiSite::PATH_PAGE, 'http://de.wikipedia.org/wiki/' );
$dewiki->setSource( 'meta.wikimedia.org' );
- return
array(
- 'empty' =>
array(
+ return
[
+ 'empty' =>
[
'<sites></sites>',
'<sites></sites>',
-
array()
,
-
)
,
- 'no sites' =>
array(
+
[]
,
+
]
,
+ 'no sites' =>
[
'<sites><Foo><globalid>Foo</globalid></Foo><Bar><quux>Bla</quux></Bar></sites>',
'<sites><Foo><globalid>Foo</globalid></Foo><Bar><quux>Bla</quux></Bar></sites>',
-
array()
,
-
)
,
- 'minimal' =>
array(
+
[]
,
+
]
,
+ 'minimal' =>
[
'<sites>' .
'<site><globalid>Foo</globalid></site>' .
'</sites>',
'<sites>' .
'<site><globalid>Foo</globalid></site>' .
'</sites>',
-
array( $foo )
,
-
)
,
- 'full' =>
array(
+
[ $foo ]
,
+
]
,
+ 'full' =>
[
'<sites>' .
'<site><globalid>Foo</globalid></site>' .
'<site>' .
'<sites>' .
'<site><globalid>Foo</globalid></site>' .
'<site>' .
@@
-117,9
+119,9
@@
class SiteImporterTest extends PHPUnit_Framework_TestCase {
'<path type="page_path">http://de.wikipedia.org/wiki/</path>' .
'</site>' .
'</sites>',
'<path type="page_path">http://de.wikipedia.org/wiki/</path>' .
'</site>' .
'</sites>',
-
array( $foo, $acme, $dewiki )
,
-
)
,
- 'skip' =>
array(
+
[ $foo, $acme, $dewiki ]
,
+
]
,
+ 'skip' =>
[
'<sites>' .
'<site><globalid>Foo</globalid></site>' .
'<site><barf>Foo</barf></site>' .
'<sites>' .
'<site><globalid>Foo</globalid></site>' .
'<site><barf>Foo</barf></site>' .
@@
-131,10
+133,10
@@
class SiteImporterTest extends PHPUnit_Framework_TestCase {
'<path type="link">http://acme.com/</path>' .
'</site>' .
'</sites>',
'<path type="link">http://acme.com/</path>' .
'</site>' .
'</sites>',
-
array( $foo, $acme )
,
+
[ $foo, $acme ]
,
1
1
-
)
,
-
)
;
+
]
,
+
]
;
}
/**
}
/**
@@
-148,7
+150,7
@@
class SiteImporterTest extends PHPUnit_Framework_TestCase {
public function testImportFromXML_malformed() {
$this->setExpectedException( 'Exception' );
public function testImportFromXML_malformed() {
$this->setExpectedException( 'Exception' );
- $store = $this->getMock
( 'SiteStore'
);
+ $store = $this->getMock
Builder( 'SiteStore' )->getMock(
);
$importer = new SiteImporter( $store );
$importer->importFromXML( 'THIS IS NOT XML' );
}
$importer = new SiteImporter( $store );
$importer->importFromXML( 'THIS IS NOT XML' );
}
@@
-173,7
+175,7
@@
class SiteImporterTest extends PHPUnit_Framework_TestCase {
$dewiki->setPath( MediaWikiSite::PATH_PAGE, 'http://de.wikipedia.org/wiki/' );
$dewiki->setSource( 'meta.wikimedia.org' );
$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 );
$file = __DIR__ . '/SiteImporterTest.xml';
$importer->importFromFile( $file );
@@
-185,7
+187,7
@@
class SiteImporterTest extends PHPUnit_Framework_TestCase {
* @return array[]
*/
private function getSerializedSiteList( $sites ) {
* @return array[]
*/
private function getSerializedSiteList( $sites ) {
- $serialized =
array()
;
+ $serialized =
[]
;
foreach ( $sites as $site ) {
$key = $site->getGlobalId();
foreach ( $sites as $site ) {
$key = $site->getGlobalId();