Debian Codegraph @

tests/phpunit/integration/includes/libs/lockmanager/MemcLockManagerIntegrationTest.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\MainConfigNames;
4
5 /**
6 * @group LockManager
7 * @covers MemcLockManager
8 */
9 class MemcLockManagerIntegrationTest extends LockManagerIntegrationTestBase {
10 /** @var LockManager[] */
11 private static $managersToUse = [];
12
13 private function getManagerConfig(): ?array {
14 $backends = $this->getServiceContainer()->getMainConfig()->get( MainConfigNames::LockManagers );
15 foreach ( $backends as $conf ) {
16 if ( $conf['class'] === MemcLockManager::class ) {
17 return $conf;
18 }
19 }
20
21 return null;
22 }
23
24 protected function getManager( $threadName ) {
25 if ( !isset( self::$managersToUse[$threadName] ) ) {
26 $conf = $this->getManagerConfig();
27 if ( $conf === null ) {
28 $this->markTestSkipped(
29 'Configure a MemcLockManager in $wgLockManagers to enable this test' );
30 }
31 $conf['name'] = 'localtesting'; // swap name
32 $conf['domain'] = 'testingdomain';
33 $conf['lockTTL'] = 60;
34 self::$managersToUse[$threadName] = new MemcLockManager( $conf );
35 }
36
37 return self::$managersToUse[$threadName];
38 }
39 }