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/externalstore/ExternalStoreFactoryTest.php |
first commit
Diffstat (limited to 'www/wiki/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php')
-rw-r--r-- | www/wiki/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php b/www/wiki/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php new file mode 100644 index 00000000..f7626938 --- /dev/null +++ b/www/wiki/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php @@ -0,0 +1,41 @@ +<?php + +/** + * @covers ExternalStoreFactory + */ +class ExternalStoreFactoryTest extends PHPUnit\Framework\TestCase { + + use MediaWikiCoversValidator; + + public function testExternalStoreFactory_noStores() { + $factory = new ExternalStoreFactory( [] ); + $this->assertFalse( $factory->getStoreObject( 'ForTesting' ) ); + $this->assertFalse( $factory->getStoreObject( 'foo' ) ); + } + + public function provideStoreNames() { + yield 'Same case as construction' => [ 'ForTesting' ]; + yield 'All lower case' => [ 'fortesting' ]; + yield 'All upper case' => [ 'FORTESTING' ]; + yield 'Mix of cases' => [ 'FOrTEsTInG' ]; + } + + /** + * @dataProvider provideStoreNames + */ + public function testExternalStoreFactory_someStore_protoMatch( $proto ) { + $factory = new ExternalStoreFactory( [ 'ForTesting' ] ); + $store = $factory->getStoreObject( $proto ); + $this->assertInstanceOf( ExternalStoreForTesting::class, $store ); + } + + /** + * @dataProvider provideStoreNames + */ + public function testExternalStoreFactory_someStore_noProtoMatch( $proto ) { + $factory = new ExternalStoreFactory( [ 'SomeOtherClassName' ] ); + $store = $factory->getStoreObject( $proto ); + $this->assertFalse( $store ); + } + +} |