mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-18 18:40:39 +00:00
a3306b24df
Change-Id: I3e8f0a0be16d92a411de796b8e25df3a7760099f
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\Math\Tests;
|
|
|
|
use MediaWikiIntegrationTestCase;
|
|
use RequestContext;
|
|
use Title;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\Math\HookHandlers\PreferencesHooksHandler
|
|
*/
|
|
class PreferencesIntegrationTest extends MediaWikiIntegrationTestCase {
|
|
|
|
public function testInvalidDefaultOptionFixed() {
|
|
$this->mergeMwGlobalArrayValue( 'wgDefaultUserOptions', [ 'math' => 'garbage' ] );
|
|
$this->assertContains(
|
|
$this->getServiceContainer()->getUserOptionsLookup()->getDefaultOption( 'math' ),
|
|
$this->getServiceContainer()->get( 'Math.Config' )->getValidRenderingModes()
|
|
);
|
|
}
|
|
|
|
public function testMathOptionRegistered() {
|
|
$context = new RequestContext();
|
|
$context->setTitle( Title::makeTitle( NS_MAIN, 'Dummy' ) );
|
|
$allPreferences = $this->getServiceContainer()
|
|
->getPreferencesFactory()
|
|
->getFormDescriptor( $this->getTestUser()->getUser(), $context );
|
|
$this->assertArrayHasKey( 'math', $allPreferences );
|
|
$mathPrefs = $allPreferences['math'];
|
|
$this->assertSame( 'radio', $mathPrefs['type'] );
|
|
$this->assertSame(
|
|
$this->getServiceContainer()->getUserOptionsLookup()->getDefaultOption( 'math' ),
|
|
$mathPrefs['default']
|
|
);
|
|
}
|
|
}
|