This allows Revision::getRevisionText to get a different BlobStore instance when $wiki is passed in restoring the behaviour for $wiki before the MCR Revision overhaul patch was merged. Ia4c20a91e98df0b9b14b138eb4825c55e5200384 Bug: T183634 Bug: T183631 bug: T183583 Change-Id: Ib0949454e9a003c2965adc1aab38e31fcf121afe
46 lines
1.2 KiB
PHP
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\BlobStore
|
|
*/
|
|
class BlobStoreFactoryTest extends MediaWikiTestCase {
|
|
|
|
public function provideWikiIds() {
|
|
yield [ false ];
|
|
yield [ 'someWiki' ];
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideWikiIds
|
|
*/
|
|
public function testNewBlobStore( $wikiId ) {
|
|
$factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
|
|
$store = $factory->newBlobStore( $wikiId );
|
|
$this->assertInstanceOf( BlobStore::class, $store );
|
|
|
|
// This only works as we currently know this is a SqlBlobStore object
|
|
$wrapper = TestingAccessWrapper::newFromObject( $store );
|
|
$this->assertEquals( $wikiId, $wrapper->wikiId );
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideWikiIds
|
|
*/
|
|
public function testNewSqlBlobStore( $wikiId ) {
|
|
$factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
|
|
$store = $factory->newSqlBlobStore( $wikiId );
|
|
$this->assertInstanceOf( SqlBlobStore::class, $store );
|
|
|
|
$wrapper = TestingAccessWrapper::newFromObject( $store );
|
|
$this->assertEquals( $wikiId, $wrapper->wikiId );
|
|
}
|
|
|
|
}
|