45 $foo->setGlobalId(
'Foo' );
48 $acme->setGlobalId(
'acme.com' );
49 $acme->setGroup(
'Test' );
56 $exporter->exportSites( [ $foo, $acme ] );
59 $xml = fread( $tmp, 16 * 1024 );
61 $this->assertContains(
'<sites ', $xml );
62 $this->assertContains(
'<site>', $xml );
63 $this->assertContains(
'<globalid>Foo</globalid>', $xml );
64 $this->assertContains(
'</site>', $xml );
65 $this->assertContains(
'<globalid>acme.com</globalid>', $xml );
66 $this->assertContains(
'<group>Test</group>', $xml );
67 $this->assertContains(
'<localid type="interwiki">acme</localid>', $xml );
68 $this->assertContains(
'<path type="link">http://acme.com/</path>', $xml );
69 $this->assertContains(
'</sites>', $xml );
72 $xsdFile = __DIR__ .
'/../../../../docs/sitelist-1.0.xsd';
73 $xsdData = file_get_contents( $xsdFile );
75 $document =
new DOMDocument();
76 $document->loadXML( $xml, LIBXML_NONET );
77 $document->schemaValidateSource( $xsdData );
81 $store = $this->getMockBuilder( SiteStore::class )->getMock();
83 $store->expects( $this->once() )
84 ->method(
'saveSites' )
85 ->will( $this->returnCallback(
function ( $moreSites ) use ( $sites ) {
86 foreach ( $moreSites as $site ) {
91 $store->expects( $this->
any() )
92 ->method(
'getSites' )
93 ->will( $this->returnValue(
new SiteList() ) );