blob: ad57a29b5b89f3e46b198b2fc426a5da0ba203c9 (
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',
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' => wfGetCache( 'hash' ) ] ) );
$mg->recache();
}
public function testMessageValidator() {
$group = MessageGroups::getGroup( 'anotherpageid' );
$msgValidator = $group->getValidator();
$this->assertInstanceOf( ValidationRunner::class, $msgValidator,
'returns a valid object of ValidationRunner class.' );
}
}
|