42 $foo->setGlobalId(
'Foo' );
45 $acme->setGlobalId(
'acme.com' );
46 $acme->setGroup(
'Test' );
53 $exporter->exportSites( [ $foo, $acme ] );
56 $xml = fread( $tmp, 16 * 1024 );
58 $this->assertContains(
'<sites ', $xml );
59 $this->assertContains(
'<site>', $xml );
60 $this->assertContains(
'<globalid>Foo</globalid>', $xml );
61 $this->assertContains(
'</site>', $xml );
62 $this->assertContains(
'<globalid>acme.com</globalid>', $xml );
63 $this->assertContains(
'<group>Test</group>', $xml );
64 $this->assertContains(
'<localid type="interwiki">acme</localid>', $xml );
65 $this->assertContains(
'<path type="link">http://acme.com/</path>', $xml );
66 $this->assertContains(
'</sites>', $xml );
69 $xsdFile = __DIR__ .
'/../../../../docs/sitelist-1.0.xsd';
70 $xsdData = file_get_contents( $xsdFile );
72 $document =
new DOMDocument();
73 $document->loadXML( $xml, LIBXML_NONET );
74 $document->schemaValidateSource( $xsdData );
78 $store = $this->getMockBuilder(
'SiteStore' )->getMock();
80 $store->expects( $this->once() )
81 ->method(
'saveSites' )
82 ->will( $this->returnCallback(
function ( $moreSites ) use ( $sites ) {
83 foreach ( $moreSites as $site ) {
88 $store->expects( $this->
any() )
89 ->method(
'getSites' )
90 ->will( $this->returnValue(
new SiteList() ) );