wiki.techinc.nl/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php
Aaron Schulz a9a13a1266 storage: rename various $wikiId fields/parameters to $dbDomain
These fields are passed to methods like LoadBalancer::getConnection() and are
already expected to be DB domains. Update various comments as well.

Fix a few minor IDEA warnings.

Change-Id: If480cc4d7d4a3c2d176ab346e6307e80cd2540c5
2019-06-28 00:57:04 +00:00

46 lines
1.2 KiB
PHP

<?php
namespace MediaWiki\Tests\Storage;
use MediaWiki\MediaWikiServices;
use MediaWiki\Storage\BlobStore;
use MediaWiki\Storage\SqlBlobStore;
use MediaWikiTestCase;
use Wikimedia\TestingAccessWrapper;
/**
* @covers \MediaWiki\Storage\BlobStoreFactory
*/
class BlobStoreFactoryTest extends MediaWikiTestCase {
public function provideDbDomains() {
yield [ false ];
yield [ 'someWiki' ];
}
/**
* @dataProvider provideDbDomains
*/
public function testNewBlobStore( $dbDomain ) {
$factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
$store = $factory->newBlobStore( $dbDomain );
$this->assertInstanceOf( BlobStore::class, $store );
// This only works as we currently know this is a SqlBlobStore object
$wrapper = TestingAccessWrapper::newFromObject( $store );
$this->assertEquals( $dbDomain, $wrapper->dbDomain );
}
/**
* @dataProvider provideDbDomains
*/
public function testNewSqlBlobStore( $dbDomain ) {
$factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
$store = $factory->newSqlBlobStore( $dbDomain );
$this->assertInstanceOf( SqlBlobStore::class, $store );
$wrapper = TestingAccessWrapper::newFromObject( $store );
$this->assertEquals( $dbDomain, $wrapper->dbDomain );
}
}