diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php |
first commit
Diffstat (limited to 'www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php')
-rw-r--r-- | www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php b/www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php new file mode 100644 index 00000000..252c6578 --- /dev/null +++ b/www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php @@ -0,0 +1,46 @@ +<?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 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 ); + } + +} |