mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-23 23:33:54 +00:00
Fix config overrides in SkinVectorTest.
Use overrideConfigValues instead of installMockMwServices and setMwGlobals. This ensures that configuration overrides are handled consistently. This also fixes a data provider that relied on a service, which causes the test to fail when not run via the pgpunit wrapper. Depends-On: I898927717ce961d98617a7fcd9c7fa8e19bec412 Change-Id: I6354fa39e1e9adf4be6eb6b26db82b8f106c593e
This commit is contained in:
parent
235c0872a6
commit
bf67540431
|
@ -2,7 +2,6 @@
|
|||
namespace MediaWiki\Skins\Vector\Tests\Integration;
|
||||
|
||||
use Exception;
|
||||
use HashConfig;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWikiIntegrationTestCase;
|
||||
use ReflectionMethod;
|
||||
|
@ -121,10 +120,9 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
|||
$tocData[ 'number-section-count' ] >= $config[ 'VectorTableOfContentsCollapseAtCount' ]
|
||||
];
|
||||
$expectedNestedTocData = array_merge( $nestedTocData, $expectedConfigData );
|
||||
$context = RequestContext::getMain();
|
||||
$buttonLabel = $context->msg( 'vector-toc-toggle-button-label',
|
||||
$expectedNestedTocData[ 'array-sections' ][ 0 ][ 'line' ]
|
||||
)->text();
|
||||
|
||||
// qqx output
|
||||
$buttonLabel = '(vector-toc-toggle-button-label: A)';
|
||||
$expectedNestedTocData[ 'array-sections' ][ 0 ][ 'vector-button-label' ] = $buttonLabel;
|
||||
|
||||
return [
|
||||
|
@ -186,10 +184,8 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
|||
array $config,
|
||||
array $expected
|
||||
) {
|
||||
$this->setMwGlobals( [
|
||||
'wgVectorTableOfContentsCollapseAtCount' => $config['VectorTableOfContentsCollapseAtCount'],
|
||||
'wgVectorTableOfContentsBeginning' => $config['VectorTableOfContentsBeginning'],
|
||||
] );
|
||||
$this->overrideConfigValues( $config );
|
||||
$this->setUserLang( 'qqx' );
|
||||
|
||||
$skinVector = new SkinVector22( [ 'name' => 'vector-2022' ] );
|
||||
$openSkinVector = TestingAccessWrapper::newFromObject( $skinVector );
|
||||
|
@ -439,12 +435,11 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
|||
bool $shouldHideLanguages,
|
||||
bool $expected
|
||||
) {
|
||||
$config = new HashConfig( array_merge( $requirements, [
|
||||
$this->overrideConfigValues( array_merge( $requirements, [
|
||||
'DefaultSkin' => 'vector-2022',
|
||||
'VectorDefaultSkinVersion' => '2',
|
||||
'VectorSkinMigrationMode' => true,
|
||||
] ) );
|
||||
$this->installMockMwServices( $config );
|
||||
|
||||
$mockSkinVector = $this->getMockBuilder( SkinVector22::class )
|
||||
->disableOriginalConstructor()
|
||||
|
|
Loading…
Reference in a new issue