Page MenuHomeWickedGov Phorge

TemplateDataSpecialPageTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

TemplateDataSpecialPageTest.php

<?php
use MediaWiki\Request\FauxRequest;
/**
* @group Database
* @license GPL-2.0-or-later
*/
class TemplateDataSpecialPageTest extends SpecialPageTestBase {
protected function setUp(): void {
parent::setUp();
$this->setUserLang( 'qqx' );
}
protected function newSpecialPage() {
return $this->getServiceContainer()->getSpecialPageFactory()->getPage( 'TemplateSearch' );
}
/**
* Get the full HTML of the special page
*
* @return array
*/
private function getSpecialPageHtml() {
return $this->executeSpecialPage( '', new FauxRequest(), null, $this->getTestUser()->getUser(), true );
}
/**
* Test that the special page loads when the feature is enabled
*
* @covers \MediaWiki\Extension\TemplateData\Special\SpecialTemplateDiscovery::execute
*/
public function testSpecialPageWhenFeatureEnabled() {
$this->overrideConfigValue( 'TemplateDataEnableDiscovery', true );
[ $html ] = $this->getSpecialPageHtml();
$this->assertStringNotContainsString( '(templatedata-template-discovery-disabled', $html );
$this->assertStringContainsString( 'id="ext-TemplateData-SpecialTemplateSearch-widget"', $html );
}
/**
* Test that the special page does not load when the feature is disabled
*
* @covers \MediaWiki\Extension\TemplateData\Special\SpecialTemplateDiscovery::execute
*/
public function testSpecialPageWhenFeatureDisabled() {
$this->overrideConfigValue( 'TemplateDataEnableDiscovery', false );
[ $html ] = $this->getSpecialPageHtml();
$this->assertStringContainsString( '(templatedata-template-discovery-disabled', $html );
}
}

File Metadata

Mime Type
text/x-php
Expires
Aug 17 2026, 08:49 (11 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bc/71/b67500d19846f66e1181b85a347a
Default Alt Text
TemplateDataSpecialPageTest.php (1 KB)

Event Timeline