build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
[lhc/web/wiklou.git] / tests / phpunit / includes / externalstore / ExternalStoreFactoryTest.php
1 <?php
2
3 /**
4 * @covers ExternalStoreFactory
5 */
6 class ExternalStoreFactoryTest extends PHPUnit\Framework\TestCase {
7
8 use MediaWikiCoversValidator;
9
10 public function testExternalStoreFactory_noStores() {
11 $factory = new ExternalStoreFactory( [] );
12 $this->assertFalse( $factory->getStoreObject( 'ForTesting' ) );
13 $this->assertFalse( $factory->getStoreObject( 'foo' ) );
14 }
15
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' ];
21 }
22
23 /**
24 * @dataProvider provideStoreNames
25 */
26 public function testExternalStoreFactory_someStore_protoMatch( $proto ) {
27 $factory = new ExternalStoreFactory( [ 'ForTesting' ] );
28 $store = $factory->getStoreObject( $proto );
29 $this->assertInstanceOf( ExternalStoreForTesting::class, $store );
30 }
31
32 /**
33 * @dataProvider provideStoreNames
34 */
35 public function testExternalStoreFactory_someStore_noProtoMatch( $proto ) {
36 $factory = new ExternalStoreFactory( [ 'SomeOtherClassName' ] );
37 $store = $factory->getStoreObject( $proto );
38 $this->assertFalse( $store );
39 }
40
41 }