42 foreach ( $sitesArrays as $sitesArray ) {
43 $listInstances[] =
new SiteList( $sitesArray[0] );
46 return $this->
arrayWrap( $listInstances );
58 $siteArrays[] = $sites;
60 $siteArrays[] = [ array_shift( $sites ) ];
62 $siteArrays[] = [ array_shift( $sites ), array_shift( $sites ) ];
73 $this->assertEquals( count( $sites ) === 0, $sites->
isEmpty() );
85 foreach ( $sites as $site ) {
86 $this->assertEquals( $site, $sites->
getSite( $site->getGlobalId() ) );
89 $this->assertTrue(
true );
101 foreach ( $sites as $site ) {
102 if ( is_int( $site->getInternalId() ) ) {
103 $this->assertEquals( $site, $sites->getSiteByInternalId( $site->getInternalId() ) );
107 $this->assertTrue(
true );
119 foreach ( $sites as $site ) {
120 $ids = $site->getNavigationIds();
121 foreach ( $ids as $navId ) {
122 $this->assertEquals( $site, $sites->getSiteByNavigationId( $navId ) );
126 $this->assertTrue(
true );
135 $this->assertFalse( $sites->hasSite(
'non-existing-global-id' ) );
136 $this->assertFalse( $sites->hasInternalId( 720101010 ) );
138 if ( !$sites->isEmpty() ) {
142 foreach ( $sites as $site ) {
143 $this->assertTrue( $sites->hasSite( $site->getGlobalId() ) );
157 foreach ( $sites as $site ) {
158 if ( is_int( $site->getInternalId() ) ) {
159 $this->assertTrue( $site, $sites->hasInternalId( $site->getInternalId() ) );
163 $this->assertFalse( $sites->hasInternalId( -1 ) );
175 foreach ( $sites as $site ) {
176 $ids = $site->getNavigationIds();
177 foreach ( $ids as $navId ) {
178 $this->assertTrue( $sites->hasNavigationId( $navId ) );
182 $this->assertFalse( $sites->hasNavigationId(
'non-existing-navigation-id' ) );
193 $this->assertTrue( is_array( $identifiers ) );
200 foreach ( $sites as $site ) {
201 $expected[] = $site->getGlobalId();
228 foreach ( $list as $site ) {
229 $this->assertTrue( $copy->hasInternalId( $site->getInternalId() ) );
231 foreach ( $site->getNavigationIds() as $navId ) {
233 $copy->hasNavigationId( $navId ),
234 'unserialized data expects nav id ' . $navId .
' for site ' . $site->getGlobalId()
unserialize( $serialized)
testSerialization(SiteList $list)
siteListProvider
testGetSiteByInternalId( $sites)
siteListProvider
siteListProvider()
Returns instances of SiteList implementing objects.
testGetGlobalIdentifiers(SiteList $sites)
siteListProvider
siteArrayProvider()
Returns arrays with instances of Site implementing objects.
testGetSiteByGlobalId(SiteList $sites)
siteListProvider
testIsEmpty(SiteList $sites)
siteListProvider
testHasInternallId( $sites)
siteListProvider
testHasNavigationId( $sites)
siteListProvider
testGetSiteByNavigationId( $sites)
siteListProvider
testHasGlobalId( $sites)
siteListProvider
isEmpty()
Returns if the list contains no sites.
getGlobalIdentifiers()
Returns all the global site identifiers.
getSite( $globalSiteId)
Returns the Site with the provided global site identifier.