43 $sites = $store->getSites();
45 $this->assertInstanceOf( SiteList::class, $sites );
50 foreach ( $sites as $site ) {
51 $this->assertInstanceOf( Site::class, $site );
54 foreach ( $testSites as $site ) {
55 if ( $site->getGlobalId() !==
null ) {
56 $this->assertTrue( $sites->hasSite( $site->getGlobalId() ) );
70 $site->setGlobalId(
'ertrywuutr' );
71 $site->setLanguageCode(
'en' );
75 $site->setGlobalId(
'sdfhxujgkfpth' );
76 $site->setLanguageCode(
'nl' );
79 $this->assertTrue( $store->saveSites( $sites ) );
81 $site = $store->getSite(
'ertrywuutr' );
82 $this->assertInstanceOf( Site::class, $site );
83 $this->assertEquals(
'en', $site->getLanguageCode() );
85 $site = $store->getSite(
'sdfhxujgkfpth' );
86 $this->assertInstanceOf( Site::class, $site );
87 $this->assertEquals(
'nl', $site->getLanguageCode() );
94 $dbSiteStore = $this->getMockBuilder( SiteStore::class )
95 ->disableOriginalConstructor()
98 $dbSiteStore->expects( $this->
any() )
100 ->will( $this->returnValue( $this->
getTestSite() ) );
102 $dbSiteStore->expects( $this->
any() )
103 ->method(
'getSites' )
104 ->will( $this->returnCallback(
function () {
114 $this->assertGreaterThan( 0, $store->getSites()->count(),
'count sites' );
116 $store->getSite(
'enwiki' )->setLanguageCode(
'en-ca' );
119 $this->assertEquals(
'en-ca', $store->getSite(
'enwiki' )->getLanguageCode(),
'sanity check' );
126 $this->assertEquals(
'en', $store->getSite(
'enwiki' )->getLanguageCode(),
'reset' );