blob: afaa50e80e8a4e1786838b815902f3faa82f6ffd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
/**
* @author Abijeet Patro
* @license GPL-2.0-or-later
* @file
*/
use MediaWiki\Extension\Translate\Validation\ValidationRunner;
/** @group medium */
class WikiPageMessageGroupTest extends MediaWikiIntegrationTestCase {
protected function setUp(): void {
parent::setUp();
$this->setTemporaryHook(
'TranslatePostInitGroups',
static function ( &$list ) {
$anotherPageMessageGroup = new WikiPageMessageGroup( 'anotherpageid', 'mypage' );
$anotherPageMessageGroup->setLabel( 'thelabel' ); // Example
$anotherPageMessageGroup->setNamespace( 5 ); // Example
$list['anotherpageid'] = $anotherPageMessageGroup;
return false;
}
);
$this->setTemporaryHook( 'TranslateInitGroupLoaders', [] );
$mg = MessageGroups::singleton();
$mg->setCache( new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ) );
$mg->recache();
}
public function testMessageValidator() {
$group = MessageGroups::getGroup( 'anotherpageid' );
$msgValidator = $group->getValidator();
$this->assertInstanceOf( ValidationRunner::class, $msgValidator,
'returns a valid object of ValidationRunner class.' );
}
}
|