Page MenuHomeWickedGov Phorge

HooksTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

HooksTest.php

<?php
declare( strict_types = 1 );
namespace Babel\Tests\Unit;
use MediaWiki\Babel\Babel;
use MediaWiki\Babel\BabelAutoCreate;
use MediaWiki\Babel\Hooks;
use MediaWiki\Config\HashConfig;
use MediaWiki\User\CentralId\CentralIdLookupFactory;
use MediaWiki\User\UserIdentityLookup;
use MediaWikiUnitTestCase;
use Parser;
use WANObjectCache;
/**
* @covers \MediaWiki\Babel\Hooks
*
* @group Babel
*
* @license GPL-2.0-or-later
* @author Thiemo Kreuz
*/
class HooksTest extends MediaWikiUnitTestCase {
private function newInstance() {
return new Hooks(
new HashConfig,
$this->createMock( UserIdentityLookup::class ),
$this->createMock( CentralIdLookupFactory::class ),
$this->createMock( WANObjectCache::class )
);
}
public function testOnParserFirstCallInit(): void {
$parser = $this->getMockBuilder( Parser::class )
->disableOriginalConstructor()
->getMock();
$parser->expects( $this->once() )
->method( 'setFunctionHook' )
->with( 'babel', [ Babel::class, 'Render' ] )
->willReturn( true );
$this->newInstance()->onParserFirstCallInit( $parser );
}
public function testOnUserGetReservedNames(): void {
$names = [];
$this->assertSame( [], $names, 'Precondition' );
$this->newInstance()->onUserGetReservedNames( $names );
$this->assertSame( [ 'msg:' . BabelAutoCreate::MSG_USERNAME ], $names );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 3, 22:26 (1 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
aa/81/a4d183838f761d898138923a8cf1
Default Alt Text
HooksTest.php (1 KB)

Event Timeline