* Added a hook, SpecialWatchlistGetNonRevisionTypes, to allow extensions
with custom recentchanges entries to hook into the Watchlist without
clobbering each other.
+* A hidden, empty input field was added to the edit form, and any edit that fills
+ it in will be rejected. This prevents against the simplest form of spambots.
+ Previously in the "SimpleAntiSpam" extension by Ryan Schmidt.
=== Bug fixes in 1.22 ===
* Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
--- /dev/null
+Security reminder: MediaWiki does not require PHP's register_globals. If you
+have it on, turn it '''off''' if you can.
+
+== MediaWiki 1.23 ==
+
+THIS IS NOT A RELEASE YET
+
+MediaWiki 1.23 is an alpha-quality branch and is not recommended for use in
+production.
+
+=== Configuration changes in 1.23 ===
+
+=== New features in 1.23 ===
+
+=== Bug fixes in 1.23 ===
+
+=== API changes in 1.23 ===
+
+=== Languages updated in 1.23===
+
+MediaWiki supports over 350 languages. Many localisations are updated
+regularly. Below only new and removed languages are listed, as well as
+changes to languages because of Bugzilla reports.
+
+=== Other changes in 1.23 ===
+
+== Compatibility ==
+
+MediaWiki 1.23 requires PHP 5.3.2 or later.
+
+MySQL is the recommended DBMS. PostgreSQL or SQLite can also be used, but
+support for them is somewhat less mature. There is experimental support for
+Oracle.
+
+The supported versions are:
+
+* MySQL 5.0.2 or later
+* PostgreSQL 8.3 or later
+* SQLite 3.3.7 or later
+* Oracle 9.0.1 or later
+
+== Upgrading ==
+
+1.23 has several database changes since 1.22, and will not work without schema
+updates. Note that due to changes to some very large tables like the revision
+table, the schema update may take quite long (minutes on a medium sized site,
+many hours on a large site).
+
+If upgrading from before 1.11, and you are using a wiki as a commons
+repository, make sure that it is updated as well. Otherwise, errors may arise
+due to database schema changes.
+
+If upgrading from before 1.7, you may want to run refreshLinks.php to ensure
+new database fields are filled with data.
+
+If you are upgrading from MediaWiki 1.4.x or earlier, you should upgrade to
+1.5 first. The upgrade script maintenance/upgrade1_5.php has been removed
+with MediaWiki 1.21.
+
+Don't forget to always back up your database before upgrading!
+
+See the file UPGRADE for more detailed upgrade instructions.
+
+For notes on 1.21.x and older releases, see HISTORY.
+
+== Online documentation ==
+
+Documentation for both end-users and site administrators is available on
+MediaWiki.org, and is covered under the GNU Free Documentation License (except
+for pages that explicitly state that their contents are in the public domain):
+
+ https://www.mediawiki.org/wiki/Documentation
+
+== Mailing list ==
+
+A mailing list is available for MediaWiki user support and discussion:
+
+ https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
+
+A low-traffic announcements-only list is also available:
+
+ https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce
+
+It's highly recommended that you sign up for one of these lists if you're
+going to run a public MediaWiki, so you can be notified of security fixes.
+
+== IRC help ==
+
+There's usually someone online in #mediawiki on irc.freenode.net.
* MediaWiki version number
* @since 1.2
*/
-$wgVersion = '1.22alpha';
+$wgVersion = '1.23alpha';
/**
* Name of the site. It must be changed in LocalSettings.php
return $status;
}
+ $spam = $wgRequest->getText( 'wpAntispam' );
+ if ( $spam !== '' ) {
+ wfDebugLog(
+ 'SimpleAntiSpam',
+ $wgUser->getName() .
+ ' editing "' .
+ $this->mTitle->getPrefixedText() .
+ '" submitted bogus field "' .
+ $spam .
+ '"'
+ );
+ $status->fatal( 'spamprotectionmatch', false );
+ $status->value = self::AS_SPAM_ERROR;
+ wfProfileOut( __METHOD__ . '-checks' );
+ wfProfileOut( __METHOD__ );
+ return $status;
+ }
+
try {
# Construct Content object
$textbox_content = $this->toEditContent( $this->textbox1 );
call_user_func_array( $formCallback, array( &$wgOut ) );
}
+ // Add an empty field to trip up spambots
+ $wgOut->addHTML(
+ Xml::openElement( 'div', array( 'id' => 'antispam-container', 'style' => 'display: none;' ) )
+ . Html::rawElement( 'label', array( 'for' => 'wpAntiSpam' ), wfMessage( 'simpleantispam-label' )->parse() )
+ . Xml::element( 'input', array( 'type' => 'text', 'name' => 'wpAntispam', 'id' => 'wpAntispam', 'value' => '' ) )
+ . Xml::closeElement( 'div' )
+ );
+
wfRunHooks( 'EditPage::showEditForm:fields', array( &$this, &$wgOut ) );
// Put these up at the top to ensure they aren't lost on early form submission
*/
private $mTarget = null;
+ /**
+ * @var bool: Whether output should contain table of contents
+ */
+ private $mEnableTOC = true;
+
/**
* Constructor for OutputPage. This should not be called directly.
* Instead a new RequestContext should be created and it will implicitly create
*/
function addParserOutput( &$parserOutput ) {
$this->addParserOutputNoText( $parserOutput );
+ $parserOutput->setTOCEnabled( $this->mEnableTOC );
$text = $parserOutput->getText();
wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
$this->addHTML( $text );
return array();
}
+ /**
+ * Enables/disables TOC, doesn't override __NOTOC__
+ * @param bool $flag
+ * @since 1.22
+ */
+ public function enableTOC( $flag = true ) {
+ $this->mEnableTOC = $flag;
+ }
+
+ /**
+ * @return bool
+ * @since 1.22
+ */
+ public function isTOCEnabled() {
+ return $this->mEnableTOC;
+ }
}
# Marker Suffix needs to be accessible staticly.
const MARKER_SUFFIX = "-QINU\x7f";
+ # Markers used for wrapping the table of contents
+ const TOC_START = '<mw:toc>';
+ const TOC_END = '</mw:toc>';
+
# Persistent:
var $mTagHooks = array();
var $mTransparentTagHooks = array();
$openmatch = preg_match( '/(?:<table|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
$closematch = preg_match(
'/(?:<\\/table|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|' .
- '<td|<th|<\\/?blockquote|<\\/?div|<hr|<\\/pre|<\\/p|' . $this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
+ '<td|<th|<\\/?blockquote|<\\/?div|<hr|<\\/pre|<\\/p|<\\/mw:|' . $this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
if ( $openmatch or $closematch ) {
$paragraphStack = false;
# TODO bug 5718: paragraph closed
}
$toc = Linker::tocList( $toc, $this->mOptions->getUserLangObj() );
$this->mOutput->setTOCHTML( $toc );
+ $toc = self::TOC_START . $toc . self::TOC_END;
}
if ( $isMain ) {
$mEditSectionTokens = false, # prefix/suffix markers if edit sections were output as tokens
$mProperties = array(), # Name/value pairs to be cached in the DB
$mTOCHTML = '', # HTML of the TOC
- $mTimestamp; # Timestamp of the revision
+ $mTimestamp, # Timestamp of the revision
+ $mTOCEnabled = true; # Whether TOC should be shown, can't override __NOTOC__
private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
private $mAccessedOptions = array(); # List of ParserOptions (stored in the keys)
private $mSecondaryDataUpdates = array(); # List of DataUpdate, used to save info from the page somewhere else.
}
function getText() {
+ wfProfileIn( __METHOD__ );
+ $text = $this->mText;
if ( $this->mEditSectionTokens ) {
- return preg_replace_callback( ParserOutput::EDITSECTION_REGEX,
- array( &$this, 'replaceEditSectionLinksCallback' ), $this->mText );
+ $text = preg_replace_callback( ParserOutput::EDITSECTION_REGEX,
+ array( &$this, 'replaceEditSectionLinksCallback' ), $text );
+ } else {
+ $text = preg_replace( ParserOutput::EDITSECTION_REGEX, '', $text );
+ }
+
+ // If you have an old cached version of this class - sorry, you can't disable the TOC
+ if ( isset( $this->mTOCEnabled ) && $this->mTOCEnabled ) {
+ $text = str_replace( array( Parser::TOC_START, Parser::TOC_END ), '', $text );
+ } else {
+ $text = preg_replace(
+ '#'. preg_quote( Parser::TOC_START ) . '.*?' . preg_quote( Parser::TOC_END ) . '#s',
+ '',
+ $text
+ );
}
- return preg_replace( ParserOutput::EDITSECTION_REGEX, '', $this->mText );
+ wfProfileOut( __METHOD__ );
+ return $text;
}
/**
function getTOCHTML() { return $this->mTOCHTML; }
function getTimestamp() { return $this->mTimestamp; }
function getLimitReportData() { return $this->mLimitReportData; }
+ function getTOCEnabled() { return $this->mTOCEnabled; }
function setText( $text ) { return wfSetVar( $this->mText, $text ); }
function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); }
function setIndexPolicy( $policy ) { return wfSetVar( $this->mIndexPolicy, $policy ); }
function setTOCHTML( $tochtml ) { return wfSetVar( $this->mTOCHTML, $tochtml ); }
function setTimestamp( $timestamp ) { return wfSetVar( $this->mTimestamp, $timestamp ); }
+ function setTOCEnabled( $flag ) { return wfSetVar( $this->mTOCEnabled, $flag ); }
function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
'spam_reverting' => 'Reverting to last revision not containing links to $1',
'spam_blanking' => 'All revisions contained links to $1, blanking',
'spam_deleting' => 'All revisions contained links to $1, deleting',
+'simpleantispam-label' => "Anti-spam check.
+Do '''NOT''' fill this in!",
# Info page
'pageinfo-header' => '-', # do not translate or duplicate this message to other languages
'spam_reverting',
'spam_blanking',
'spam_deleting',
+ 'simpleantispam-label',
),
'info' => array(
'pageinfo-header',
# tests/phpunit/includes/api
'ApiFormatTestBase' => "$testDir/phpunit/includes/api/format/ApiFormatTestBase.php",
'ApiTestCase' => "$testDir/phpunit/includes/api/ApiTestCase.php",
- 'ApiTestContext' => "$testDir/phpunit/includes/api/ApiTestCase.php",
- 'MockApi' => "$testDir/phpunit/includes/api/ApiTestCase.php",
+ 'ApiTestContext' => "$testDir/phpunit/includes/api/ApiTestContext.php",
+ 'MockApi' => "$testDir/phpunit/includes/api/MockApi.php",
+ 'UserWrapper' => "$testDir/phpunit/includes/api/UserWrapper.php",
'RandomImageGenerator' => "$testDir/phpunit/includes/api/RandomImageGenerator.php",
- 'UserWrapper' => "$testDir/phpunit/includes/api/ApiTestCase.php",
# tests/phpunit/includes/content
'DummyContentHandlerForTesting' => "$testDir/phpunit/includes/content/ContentHandlerTest.php",
/**
* Get a Parser object
+ *
+ * @param string $preprocessor
+ * @return Parser
*/
function getParser( $preprocessor = null ) {
global $wgParserConf;
$out = $parser->getPreloadText( $input, $title, $options );
} else {
$output = $parser->parse( $input, $title, $options, true, true, 1337 );
+ $output->setTOCEnabled( !isset( $opts['notoc'] ) );
$out = $output->getText();
if ( isset( $opts['showtitle'] ) ) {
/**
* Use a regex to find out the value of an option
* @param $key String: name of option val to retrieve
- * @param $opts Options array to look in
+ * @param $opts array: Options array to look in
* @param $default Mixed: default value returned if not found
*/
private static function getOptionValue( $key, $opts, $default ) {
# showtitle make the first line the title
# comment run through Linker::formatComment() instead of main parser
# local format section links in edit comment text as local links
+# notoc disable table of contents
#
# You can also set the following parser properties via test options:
# wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
</li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
</li>
</ul>
</div>
+
<h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
<h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
</li>
</ul>
</div>
+
<h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
</li>
</ul>
</div>
+
<h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="text_.3E_text">text > text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>section 1
</p>
<li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
</ul>
</div>
+
<h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
<h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
<h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
</li>
</ul>
</div>
+
<h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
<h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
<h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
</ul>
</div>
+
!! end
!! test
</li>
</ul>
</div>
+
<h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
<h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
!! end
<li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
!! end
<li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
!! end
<li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
!! end
<li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 < 3</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 < 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Proof: 2 < 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p><small>Hanc marginis exiguitas non caperet.</small>
QED
<li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b">Evilbye</sup></span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b">Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: b">Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
</ul>
</div>
+
<h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
</p>
!! end
+!!test
+Disable TOC
+!! options
+notoc
+!! input
+Lead
+== Section 1 ==
+== Section 2 ==
+== Section 3 ==
+== Section 4 ==
+== Section 5 ==
+!! result
+<p>Lead
+</p>
+
+<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+<h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+<h2><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+
+!! end
+
###
### Parsoids-specific tests
*/
class ArticleTablesTest extends MediaWikiLangTestCase {
+ /**
+ * @covers Title::getTemplateLinksFrom
+ * @covers Title::getLinksFrom
+ */
public function testbug14404() {
global $wgContLang, $wgLanguageCode, $wgLang;
$this->article = null;
}
+ /**
+ * @covers Article::__get
+ */
public function testImplementsGetMagic() {
$this->assertEquals( false, $this->article->mLatest, "Article __get magic" );
}
/**
* @depends testImplementsGetMagic
+ * @covers Article::__set
*/
public function testImplementsSetMagic() {
$this->article->mLatest = 2;
/**
* @depends testImplementsSetMagic
+ * @covers Article::__call
*/
public function testImplementsCallMagic() {
$this->article->mLatest = 33;
$this->assertEquals( 33, $this->article->getLatest(), "Article __call magic" );
}
+ /**
+ * @covers Article::__get
+ * @covers Article::__set
+ */
public function testGetOrSetOnNewProperty() {
$this->article->ext_someNewProperty = 12;
$this->assertEquals( 12, $this->article->ext_someNewProperty,
/**
* Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage class)
+ * @covers Article::selectFields
+ * @covers Article::onArticleCreate
+ * @covers Article::onArticleDelete
+ * @covers Article::onArticleEdit
+ * @covers Article::getAutosummary
*/
public function testStaticFunctions() {
$this->hideDeprecated( 'Article::getAutosummary' );
$this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ),
"Article static functions" );
}
-
- public function testWikiPageFactory() {
- $title = Title::makeTitle( NS_FILE, 'Someimage.png' );
- $page = WikiPage::factory( $title );
- $this->assertEquals( 'WikiFilePage', get_class( $page ) );
-
- $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory' );
- $page = WikiPage::factory( $title );
- $this->assertEquals( 'WikiCategoryPage', get_class( $page ) );
-
- $title = Title::makeTitle( NS_MAIN, 'SomePage' );
- $page = WikiPage::factory( $title );
- $this->assertEquals( 'WikiPage', get_class( $page ) );
- }
}
*/
class BlockTest extends MediaWikiLangTestCase {
- private $block, $madeAt;
+ /** @var Block */
+ private $block;
+ private $madeAt;
/* variable used to save up the blockID we insert in this test suite */
private $blockId;
}
}
- public function testInitializerFunctionsReturnCorrectBlock() {
- // $this->dumpBlocks();
-
+ /**
+ * @covers Block::newFromTarget
+ */
+ public function testINewFromTargetReturnsCorrectBlock() {
$this->assertTrue( $this->block->equals( Block::newFromTarget( 'UTBlockee' ) ), "newFromTarget() returns the same block as the one that was made" );
+ }
+ /**
+ * @covers Block::newFromID
+ */
+ public function testINewFromIDReturnsCorrectBlock() {
$this->assertTrue( $this->block->equals( Block::newFromID( $this->blockId ) ), "newFromID() returns the same block as the one that was made" );
}
* This stopped working with r84475 and friends: regression being fixed for bug 29116.
*
* @dataProvider provideBug29116Data
+ * @covers Block::load
*/
public function testBug29116LoadWithEmptyIp( $vagueTarget ) {
$this->hideDeprecated( 'Block::load' );
* had. Regression bug 29116.
*
* @dataProvider provideBug29116Data
+ * @covers Block::newFromTarget
*/
public function testBug29116NewFromTargetWithEmptyIp( $vagueTarget ) {
$block = Block::newFromTarget( 'UTBlockee', $vagueTarget );
);
}
+ /**
+ * @covers Block::prevents
+ */
public function testBlockedUserCanNotCreateAccount() {
$username = 'BlockedUserToCreateAccountWith';
$u = User::newFromName( $username );
);
}
+ /**
+ * @covers Block::insert
+ */
public function testCrappyCrossWikiBlocks() {
// Delete the last round's block if it's still there
$oldBlock = Block::newFromTarget( 'UserOnForeignWiki' );
/**
* @dataProvider providerXff
+ * @covers Block::getBlocksForIPList
+ * @covers Block::chooseBlock
*/
public function testBlocksOnXff( $xff, $exCount, $exResult ) {
$list = array_map( 'trim', explode( ',', $xff ) );
/**
* Test the CDB reader/writer
+ * @covers CdbWriter_PHP
+ * @covers CdbWriter_DBA
*/
class CdbTest extends MediaWikiTestCase {
<?php
+
+/**
+ * Class CollationTest
+ * @covers Collation
+ * @covers IcuCollation
+ * @covers IdentityCollation
+ * @covers UppercaseCollation
+ */
class CollationTest extends MediaWikiLangTestCase {
protected function setUp() {
parent::setUp();
$this->assertStringStartsWith( $baseBin, $extendedBin, "$base is not a prefix of $extended" );
}
- function prefixDataProvider() {
+ public static function prefixDataProvider() {
return array(
array( 'en', 'A', 'AA' ),
array( 'en', 'A', 'AAA' ),
$this->assertStringStartsNotWith( $baseBin, $extendedBin, "$base is a prefix of $extended" );
}
- function notPrefixDataProvider() {
+ public static function notPrefixDataProvider() {
return array(
array( 'en', 'A', 'B' ),
array( 'en', 'AC', 'ABC' ),
/**
* Test for DiffHistoryBlob::xdiffAdler32()
* @dataProvider provideXdiffAdler32
+ * @covers DiffHistoryBlob::xdiffAdler32
*/
public function testXdiffAdler32( $input ) {
$xdiffHash = substr( xdiff_string_rabdiff( $input, '' ), 0, 4 );
/**
* @dataProvider provideExtractSectionTitle
+ * @covers EditPage::extractSectionTitle
*/
public function testExtractSectionTitle( $section, $title ) {
$extracted = EditPage::extractSectionTitle( $section );
* wrapper around assertEquals() which calls rrtrim() to normalize the
* expected and actual texts.
*/
- function assertEditedTextEquals( $expected, $actual, $msg = '' ) {
+ protected function assertEditedTextEquals( $expected, $actual, $msg = '' ) {
return $this->assertEquals( rtrim( $expected ), rtrim( $actual ), $msg );
}
return $page;
}
+ /**
+ * @todo split into a dataprovider and test method
+ * @covers EditPage
+ */
public function testCreatePage() {
$this->assertEdit(
'EditPageTest_testCreatePage',
/**
* @dataProvider provideSectionEdit
+ * @covers EditPage
*/
public function testSectionEdit( $base, $section, $text, $summary, $expected ) {
$edit = array(
/**
* @dataProvider provideAutoMerge
+ * @covers EditPage
*/
public function testAutoMerge( $baseUser, $text, $adamsEdit, $bertasEdit,
$expectedCode, $expectedText, $message = null
class ExternalStoreTest extends MediaWikiTestCase {
+ /**
+ * @covers ExternalStore::fetchFromURL
+ */
public function testExternalFetchFromURL() {
$this->setMwGlobals( 'wgExternalStores', false );
*/
class ExtraParserTest extends MediaWikiTestCase {
+ /** @var ParserOptions */
+ protected $options;
+ /** @var Parser */
+ protected $parser;
+
protected function setUp() {
parent::setUp();
MagicWord::clearCache();
}
- // Bug 8689 - Long numeric lines kill the parser
+ /**
+ * Bug 8689 - Long numeric lines kill the parser
+ * @covers Parser::parse
+ */
public function testBug8689() {
global $wgUser;
$longLine = '1.' . str_repeat( '1234567890', 100000 ) . "\n";
$this->parser->parse( $longLine, $t, $options )->getText() );
}
- /* Test the parser entry points */
+ /**
+ * Test the parser entry points
+ * @covers Parser::parse
+ */
public function testParse() {
$title = Title::newFromText( __FUNCTION__ );
$parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
$this->assertEquals( "<p>Test\nContent of <i>Template:Foo</i>\nContent of <i>Template:Bar</i>\n</p>", $parserOutput->getText() );
}
+ /**
+ * @covers Parser::preSaveTransform
+ */
public function testPreSaveTransform() {
global $wgUser;
$title = Title::newFromText( __FUNCTION__ );
$this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText );
}
+ /**
+ * @covers Parser::preprocess
+ */
public function testPreprocess() {
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
/**
* cleanSig() makes all templates substs and removes tildes
+ * @covers Parser::cleanSig
*/
public function testCleanSig() {
$title = Title::newFromText( __FUNCTION__ );
/**
* cleanSig() should do nothing if disabled
+ * @covers Parser::cleanSig
*/
public function testCleanSigDisabled() {
$this->setMwGlobals( 'wgCleanSignatures', false );
/**
* cleanSigInSig() just removes tildes
* @dataProvider provideStringsForCleanSigInSig
+ * @covers Parser::cleanSigInSig
*/
public function testCleanSigInSig( $in, $out ) {
$this->assertEquals( Parser::cleanSigInSig( $in ), $out );
);
}
+ /**
+ * @covers Parser::getSection
+ */
public function testGetSection() {
$outputText2 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 2 );
$outputText1 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1 );
$this->assertEquals( "== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2", $outputText1 );
}
+ /**
+ * @covers Parser::replaceSection
+ */
public function testReplaceSection() {
$outputText = $this->parser->replaceSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1, "New section 1" );
/**
* Templates and comments are not affected, but noinclude/onlyinclude is.
+ * @covers Parser::getPreloadText
*/
public function testGetPreloadText() {
$title = Title::newFromText( __FUNCTION__ );
/**
* @group Database
+ * @covers Parser::parse
*/
public function testTrackingCategory() {
$title = Title::newFromText( __FUNCTION__ );
/**
* @group Database
+ * @covers Parser::parse
*/
public function testTrackingCategorySpecial() {
// Special pages shouldn't have tracking cats.
class FauxRequestTest extends MediaWikiTestCase {
+ /**
+ * @covers FauxRequest::setHeader
+ * @covers FauxRequest::getHeader
+ */
public function testGetSetHeader() {
$value = 'test/test';
*/
class FauxResponseTest extends MediaWikiTestCase {
- var $response;
+ /** @var FauxResponse */
+ protected $response;
protected function setUp() {
parent::setUp();
$this->response = new FauxResponse;
}
+ /**
+ * @covers FauxResponse::getcookie
+ * @covers FauxResponse::setcookie
+ */
public function testCookie() {
$this->assertEquals( null, $this->response->getcookie( 'key' ), 'Non-existing cookie' );
$this->response->setcookie( 'key', 'val' );
$this->assertEquals( 'val', $this->response->getcookie( 'key' ), 'Existing cookie' );
}
+ /**
+ * @covers FauxResponse::getheader
+ * @covers FauxResponse::header
+ */
public function testHeader() {
$this->assertEquals( null, $this->response->getheader( 'Location' ), 'Non-existing header' );
$this->assertEquals( 'http://localhost/', $this->response->getheader( 'LOCATION' ), 'Get header case insensitive' );
}
+ /**
+ * @covers FauxResponse::getStatusCode
+ */
public function testResponseCode() {
$this->response->header( 'HTTP/1.1 200' );
$this->assertEquals( 200, $this->response->getStatusCode(), 'Header with no message' );
*/
protected $object;
-
/**
* A new fresh and empty FormOptions object to test initialization
* with.
$this->object = new FormOptionsExposed();
}
+ /**
+ * @covers FormOptionsExposed::add
+ */
public function testAddStringOption() {
$this->object->add( 'foo', 'string value' );
$this->assertEquals(
);
}
+ /**
+ * @covers FormOptionsExposed::add
+ */
public function testAddIntegers() {
$this->object->add( 'one', 1 );
$this->object->add( 'negone', -1 );
/**
* Reuse helpers above assertGuessBoolean assertGuessInt assertGuessString
+ * @covers FormOptions::guessType
*/
public function testGuessTypeDetection() {
$this->assertGuessBoolean( true );
/**
* @expectedException MWException
+ * @covers FormOptions::guessType
*/
public function testGuessTypeOnArrayThrowException() {
$this->object->guessType( array( 'foo' ) );
}
/**
* @expectedException MWException
+ * @covers FormOptions::guessType
*/
public function testGuessTypeOnNullThrowException() {
$this->object->guessType( null );
<?php
/**
- * Unit tests for the HTMLCheckMatrix form field
+ * Unit tests for the HTMLCheckMatrix + HTMLFormField
+ * @todo the tests for the two classes could be split up
*/
class HtmlCheckMatrixTest extends MediaWikiTestCase {
static private $defaultOptions = array(
'fieldname' => 'test',
);
+ /**
+ * @covers HTMLCheckMatrix::__construct
+ */
public function testPlainInstantiation() {
try {
$form = new HTMLCheckMatrix( array() );
$this->fail( 'Expected MWException indicating missing parameters but none was thrown.' );
}
+ /**
+ * @covers HTMLCheckMatrix::__construct
+ */
public function testInstantiationWithMinimumRequiredParameters() {
$form = new HTMLCheckMatrix( self::$defaultOptions );
$this->assertTrue( true ); // form instantiation must throw exception on failure
}
+ /**
+ * @covers HTMLFormField::validate
+ */
public function testValidateCallsUserDefinedValidationCallback() {
$called = false;
$field = new HTMLCheckMatrix( self::$defaultOptions + array(
$this->assertTrue( $called );
}
+ /**
+ * @covers HTMLFormField::validate
+ */
public function testValidateRequiresArrayInput() {
$field = new HTMLCheckMatrix( self::$defaultOptions );
$this->assertEquals( false, $this->validate( $field, null ) );
$this->assertEquals( true, $this->validate( $field, array() ) );
}
+ /**
+ * @covers HTMLFormField::validate
+ */
public function testValidateAllowsOnlyKnownTags() {
$field = new HTMLCheckMatrix( self::$defaultOptions );
$this->assertInternalType( 'string', $this->validate( $field, array( 'foo' ) ) );
}
+ /**
+ * @covers HTMLFormField::validate
+ */
public function testValidateAcceptsPartialTagList() {
$field = new HTMLCheckMatrix( self::$defaultOptions );
$this->assertTrue( $this->validate( $field, array() ) );
* foreach ( $field->filterDataForSubmit( $data ) as $k => $v ) {
* $user->setOption( $k, $v );
* }
+ * @covers HTMLFormField::filterDataForSubmit
*/
public function testValuesForcedOnRemainOn() {
$field = new HTMLCheckMatrix( self::$defaultOptions + array(
$this->assertEquals( $expected, $field->filterDataForSubmit( array() ) );
}
+ /**
+ * @covers HTMLFormField::filterDataForSubmit
+ */
public function testValuesForcedOffRemainOff() {
$field = new HTMLCheckMatrix( self::$defaultOptions + array(
'force-options-off' => array( 'c1-r2', 'c2-r2' ),
* @group HashRing
*/
class HashRingTest extends MediaWikiTestCase {
+ /**
+ * @covers HashRing
+ */
public function testHashRing() {
$ring = new HashRing( array( 's1' => 1, 's2' => 1, 's3' => 2, 's4' => 2, 's5' => 2, 's6' => 3 ) );
/**
* @dataProvider provideHooks
+ * @covers ::wfRunHooks
*/
public function testOldStyleHooks( $msg, array $hook, $expectedFoo, $expectedBar ) {
global $wgHooks;
/**
* @dataProvider provideHooks
+ * @covers Hooks::register
+ * @covers Hooks::run
*/
public function testNewStyleHooks( $msg, $hook, $expectedFoo, $expectedBar ) {
$foo = $bar = 'original';
$this->assertSame( $expectedBar, $bar, $msg );
}
+ /**
+ * @covers Hooks::isRegistered
+ * @covers Hooks::register
+ * @covers Hooks::getHandlers
+ * @covers Hooks::run
+ */
public function testNewStyleHookInteraction() {
global $wgHooks;
/**
* @expectedException MWException
+ * @covers Hooks::run
*/
public function testUncallableFunction() {
Hooks::register( 'MediaWikiHooksTest001', 'ThisFunctionDoesntExist' );
Hooks::run( 'MediaWikiHooksTest001', array() );
}
+ /**
+ * @covers Hooks::run
+ */
public function testFalseReturn() {
Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) {
return false;
/**
* @expectedException FatalError
+ * @covers Hooks::run
*/
public function testFatalError() {
Hooks::register( 'MediaWikiHooksTest001', function () {
class HtmlFormatterTest extends MediaWikiTestCase {
/**
* @dataProvider getHtmlData
+ * @covers HtmlFormatter::getText
*/
public function testTransform( $input, $expected, $callback = false ) {
$input = self::normalize( $input );
) );
}
+ /**
+ * @covers Html::element
+ */
public function testElementBasics() {
$this->assertEquals(
'<img>',
/**
* @dataProvider dataXmlMimeType
+ * @covers Html::isXmlMimeType
*/
public function testXmlMimeType( $mimetype, $isXmlMimeType ) {
$this->assertEquals( $isXmlMimeType, Html::isXmlMimeType( $mimetype ) );
}
+ /**
+ * @covers HTML::expandAttributes
+ */
public function testExpandAttributesSkipsNullAndFalse() {
### EMPTY ########
);
}
+ /**
+ * @covers HTML::expandAttributes
+ */
public function testExpandAttributesForBooleans() {
$this->assertEquals(
'',
/**
* Test for Html::expandAttributes()
* Please note it output a string prefixed with a space!
+ * @covers Html::expandAttributes
*/
public function testExpandAttributesVariousExpansions() {
### NOT EMPTY ####
* Html::expandAttributes has special features for HTML
* attributes that use space separated lists and also
* allows arrays to be used as values.
+ * @covers Html::expandAttributes
*/
public function testExpandAttributesListValueAttributes() {
### STRING VALUES
/**
* Test feature added by r96188, let pass attributes values as
* a PHP array. Restricted to class,rel, accesskey.
+ * @covers Html::expandAttributes
*/
public function testExpandAttributesSpaceSeparatedAttributesWithBoolean() {
$this->assertEquals(
* The later will take precedence.
*
* Feature added by r96188
+ * @covers Html::expandAttributes
*/
public function testValueIsAuthoritativeInSpaceSeparatedAttributesArrays() {
$this->assertEquals(
);
}
+ /**
+ * @covers Html::namespaceSelector
+ */
public function testNamespaceSelector() {
$this->assertEquals(
'<select id=namespace name=namespace>' . "\n" .
/**
* @dataProvider provideHtml5InputTypes
+ * @covers Html::element
*/
public function testHtmlElementAcceptsNewHtml5TypesInHtml5Mode( $HTML5InputType ) {
$this->assertEquals(
return $ret;
}
+ /**
+ * @covers Html::expandAttributes
+ */
public function testFormValidationBlacklist() {
$this->assertEmpty(
Html::expandAttributes( array( 'min' => 1, 'max' => 100, 'pattern' => 'abc', 'required' => true, 'step' => 2 ) ),
<?php
class LanguageConverterTest extends MediaWikiLangTestCase {
+ /** @var LanguageToTest */
protected $lang = null;
+ /** @var TestConverter */
protected $lc = null;
protected function setUp() {
parent::tearDown();
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ */
public function testGetPreferredVariantDefaults() {
$this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ * @covers LanguageConverter::getHeaderVariant
+ */
public function testGetPreferredVariantHeaders() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'tg-latn' );
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ * @covers LanguageConverter::getHeaderVariant
+ */
public function testGetPreferredVariantHeaderWeight() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'tg;q=1' );
$this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ * @covers LanguageConverter::getHeaderVariant
+ */
public function testGetPreferredVariantHeaderWeight2() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'tg-latn;q=1' );
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ * @covers LanguageConverter::getHeaderVariant
+ */
public function testGetPreferredVariantHeaderMulti() {
global $wgRequest;
$wgRequest->setHeader( 'Accept-Language', 'en, tg-latn;q=1' );
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ */
public function testGetPreferredVariantUserOption() {
global $wgUser;
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ * @covers LanguageConverter::getUserVariant
+ */
public function testGetPreferredVariantUserOptionForForeignLanguage() {
global $wgContLang, $wgUser;
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ * @covers LanguageConverter::getUserVariant
+ * @covers LanguageConverter::getURLVariant
+ */
public function testGetPreferredVariantHeaderUserVsUrl() {
global $wgContLang, $wgRequest, $wgUser;
$this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
}
-
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ */
public function testGetPreferredVariantDefaultLanguageVariant() {
global $wgDefaultLanguageVariant;
$this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
}
+ /**
+ * @covers LanguageConverter::getPreferredVariant
+ * @covers LanguageConverter::getURLVariant
+ */
public function testGetPreferredVariantDefaultLanguageVsUrlVariant() {
global $wgDefaultLanguageVariant, $wgRequest, $wgContLang;
$this->assertEquals( $expected, $text );
}
+
+ /**
+ * @covers WikiPage::factory
+ */
+ public function testWikiPageFactory() {
+ $title = Title::makeTitle( NS_FILE, 'Someimage.png' );
+ $page = WikiPage::factory( $title );
+ $this->assertEquals( 'WikiFilePage', get_class( $page ) );
+
+ $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory' );
+ $page = WikiPage::factory( $title );
+ $this->assertEquals( 'WikiCategoryPage', get_class( $page ) );
+
+ $title = Title::makeTitle( NS_MAIN, 'SomePage' );
+ $page = WikiPage::factory( $title );
+ $this->assertEquals( 'WikiPage', get_class( $page ) );
+ }
}
+++ /dev/null
-<?php
-
-/**
- * @group Database
- * @group API
- * @group medium
- */
-class ApiCreateAccountTest extends ApiTestCase {
- function setUp() {
- parent::setUp();
- LoginForm::setCreateaccountToken();
- $this->setMwGlobals( array( 'wgEnableEmail' => true ) );
- }
-
- /**
- * Test the account creation API with a valid request. Also
- * make sure the new account can log in and is valid.
- *
- * This test does multiple API requests so it might end up being
- * a bit slow. Raise the default timeout.
- * @group medium
- */
- public function testValid() {
- global $wgServer;
-
- if ( !isset( $wgServer ) ) {
- $this->markTestIncomplete( 'This test needs $wgServer to be set in LocalSettings.php' );
- }
-
- $password = User::randomPassword();
-
- $ret = $this->doApiRequest( array(
- 'action' => 'createaccount',
- 'name' => 'Apitestnew',
- 'password' => $password,
- 'email' => 'test@domain.test',
- 'realname' => 'Test Name'
- ) );
-
- $result = $ret[0];
- $this->assertNotInternalType( 'bool', $result );
- $this->assertNotInternalType( 'null', $result['createaccount'] );
-
- // Should first ask for token.
- $a = $result['createaccount'];
- $this->assertEquals( 'needtoken', $a['result'] );
- $token = $a['token'];
-
- // Finally create the account
- $ret = $this->doApiRequest(
- array(
- 'action' => 'createaccount',
- 'name' => 'Apitestnew',
- 'password' => $password,
- 'token' => $token,
- 'email' => 'test@domain.test',
- 'realname' => 'Test Name'
- ),
- $ret[2]
- );
-
- $result = $ret[0];
- $this->assertNotInternalType( 'bool', $result );
- $this->assertEquals( 'success', $result['createaccount']['result'] );
-
- // Try logging in with the new user.
- $ret = $this->doApiRequest( array(
- 'action' => 'login',
- 'lgname' => 'Apitestnew',
- 'lgpassword' => $password,
- ) );
-
- $result = $ret[0];
- $this->assertNotInternalType( 'bool', $result );
- $this->assertNotInternalType( 'null', $result['login'] );
-
- $a = $result['login']['result'];
- $this->assertEquals( 'NeedToken', $a );
- $token = $result['login']['token'];
-
- $ret = $this->doApiRequest(
- array(
- 'action' => 'login',
- 'lgtoken' => $token,
- 'lgname' => 'Apitestnew',
- 'lgpassword' => $password,
- ),
- $ret[2]
- );
-
- $result = $ret[0];
-
- $this->assertNotInternalType( 'bool', $result );
- $a = $result['login']['result'];
-
- $this->assertEquals( 'Success', $a );
-
- // log out to destroy the session
- $ret = $this->doApiRequest(
- array(
- 'action' => 'logout',
- ),
- $ret[2]
- );
- $this->assertEquals( array(), $ret[0] );
- }
-
- /**
- * Make sure requests with no names are invalid.
- * @expectedException UsageException
- */
- public function testNoName() {
- $this->doApiRequest( array(
- 'action' => 'createaccount',
- 'token' => LoginForm::getCreateaccountToken(),
- 'password' => 'password',
- ) );
- }
-
- /**
- * Make sure requests with no password are invalid.
- * @expectedException UsageException
- */
- public function testNoPassword() {
- $this->doApiRequest( array(
- 'action' => 'createaccount',
- 'name' => 'testName',
- 'token' => LoginForm::getCreateaccountToken(),
- ) );
- }
-
- /**
- * Make sure requests with existing users are invalid.
- * @expectedException UsageException
- */
- public function testExistingUser() {
- $this->doApiRequest( array(
- 'action' => 'createaccount',
- 'name' => 'Apitestsysop',
- 'token' => LoginForm::getCreateaccountToken(),
- 'password' => 'password',
- 'email' => 'test@domain.test',
- ) );
- }
-
- /**
- * Make sure requests with invalid emails are invalid.
- * @expectedException UsageException
- */
- public function testInvalidEmail() {
- $this->doApiRequest( array(
- 'action' => 'createaccount',
- 'name' => 'Test User',
- 'token' => LoginForm::getCreateaccountToken(),
- 'password' => 'password',
- 'email' => 'invalid',
- ) );
- }
-}
* @group API
* @group Database
* @group medium
+ *
+ * @covers ApiBlock
*/
class ApiBlockTest extends ApiTestCase {
protected function setUp() {
$this->doLogin();
}
- function getTokens() {
+ protected function getTokens() {
return $this->getTokenList( self::$users['sysop'] );
}
}
/**
- * Attempting to block without a token should give a UsageException with
- * error message:
- * "The token parameter must be set"
- *
- * @dataProvider provideBlockUnblockAction
* @expectedException UsageException
+ * @expectedExceptionMessage The token parameter must be set
*/
- public function testBlockingActionWithNoToken( $action ) {
+ public function testBlockingActionWithNoToken( ) {
$this->doApiRequest(
array(
- 'action' => $action,
+ 'action' => 'block',
'user' => 'UTApiBlockee',
'reason' => 'Some reason',
),
self::$users['sysop']->user
);
}
-
- /**
- * Just provide the 'block' and 'unblock' action to test both API calls
- */
- public static function provideBlockUnblockAction() {
- return array(
- array( 'block' ),
- array( 'unblock' ),
- );
- }
}
--- /dev/null
+<?php
+
+/**
+ * @group Database
+ * @group API
+ * @group medium
+ *
+ * @covers ApiCreateAccount
+ */
+class ApiCreateAccountTest extends ApiTestCase {
+ protected function setUp() {
+ parent::setUp();
+ LoginForm::setCreateaccountToken();
+ $this->setMwGlobals( array( 'wgEnableEmail' => true ) );
+ }
+
+ /**
+ * Test the account creation API with a valid request. Also
+ * make sure the new account can log in and is valid.
+ *
+ * This test does multiple API requests so it might end up being
+ * a bit slow. Raise the default timeout.
+ * @group medium
+ */
+ public function testValid() {
+ global $wgServer;
+
+ if ( !isset( $wgServer ) ) {
+ $this->markTestIncomplete( 'This test needs $wgServer to be set in LocalSettings.php' );
+ }
+
+ $password = User::randomPassword();
+
+ $ret = $this->doApiRequest( array(
+ 'action' => 'createaccount',
+ 'name' => 'Apitestnew',
+ 'password' => $password,
+ 'email' => 'test@domain.test',
+ 'realname' => 'Test Name'
+ ) );
+
+ $result = $ret[0];
+ $this->assertNotInternalType( 'bool', $result );
+ $this->assertNotInternalType( 'null', $result['createaccount'] );
+
+ // Should first ask for token.
+ $a = $result['createaccount'];
+ $this->assertEquals( 'needtoken', $a['result'] );
+ $token = $a['token'];
+
+ // Finally create the account
+ $ret = $this->doApiRequest(
+ array(
+ 'action' => 'createaccount',
+ 'name' => 'Apitestnew',
+ 'password' => $password,
+ 'token' => $token,
+ 'email' => 'test@domain.test',
+ 'realname' => 'Test Name'
+ ),
+ $ret[2]
+ );
+
+ $result = $ret[0];
+ $this->assertNotInternalType( 'bool', $result );
+ $this->assertEquals( 'success', $result['createaccount']['result'] );
+
+ // Try logging in with the new user.
+ $ret = $this->doApiRequest( array(
+ 'action' => 'login',
+ 'lgname' => 'Apitestnew',
+ 'lgpassword' => $password,
+ ) );
+
+ $result = $ret[0];
+ $this->assertNotInternalType( 'bool', $result );
+ $this->assertNotInternalType( 'null', $result['login'] );
+
+ $a = $result['login']['result'];
+ $this->assertEquals( 'NeedToken', $a );
+ $token = $result['login']['token'];
+
+ $ret = $this->doApiRequest(
+ array(
+ 'action' => 'login',
+ 'lgtoken' => $token,
+ 'lgname' => 'Apitestnew',
+ 'lgpassword' => $password,
+ ),
+ $ret[2]
+ );
+
+ $result = $ret[0];
+
+ $this->assertNotInternalType( 'bool', $result );
+ $a = $result['login']['result'];
+
+ $this->assertEquals( 'Success', $a );
+
+ // log out to destroy the session
+ $ret = $this->doApiRequest(
+ array(
+ 'action' => 'logout',
+ ),
+ $ret[2]
+ );
+ $this->assertEquals( array(), $ret[0] );
+ }
+
+ /**
+ * Make sure requests with no names are invalid.
+ * @expectedException UsageException
+ */
+ public function testNoName() {
+ $this->doApiRequest( array(
+ 'action' => 'createaccount',
+ 'token' => LoginForm::getCreateaccountToken(),
+ 'password' => 'password',
+ ) );
+ }
+
+ /**
+ * Make sure requests with no password are invalid.
+ * @expectedException UsageException
+ */
+ public function testNoPassword() {
+ $this->doApiRequest( array(
+ 'action' => 'createaccount',
+ 'name' => 'testName',
+ 'token' => LoginForm::getCreateaccountToken(),
+ ) );
+ }
+
+ /**
+ * Make sure requests with existing users are invalid.
+ * @expectedException UsageException
+ */
+ public function testExistingUser() {
+ $this->doApiRequest( array(
+ 'action' => 'createaccount',
+ 'name' => 'Apitestsysop',
+ 'token' => LoginForm::getCreateaccountToken(),
+ 'password' => 'password',
+ 'email' => 'test@domain.test',
+ ) );
+ }
+
+ /**
+ * Make sure requests with invalid emails are invalid.
+ * @expectedException UsageException
+ */
+ public function testInvalidEmail() {
+ $this->doApiRequest( array(
+ 'action' => 'createaccount',
+ 'name' => 'Test User',
+ 'token' => LoginForm::getCreateaccountToken(),
+ 'password' => 'password',
+ 'email' => 'invalid',
+ ) );
+ }
+}
* @group API
* @group Database
* @group medium
+ *
+ * @covers ApiEditPage
*/
class ApiEditPageTest extends ApiTestCase {
* @group API
* @group Database
* @group medium
+ *
+ * @covers ApiOptions
*/
class ApiOptionsTest extends MediaWikiLangTestCase {
- private $mTested, $mUserMock, $mContext, $mSession;
+ /** @var PHPUnit_Framework_MockObject_MockObject */
+ private $mUserMock ;
+ /** @var ApiOptions */
+ private $mTested;
+ private $mSession;
+ /** @var DerivativeContext */
+ private $mContext;
private $mOldGetPreferencesHooks = false;
* @group API
* @group Database
* @group medium
+ *
+ * @covers ApiParse
*/
class ApiParseTest extends ApiTestCase {
* @group API
* @group Database
* @group medium
+ *
+ * @covers ApiPurge
*/
class ApiPurgeTest extends ApiTestCase {
* @param $params Array: key-value API params
* @param $session Array|null: session array
* @param $user User|null A User object for the context
- * @return result of the API call
+ * @return mixed result of the API call
* @throws Exception in case wsToken is not set in the session
*/
protected function doApiRequestWithToken( array $params, array $session = null, User $user = null ) {
);
}
}
-
-class UserWrapper {
- public $userName;
- public $password;
- public $user;
-
- public function __construct( $userName, $password, $group = '' ) {
- $this->userName = $userName;
- $this->password = $password;
-
- $this->user = User::newFromName( $this->userName );
- if ( !$this->user->getID() ) {
- $this->user = User::createNew( $this->userName, array(
- "email" => "test@example.com",
- "real_name" => "Test User" ) );
- }
- $this->user->setPassword( $this->password );
-
- if ( $group !== '' ) {
- $this->user->addGroup( $group );
- }
- $this->user->saveSettings();
- }
-}
-
-class MockApi extends ApiBase {
- public function execute() {
- }
-
- public function getVersion() {
- }
-
- public function __construct() {
- }
-
- public function getAllowedParams() {
- return array(
- 'filename' => null,
- 'enablechunks' => false,
- 'sessionkey' => null,
- );
- }
-}
-
-class ApiTestContext extends RequestContext {
-
- /**
- * Returns a DerivativeContext with the request variables in place
- *
- * @param $request WebRequest request object including parameters and session
- * @param $user User or null
- * @return DerivativeContext
- */
- public function newTestContext( WebRequest $request, User $user = null ) {
- $context = new DerivativeContext( $this );
- $context->setRequest( $request );
- if ( $user !== null ) {
- $context->setUser( $user );
- }
-
- return $context;
- }
-}
--- /dev/null
+<?php
+
+class ApiTestContext extends RequestContext {
+
+ /**
+ * Returns a DerivativeContext with the request variables in place
+ *
+ * @param $request WebRequest request object including parameters and session
+ * @param $user User or null
+ * @return DerivativeContext
+ */
+ public function newTestContext( WebRequest $request, User $user = null ) {
+ $context = new DerivativeContext( $this );
+ $context->setRequest( $request );
+ if ( $user !== null ) {
+ $context->setUser( $user );
+ }
+
+ return $context;
+ }
+}
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * @group API
+ * @group Database
+ * @group medium
+ *
+ * @covers ApiUnblock
+ */
+class ApiUnblockTest extends ApiTestCase {
+ protected function setUp() {
+ parent::setUp();
+ $this->doLogin();
+ }
+
+ /**
+ * @expectedException UsageException
+ */
+ public function testWithNoToken( ) {
+ $this->doApiRequest(
+ array(
+ 'action' => 'unblock',
+ 'user' => 'UTApiBlockee',
+ 'reason' => 'Some reason',
+ ),
+ null,
+ false,
+ self::$users['sysop']->user
+ );
+ }
+}
--- /dev/null
+<?php
+
+class MockApi extends ApiBase {
+ public function execute() {
+ }
+
+ public function getVersion() {
+ }
+
+ public function __construct() {
+ }
+
+ public function getAllowedParams() {
+ return array(
+ 'filename' => null,
+ 'enablechunks' => false,
+ 'sessionkey' => null,
+ );
+ }
+}
\ No newline at end of file
* @group API
*/
class PrefixUniquenessTest extends MediaWikiTestCase {
+
public function testPrefixes() {
$main = new ApiMain( new FauxRequest() );
$query = new ApiQuery( $main, 'foo', 'bar' );
$prefixes = array();
foreach ( $modules as $name => $class ) {
+ /** @var ApiMain $module */
$module = new $class( $main, $name );
$prefix = $module->getModulePrefix();
if ( isset( $prefixes[$prefix] ) ) {
--- /dev/null
+<?php
+
+class UserWrapper {
+ public $userName;
+ public $password;
+ public $user;
+
+ public function __construct( $userName, $password, $group = '' ) {
+ $this->userName = $userName;
+ $this->password = $password;
+
+ $this->user = User::newFromName( $this->userName );
+ if ( !$this->user->getID() ) {
+ $this->user = User::createNew( $this->userName, array(
+ "email" => "test@example.com",
+ "real_name" => "Test User" ) );
+ }
+ $this->user->setPassword( $this->password );
+
+ if ( $group !== '' ) {
+ $this->user->addGroup( $group );
+ }
+ $this->user->saveSettings();
+ }
+}
\ No newline at end of file
--- /dev/null
+<?php
+
+/**
+ * @group API
+ * @group Database
+ * @group medium
+ * @covers ApiFormatJson
+ */
+class ApiFormatJsonTest extends ApiFormatTestBase {
+
+ public function testValidSyntax( ) {
+ $data = $this->apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo' ) );
+
+ $this->assertInternalType( 'array', json_decode( $data, true ) );
+ $this->assertGreaterThan( 0, count( (array)$data ) );
+ }
+}
* @group API
* @group Database
* @group medium
+ * @covers ApiFormatPhp
*/
class ApiFormatPhpTest extends ApiFormatTestBase {
- public function testValidPhpSyntax() {
-
+ public function testValidyntax( ) {
$data = $this->apiRequest( 'php', array( 'action' => 'query', 'meta' => 'siteinfo' ) );
$this->assertInternalType( 'array', unserialize( $data ) );
<?php
abstract class ApiFormatTestBase extends ApiTestCase {
+
+ /**
+ * @param string $format
+ * @param array $params
+ * @param $data
+ *
+ * @return string
+ */
protected function apiRequest( $format, $params, $data = null ) {
$data = parent::doApiRequest( $params, $data, true );
+ /** @var ApiMain $module */
$module = $data[3];
$printer = $module->createPrinterByName( $format );
return $out;
}
+
}
--- /dev/null
+<?php
+
+/**
+ * @group API
+ * @group Database
+ * @group medium
+ * @covers ApiFormatWddx
+ */
+class ApiFormatWddxTest extends ApiFormatTestBase {
+
+ public function testValidSyntax( ) {
+ $data = $this->apiRequest( 'wddx', array( 'action' => 'query', 'meta' => 'siteinfo' ) );
+
+ $this->assertInternalType( 'array', wddx_deserialize( $data ) );
+ $this->assertGreaterThan( 0, count( (array)$data ) );
+ }
+}
require_once 'ApiQueryTestBase.php';
-/** These tests validate basic functionality of the api query module
+/**
+ * These tests validate basic functionality of the api query module
*
* @group API
* @group Database
* @group medium
+ * @covers ApiQuery
*/
class ApiQueryBasicTest extends ApiQueryTestBase {
/**
* @group API
* @group Database
* @group medium
+ * @covers ApiQuery
*/
class ApiQueryContinue2Test extends ApiQueryContinueTestBase {
/**
* @group API
* @group Database
* @group medium
+ * @covers ApiQuery
*/
class ApiQueryContinueTest extends ApiQueryContinueTestBase {
/**
<?php
/**
- *
- *
* Created on Jan 1, 2013
*
* Copyright © 2013 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
* @group API
* @group Database
* @group medium
+ * @covers ApiQueryRevisions
*/
class ApiQueryRevisionsTest extends ApiTestCase {
* @group API
* @group Database
* @group medium
+ * @covers ApiQuery
*/
class ApiQueryTest extends ApiTestCase {
<?php
/**
- *
- *
* Created on Feb 10, 2013
*
* Copyright © 2013 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
<?php
-/**
- * @todo covers tags
- */
class FormatMetadataTest extends MediaWikiTestCase {
/** @var FSFileBackend */
$this->setMwGlobals( 'wgShowEXIF', true );
}
+ /**
+ * @covers File::formatMetadata
+ */
public function testInvalidDate() {
$file = $this->dataFile( 'broken_exif_date.jpg', 'image/jpeg' );
* serve as a very good "test". (Adobe photoshop probably creates such files
* but it costs money). The implementation of it currently in MediaWiki is based
* solely on reading the standard, without any real world test files.
- * @todo covers tags
+ *
+ * @covers JpegMetadataExtractor
*/
class JpegMetadataExtractorTest extends MediaWikiTestCase {
<?php
/**
- * @todo covers tags
+ * @covers JpegHandler
*/
class JpegTest extends MediaWikiTestCase {
+ protected $filePath;
+
protected function setUp() {
parent::setUp();
if ( !extension_loaded( 'exif' ) ) {
<?php
/**
- * @todo covers tags
+ * @covers PNGMetadataExtractor
*/
class PNGMetadataExtractorTest extends MediaWikiTestCase {
<?php
/**
- * @todo covers tags
+ * @covers SVGMetadataExtractor
*/
class SVGMetadataExtractorTest extends MediaWikiTestCase {
*
* @throws Exception
* @dataProvider provideXMPParse
+ *
+ * @covers XMPReader::parse
*/
public function testXMPParse( $xmp, $expected, $info ) {
if ( !is_string( $xmp ) || !is_array( $expected ) ) {
*
* @todo This is based on what the standard says. Need to find a real
* world example file to double check the support for this is right.
+ *
+ * @covers XMPReader::parseExtended
*/
public function testExtendedXMP() {
$xmpPath = __DIR__ . '/../../data/xmp/';
/**
* This test has an extended XMP block with a wrong guid (md5sum)
* and thus should only return the StandardXMP, not the ExtendedXMP.
+ *
+ * @covers XMPReader::parseExtended
*/
public function testExtendedXMPWithWrongGUID() {
$xmpPath = __DIR__ . '/../../data/xmp/';
/**
* Have a high offset to simulate a missing packet,
* which should cause it to ignore the ExtendedXMP packet.
+ *
+ * @covers XMPReader::parseExtended
*/
public function testExtendedXMPMissingPacket() {
$xmpPath = __DIR__ . '/../../data/xmp/';
$out = $parser->getPreloadText( $input, $title, $options );
} else {
$output = $parser->parse( $input, $title, $options, true, true, 1337 );
+ $output->setTOCEnabled( !isset( $opts['notoc'] ) );
$out = $output->getText();
if ( isset( $opts['showtitle'] ) ) {
}
}
+/**
+ * @covers Maintenance
+ */
class MaintenanceTest extends MediaWikiTestCase {
* Tests for BaseDump
*
* @group Dump
+ * @covers BaseDump
*/
class BaseDumpTest extends MediaWikiTestCase {
*
* @group Database
* @group Dump
+ * @covers TextPassDumper
*/
class TextPassDumperTest extends DumpTestCase {
*
* @group Database
* @group Dump
+ * @covers BackupDumper
*/
class BackupDumperLoggerTest extends DumpTestCase {
*
* @group Database
* @group Dump
+ * @covers BackupDumper
*/
class BackupDumperPageTest extends DumpTestCase {
*
* @group Database
* @group Dump
+ * @covers FetchText
*/
class FetchTextTest extends MediaWikiTestCase {
* Tests for getSlaveServer
*
* @group Database
+ * @covers GetSlaveServer
*/
class GetSlaveServerTest extends MediaWikiTestCase {