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