Page MenuHomeWickedGov Phorge

MobileContextWikibaseDescriptionsTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

MobileContextWikibaseDescriptionsTest.php

<?php
use MediaWiki\Config\Config;
/**
* @group MobileFrontend
*/
class MobileContextWikibaseDescriptionsTest extends MediaWikiIntegrationTestCase {
/**
* @var MobileContext
*/
protected $context;
/**
* @var Config
*/
protected $config;
protected function setUp(): void {
parent::setUp();
// Set relevant configuration variables to their default values.
$this->overrideConfigValue(
'MFDisplayWikibaseDescriptions', [
'search' => true,
'tagline' => false,
] );
$services = $this->getServiceContainer();
$this->context = $services->getService( 'MobileFrontend.Context' );
$this->config = $services->getService( 'MobileFrontend.Config' );
}
/**
* @covers MobileContext::shouldShowWikibaseDescriptions
*/
public function testShowingDescriptionsIsDisabledByDefault() {
$this->assertTrue(
$this->context->shouldShowWikibaseDescriptions( 'search', $this->config )
);
}
/**
* @covers MobileContext::shouldShowWikibaseDescriptions
*/
public function testShowingDescriptionsCanBeEnabled() {
$this->assertTrue(
$this->context->shouldShowWikibaseDescriptions( 'search', $this->config ),
'Showing descriptions is flagged by new variables.'
);
$this->assertFalse(
$this->context->shouldShowWikibaseDescriptions( 'tagline', $this->config ),
'Showing descriptions is flagged by tagline variable.'
);
}
public static function invalidFeatureProvider() {
return [
[ '' ],
[ 'foo' ],
];
}
/**
* @covers MobileContext::shouldShowWikibaseDescriptions
* @dataProvider invalidFeatureProvider
*/
public function testItThrowsAnExceptionIfFailureIsInvalid( $feature ) {
$this->expectException( DomainException::class );
$this->context->shouldShowWikibaseDescriptions( $feature, $this->config );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Nov 22, 07:51 (19 h, 50 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ac/32/7b951c58bdf158135d8e1a1966e3
Default Alt Text
MobileContextWikibaseDescriptionsTest.php (1 KB)

Event Timeline