MediaWiki  REL1_31
BlobStoreFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
4 
9 use Wikimedia\TestingAccessWrapper;
10 
15 
16  public function provideWikiIds() {
17  yield [ false ];
18  yield [ 'someWiki' ];
19  }
20 
24  public function testNewBlobStore( $wikiId ) {
25  $factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
26  $store = $factory->newBlobStore( $wikiId );
27  $this->assertInstanceOf( BlobStore::class, $store );
28 
29  // This only works as we currently know this is a SqlBlobStore object
30  $wrapper = TestingAccessWrapper::newFromObject( $store );
31  $this->assertEquals( $wikiId, $wrapper->wikiId );
32  }
33 
37  public function testNewSqlBlobStore( $wikiId ) {
38  $factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
39  $store = $factory->newSqlBlobStore( $wikiId );
40  $this->assertInstanceOf( SqlBlobStore::class, $store );
41 
42  $wrapper = TestingAccessWrapper::newFromObject( $store );
43  $this->assertEquals( $wikiId, $wrapper->wikiId );
44  }
45 
46 }
use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Definition: APACHE-LICENSE-2.0.txt:10
MediaWiki\Storage\SqlBlobStore
Service for storing and loading Content objects.
Definition: SqlBlobStore.php:50
MediaWiki\Tests\Storage\BlobStoreFactoryTest\testNewSqlBlobStore
testNewSqlBlobStore( $wikiId)
provideWikiIds
Definition: BlobStoreFactoryTest.php:37
MediaWiki\Tests\Storage\BlobStoreFactoryTest
\MediaWiki\Storage\BlobStoreFactory
Definition: BlobStoreFactoryTest.php:14
php
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
Definition: injection.txt:37
MediaWiki\Tests\Storage\BlobStoreFactoryTest\provideWikiIds
provideWikiIds()
Definition: BlobStoreFactoryTest.php:16
MediaWiki\Tests\Storage
Definition: BlobStoreFactoryTest.php:3
MediaWikiTestCase
Definition: MediaWikiTestCase.php:17
MediaWiki\Tests\Storage\BlobStoreFactoryTest\testNewBlobStore
testNewBlobStore( $wikiId)
provideWikiIds
Definition: BlobStoreFactoryTest.php:24
MediaWiki\MediaWikiServices\getInstance
static getInstance()
Returns the global default instance of the top level service locator.
Definition: MediaWikiServices.php:109
MediaWiki\Storage\BlobStore
Service for loading and storing data blobs.
Definition: BlobStore.php:33
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:56
MediaWikiServices
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 MediaWikiServices
Definition: injection.txt:25
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187