| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Block; |
| 4 |
|
| 5 |
use MediaWiki\Block\BlockRestrictionStore; |
| 6 |
use MediaWiki\Block\BlockRestrictionStoreFactory; |
| 7 |
use MediaWiki\DAO\WikiAwareEntity; |
| 8 |
use MediaWikiUnitTestCase; |
| 9 |
use Wikimedia\Rdbms\LBFactory; |
| 10 |
use Wikimedia\Rdbms\LoadBalancer; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
class BlockRestrictionStoreFactoryTest extends MediaWikiUnitTestCase { |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public function testGetBlockRestrictionStore( $domain ) { |
| 21 |
$lb = $this->createMock( LoadBalancer::class ); |
| 22 |
$lbFactory = $this->createMock( LBFactory::class ); |
| 23 |
$lbFactory |
| 24 |
->method( 'getMainLB' ) |
| 25 |
->with( $domain ) |
| 26 |
->willReturn( $lb ); |
| 27 |
$factory = new BlockRestrictionStoreFactory( $lbFactory ); |
| 28 |
|
| 29 |
$restrictionStore = $factory->getBlockRestrictionStore( $domain ); |
| 30 |
$this->assertInstanceOf( BlockRestrictionStore::class, $restrictionStore ); |
| 31 |
} |
| 32 |
|
| 33 |
public static function provideDomains() { |
| 34 |
yield 'local wiki' => [ WikiAwareEntity::LOCAL ]; |
| 35 |
yield 'foreign wiki' => [ 'meta' ]; |
| 36 |
} |
| 37 |
|
| 38 |
} |