diff options
Diffstat (limited to 'tests/phpunit/includes/site/DBSiteStoreTest.php')
-rw-r--r-- | tests/phpunit/includes/site/DBSiteStoreTest.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/phpunit/includes/site/DBSiteStoreTest.php b/tests/phpunit/includes/site/DBSiteStoreTest.php index 673ba54d..48ef5243 100644 --- a/tests/phpunit/includes/site/DBSiteStoreTest.php +++ b/tests/phpunit/includes/site/DBSiteStoreTest.php @@ -130,4 +130,28 @@ class DBSiteStoreTest extends MediaWikiTestCase { $sites = $store->getSites(); $this->assertEquals( 0, $sites->count() ); } + + /** + * @covers DBSiteStore::getSites + */ + public function testGetSitesDefaultOrder() { + $store = new DBSiteStore(); + $siteB = new Site(); + $siteB->setGlobalId( 'B' ); + $siteA = new Site(); + $siteA->setGlobalId( 'A' ); + $store->saveSites( array( $siteB, $siteA ) ); + + $sites = $store->getSites(); + $siteIdentifiers = array(); + /** @var Site $site */ + foreach ( $sites as $site ) { + $siteIdentifiers[] = $site->getGlobalId(); + } + $this->assertSame( array( 'A', 'B' ), $siteIdentifiers ); + + // Note: SiteList::getGlobalIdentifiers uses an other internal state. Iteration must be + // tested separately. + $this->assertSame( array( 'A', 'B' ), $sites->getGlobalIdentifiers() ); + } } |