| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\MainConfigNames; |
| 4 |
use MediaWiki\WikiMap\WikiMap; |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class LockManagerGroupIntegrationTest extends MediaWikiIntegrationTestCase { |
| 13 |
public function testWgLockManagers() { |
| 14 |
$this->overrideConfigValue( MainConfigNames::LockManagers, |
| 15 |
[ [ 'name' => 'a', 'class' => 'b' ], [ 'name' => 'c', 'class' => 'd' ] ] ); |
| 16 |
|
| 17 |
$lmg = $this->getServiceContainer()->getLockManagerGroupFactory()->getLockManagerGroup(); |
| 18 |
$domain = WikiMap::getCurrentWikiDbDomain()->getId(); |
| 19 |
|
| 20 |
$this->assertSame( |
| 21 |
[ 'class' => 'b', 'name' => 'a', 'domain' => $domain ], |
| 22 |
$lmg->config( 'a' ) ); |
| 23 |
$this->assertSame( |
| 24 |
[ 'class' => 'd', 'name' => 'c', 'domain' => $domain ], |
| 25 |
$lmg->config( 'c' ) ); |
| 26 |
} |
| 27 |
|
| 28 |
public function testSingletonFalse() { |
| 29 |
$this->overrideConfigValue( MainConfigNames::LockManagers, [ [ 'name' => 'a', 'class' => 'b' ] ] ); |
| 30 |
|
| 31 |
$this->assertSame( |
| 32 |
WikiMap::getCurrentWikiDbDomain()->getId(), |
| 33 |
$this->getServiceContainer() |
| 34 |
->getLockManagerGroupFactory() |
| 35 |
->getLockManagerGroup( false ) |
| 36 |
->config( 'a' )['domain'] |
| 37 |
); |
| 38 |
} |
| 39 |
|
| 40 |
public function testSingletonNull() { |
| 41 |
$this->overrideConfigValue( MainConfigNames::LockManagers, [ [ 'name' => 'a', 'class' => 'b' ] ] ); |
| 42 |
|
| 43 |
$this->assertSame( |
| 44 |
WikiMap::getCurrentWikiDbDomain()->getId(), |
| 45 |
$this->getServiceContainer() |
| 46 |
->getLockManagerGroupFactory() |
| 47 |
->getLockManagerGroup( null ) |
| 48 |
->config( 'a' )['domain'] |
| 49 |
); |
| 50 |
} |
| 51 |
} |