34 use MediaWikiCoversValidator;
35 use PHPUnit4And6Compat;
40 $store->expects( $this->once() )
41 ->method(
'saveSites' )
42 ->will( $this->returnCallback(
function ( $sites )
use ( $expectedSites ) {
46 $store->expects( $this->
any() )
47 ->method(
'getSites' )
48 ->will( $this->returnValue(
new SiteList() ) );
51 $errorHandler->expects( $this->exactly( $errorCount ) )
55 $importer->setExceptionCallback( [ $errorHandler,
'error' ] );
70 $foo->setGlobalId(
'Foo' );
73 $acme->setGlobalId(
'acme.com' );
74 $acme->setGroup(
'Test' );
79 $dewiki->setGlobalId(
'dewiki' );
80 $dewiki->setGroup(
'wikipedia' );
81 $dewiki->setForward(
true );
86 $dewiki->setSource(
'meta.wikimedia.org' );
94 '<sites><Foo><globalid>Foo</globalid></Foo><Bar><quux>Bla</quux></Bar></sites>',
99 '<site><globalid>Foo</globalid></site>' .
105 '<site><globalid>Foo</globalid></site>' .
107 '<globalid>acme.com</globalid>' .
108 '<localid type="interwiki">acme</localid>' .
109 '<group>Test</group>' .
110 '<path type="link">http://acme.com/</path>' .
112 '<site type="mediawiki">' .
113 '<source>meta.wikimedia.org</source>' .
114 '<globalid>dewiki</globalid>' .
115 '<localid type="interwiki">wikipedia</localid>' .
116 '<localid type="equivalent">de</localid>' .
117 '<group>wikipedia</group>' .
119 '<path type="link">http://de.wikipedia.org/w/</path>' .
120 '<path type="page_path">http://de.wikipedia.org/wiki/</path>' .
123 [ $foo, $acme, $dewiki ],
127 '<site><globalid>Foo</globalid></site>' .
128 '<site><barf>Foo</barf></site>' .
130 '<globalid>acme.com</globalid>' .
131 '<localid type="interwiki">acme</localid>' .
132 '<silly>boop!</silly>' .
133 '<group>Test</group>' .
134 '<path type="link">http://acme.com/</path>' .
148 $importer->importFromXML( $xml );
156 $importer->importFromXML(
'THIS IS NOT XML' );
161 $foo->setGlobalId(
'Foo' );
164 $acme->setGlobalId(
'acme.com' );
165 $acme->setGroup(
'Test' );
170 $dewiki->setGlobalId(
'dewiki' );
171 $dewiki->setGroup(
'wikipedia' );
172 $dewiki->setForward(
true );
177 $dewiki->setSource(
'meta.wikimedia.org' );
181 $file = __DIR__ .
'/SiteImporterTest.xml';
182 $importer->importFromFile( $file );
193 foreach ( $sites
as $site ) {
194 $key = $site->getGlobalId();