MediaWiki REL1_31
ExternalStoreFactoryTest.php
Go to the documentation of this file.
1<?php
2
6class ExternalStoreFactoryTest extends PHPUnit\Framework\TestCase {
7
8 use MediaWikiCoversValidator;
9
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
27 $factory = new ExternalStoreFactory( [ 'ForTesting' ] );
28 $store = $factory->getStoreObject( $proto );
29 $this->assertInstanceOf( ExternalStoreForTesting::class, $store );
30 }
31
36 $factory = new ExternalStoreFactory( [ 'SomeOtherClassName' ] );
37 $store = $factory->getStoreObject( $proto );
38 $this->assertFalse( $store );
39 }
40
41}
testExternalStoreFactory_someStore_noProtoMatch( $proto)
provideStoreNames
testExternalStoreFactory_someStore_protoMatch( $proto)
provideStoreNames