summaryrefslogtreecommitdiff
path: root/www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php')
-rw-r--r--www/wiki/tests/phpunit/includes/Storage/BlobStoreFactoryTest.php46
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 );
+ }
+
+}