41 $listInstances =
array();
43 foreach ( $sitesArrays
as $sitesArray ) {
44 $listInstances[] =
new SiteList( $sitesArray[0] );
47 return $this->
arrayWrap( $listInstances );
57 $siteArrays =
array();
59 $siteArrays[] = $sites;
61 $siteArrays[] =
array( array_shift( $sites ) );
63 $siteArrays[] =
array( array_shift( $sites ), array_shift( $sites ) );
74 $this->assertEquals( count( $sites ) === 0, $sites->
isEmpty() );
86 foreach ( $sites
as $site ) {
87 $this->assertEquals( $site, $sites->
getSite( $site->getGlobalId() ) );
90 $this->assertTrue(
true );
102 foreach ( $sites
as $site ) {
103 if ( is_integer( $site->getInternalId() ) ) {
104 $this->assertEquals( $site, $sites->getSiteByInternalId( $site->getInternalId() ) );
108 $this->assertTrue(
true );
120 foreach ( $sites
as $site ) {
121 $ids = $site->getNavigationIds();
122 foreach ( $ids
as $navId ) {
123 $this->assertEquals( $site, $sites->getSiteByNavigationId( $navId ) );
127 $this->assertTrue(
true );
136 $this->assertFalse( $sites->hasSite(
'non-existing-global-id' ) );
137 $this->assertFalse( $sites->hasInternalId( 720101010 ) );
139 if ( !$sites->isEmpty() ) {
143 foreach ( $sites
as $site ) {
144 $this->assertTrue( $sites->hasSite( $site->getGlobalId() ) );
158 foreach ( $sites
as $site ) {
159 if ( is_integer( $site->getInternalId() ) ) {
160 $this->assertTrue( $site, $sites->hasInternalId( $site->getInternalId() ) );
164 $this->assertFalse( $sites->hasInternalId( -1 ) );
176 foreach ( $sites
as $site ) {
177 $ids = $site->getNavigationIds();
178 foreach ( $ids
as $navId ) {
179 $this->assertTrue( $sites->hasNavigationId( $navId ) );
183 $this->assertFalse( $sites->hasNavigationId(
'non-existing-navigation-id' ) );
194 $this->assertTrue( is_array( $identifiers ) );
201 foreach ( $sites
as $site ) {
202 $expected[] = $site->getGlobalId();
218 $serialization = serialize( $list );
222 $copy = unserialize( $serialization );
229 foreach ( $list
as $site ) {
230 $this->assertTrue( $copy->hasInternalId( $site->getInternalId() ) );
232 foreach ( $site->getNavigationIds()
as $navId ) {
234 $copy->hasNavigationId( $navId ),
235 'unserialized data expects nav id ' . $navId .
' for site ' . $site->getGlobalId()