4 * @covers ExternalStoreFactory
6 class ExternalStoreFactoryTest
extends PHPUnit_Framework_TestCase
{
8 use MediaWikiCoversValidator
;
10 public function testExternalStoreFactory_noStores() {
11 $factory = new ExternalStoreFactory( [] );
12 $this->assertFalse( $factory->getStoreObject( 'ForTesting' ) );
13 $this->assertFalse( $factory->getStoreObject( 'foo' ) );
16 public function provideStoreNames() {
17 yield
'Same case as construction' => [ 'ForTesting' ];
18 yield
'All lower case' => [ 'fortesting' ];
19 yield
'All upper case' => [ 'FORTESTING' ];
20 yield
'Mix of cases' => [ 'FOrTEsTInG' ];
24 * @dataProvider provideStoreNames
26 public function testExternalStoreFactory_someStore_protoMatch( $proto ) {
27 $factory = new ExternalStoreFactory( [ 'ForTesting' ] );
28 $store = $factory->getStoreObject( $proto );
29 $this->assertInstanceOf( ExternalStoreForTesting
::class, $store );
33 * @dataProvider provideStoreNames
35 public function testExternalStoreFactory_someStore_noProtoMatch( $proto ) {
36 $factory = new ExternalStoreFactory( [ 'SomeOtherClassName' ] );
37 $store = $factory->getStoreObject( $proto );
38 $this->assertFalse( $store );