2use Wikimedia\ScopedCallback;
64 parent::__construct();
69 if ( is_string(
$flags ) ) {
74 $mwTestDir =
$IP .
'/tests/';
76 # Human friendly helpers
80 # Will hold the .txt parser test files we will include
83 # Filter out .txt files
85 $isCore = ( 0 === strpos( $parserTestFile, $mwTestDir ) );
87 if ( $isCore && $wantsCore ) {
88 self::debug(
"included core parser tests: $parserTestFile" );
89 $filesToTest[] = $parserTestFile;
90 } elseif ( !$isCore && $wantsRest ) {
91 self::debug(
"included non core parser tests: $parserTestFile" );
92 $filesToTest[] = $parserTestFile;
94 self::debug(
"skipped parser tests: $parserTestFile" );
98 . implode(
' ', $filesToTest ) );
102 foreach ( $filesToTest
as $fileName ) {
107 $extensionName = basename( dirname( $fileName ) );
108 $testsName = $extensionName .
'__' . basename( $fileName,
'.txt' );
109 $parserTestClassName = ucfirst( $testsName );
113 $parserTestClassName =
'ParserTest_' .
114 preg_replace(
'/[^a-zA-Z0-9_\x7f-\xff]/',
'_', $parserTestClassName );
116 if ( isset( $testList[$parserTestClassName] ) ) {
119 $parserTestClassName .= $counter;
121 $testList[$parserTestClassName] =
true;
126 self::debug(
"Adding test class $parserTestClassName" );
128 $this->ptRunner, $parserTestClassName, $fileName ) );
135 $type = $db->getType();
136 $prefix =
$type ===
'oracle' ?
137 MediaWikiTestCase::ORA_DB_PREFIX : MediaWikiTestCase::DB_PREFIX;
138 MediaWikiTestCase::setupTestDB( $db, $prefix );
139 $teardown = $this->ptRunner->setDatabase( $db );
140 $teardown = $this->ptRunner->setupUploads( $teardown );
141 $this->ptTeardownScope = $teardown;
146 if ( $this->ptTeardownScope ) {
147 ScopedCallback::consume( $this->ptTeardownScope );
155 protected static function debug( $msg ) {
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
$wgParserTestFiles
Parser test suite files to be run by parserTests.php when no specific filename is passed to it.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfGetCaller( $level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
This is the suite class for running tests within a single .txt source file.
The UnitTest must be either a class that inherits from MediaWikiTestCase or a class that provides a p...
ScopedCallback $ptTeardownScope
static debug( $msg)
Write $msg under log group 'tests-parser'.
static suite( $flags=self::CORE_ONLY)
Get a PHPUnit test suite of parser tests.
ParserTestRunner $ptRunner
when a variable name is used in a it is silently declared as a new local masking the global
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
const NO_CORE
Include non core files as set in $wgParserTestFiles.
const WITH_ALL
Include anything set via $wgParserTestFiles.
const CORE_ONLY
Include files shipped with MediaWiki core.
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
it s the revision text itself In either if gzip is the revision text is gzipped $flags
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php