wiki.techinc.nl/tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php
Legoktm 4e35134f7a Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278.

Reason for revert: Broke postgres tests.

Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
2019-06-13 23:00:08 +00:00

41 lines
1.2 KiB
PHP

<?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 );
}
}