Debian Codegraph @

tests/phpunit/includes/filebackend/lockmanager/LockManagerGroupIntegrationTest.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\MainConfigNames;
4 use MediaWiki\WikiMap\WikiMap;
5
6 /**
7 * Most of the file is covered by the unit test and/or FileBackendTest. Here we fill in the missing
8 * bits that don't work with unit tests yet.
9 *
10 * @covers \LockManagerGroup
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 }