Remove Database group again where possible

Override the target language in the parser options, so that it isn’t
looked up from the database; this lets UriLibraryTest avoid database
access. And since the Database group is no longer strictly required,
remove the statement to that effect from the phpdoc again.

Bug: T345372
Change-Id: I79f35257b123eb939d9ab67b16aa56d34586bb67
This commit is contained in:
Lucas Werkmeister 2023-09-06 11:33:42 +02:00
parent 7e54c088ac
commit b39d3589ba
3 changed files with 3 additions and 5 deletions

View file

@ -16,8 +16,6 @@ use PHPUnit\Framework\TestSuite;
* - $moduleName: Name of the module being tested
* - getTestModules(): Add a mapping from $moduleName to the file containing
* the code.
*
* Also, your test must be in the Database group.
*/
abstract class LuaEngineTestBase extends MediaWikiLangTestCase {
use LuaEngineTestHelper;

View file

@ -143,9 +143,11 @@ trait LuaEngineTestHelper {
*/
protected function getEngine() {
if ( !$this->engine ) {
$parser = MediaWikiServices::getInstance()->getParserFactory()->create();
$services = MediaWikiServices::getInstance();
$parser = $services->getParserFactory()->create();
$options = ParserOptions::newFromAnon();
$options->setTemplateCallback( [ $this, 'templateCallback' ] );
$options->setTargetLanguage( $services->getLanguageFactory()->getLanguage( 'en' ) );
$parser->startExternalParse( $this->getTestTitle(), $options, Parser::OT_HTML, true );
// HACK

View file

@ -4,8 +4,6 @@ namespace MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon;
/**
* @covers \MediaWiki\Extension\Scribunto\Engines\LuaCommon\UriLibrary
*
* @group Database
*/
class UriLibraryTest extends LuaEngineTestBase {
/** @inheritDoc */