52 $sites = $store->getSites();
54 $this->assertInstanceOf(
'SiteList', $sites );
59 foreach ( $sites
as $site ) {
60 $this->assertInstanceOf(
'Site', $site );
63 foreach ( $expectedSites
as $site ) {
64 if ( $site->getGlobalId() !== null ) {
65 $this->assertTrue( $sites->hasSite( $site->getGlobalId() ) );
79 $site->setGlobalId(
'ertrywuutr' );
80 $site->setLanguageCode(
'en' );
84 $site->setGlobalId(
'sdfhxujgkfpth' );
85 $site->setLanguageCode(
'nl' );
88 $this->assertTrue( $store->saveSites( $sites ) );
90 $site = $store->getSite(
'ertrywuutr' );
91 $this->assertInstanceOf(
'Site', $site );
92 $this->assertEquals(
'en', $site->getLanguageCode() );
93 $this->assertTrue( is_integer( $site->getInternalId() ) );
94 $this->assertTrue( $site->getInternalId() >= 0 );
96 $site = $store->getSite(
'sdfhxujgkfpth' );
97 $this->assertInstanceOf(
'Site', $site );
98 $this->assertEquals(
'nl', $site->getLanguageCode() );
99 $this->assertTrue( is_integer( $site->getInternalId() ) );
100 $this->assertTrue( $site->getInternalId() >= 0 );
111 $this->assertGreaterThan( 0, $store1->getSites()->count() );
112 $this->assertGreaterThan( 0, $store2->getSites()->count() );
116 $this->assertTrue( $store1->clear() );
119 $this->assertNotNull( $store2->getSite(
'enwiki' ) );
125 $site = $store2->getSite(
'enwiki' );
126 $this->assertNull( $site );
134 $this->assertTrue( $store->clear() );
136 $site = $store->getSite(
'enwiki' );
137 $this->assertNull( $site );
139 $sites = $store->getSites();
140 $this->assertEquals( 0, $sites->count() );
149 $siteB->setGlobalId(
'B' );
151 $siteA->setGlobalId(
'A' );
152 $store->saveSites( [ $siteB, $siteA ] );
154 $sites = $store->getSites();
155 $siteIdentifiers = [];
157 foreach ( $sites
as $site ) {
158 $siteIdentifiers[] = $site->getGlobalId();
160 $this->assertSame( [
'A',
'B' ], $siteIdentifiers );
164 $this->assertSame( [
'A',
'B' ], $sites->getGlobalIdentifiers() );