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_integer( $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_integer( $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.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php