MediaWiki  1.23.12
InstallDocFormatterTest.php
Go to the documentation of this file.
1 <?php
2 /*
3  * To change this template, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 
12  public function testFormat( $expected, $unformattedText, $message = '' ) {
13  $this->assertEquals(
14  $expected,
15  InstallDocFormatter::format( $unformattedText ),
16  $message
17  );
18  }
19 
23  public static function provideDocFormattingTests() {
24  # Format: (expected string, unformattedText string, optional message)
25  return array(
26  # Escape some wikitext
27  array( 'Install &lt;tag>', 'Install <tag>', 'Escaping <' ),
28  array( 'Install &#123;&#123;template}}', 'Install {{template}}', 'Escaping [[' ),
29  array( 'Install &#91;&#91;page]]', 'Install [[page]]', 'Escaping {{' ),
30  array( 'Install &#95;&#95;TOC&#95;&#95;', 'Install __TOC__', 'Escaping __' ),
31  array( 'Install ', "Install \r", 'Removing \r' ),
32 
33  # Transform \t{1,2} into :{1,2}
34  array( ':One indentation', "\tOne indentation", 'Replacing a single \t' ),
35  array( '::Two indentations', "\t\tTwo indentations", 'Replacing 2 x \t' ),
36 
37  # Transform 'bug 123' links
38  array(
39  '<span class="config-plainlink">[https://bugzilla.wikimedia.org/123 bug 123]</span>',
40  'bug 123', 'Testing bug 123 links' ),
41  array(
42  '(<span class="config-plainlink">[https://bugzilla.wikimedia.org/987654 bug 987654]</span>)',
43  '(bug 987654)', 'Testing (bug 987654) links' ),
44 
45  # "bug abc" shouldn't work
46  array( 'bug foobar', 'bug foobar', "Don't match bug followed by non-digits" ),
47  array( 'bug !!fakefake!!', 'bug !!fakefake!!', "Don't match bug followed by non-digits" ),
48 
49  # Transform '$wgFooBar' links
50  array(
51  '<span class="config-plainlink">[https://www.mediawiki.org/wiki/Manual:$wgFooBar $wgFooBar]</span>',
52  '$wgFooBar', 'Testing basic $wgFooBar' ),
53  array(
54  '<span class="config-plainlink">[https://www.mediawiki.org/wiki/Manual:$wgFooBar45 $wgFooBar45]</span>',
55  '$wgFooBar45', 'Testing $wgFooBar45 (with numbers)' ),
56  array(
57  '<span class="config-plainlink">[https://www.mediawiki.org/wiki/Manual:$wgFoo_Bar $wgFoo_Bar]</span>',
58  '$wgFoo_Bar', 'Testing $wgFoo_Bar (with underscore)' ),
59 
60  # Icky variables that shouldn't link
61  array( '$myAwesomeVariable', '$myAwesomeVariable', 'Testing $myAwesomeVariable (not starting with $wg)' ),
62  array( '$()not!a&Var', '$()not!a&Var', 'Testing $()not!a&Var (obviously not a variable)' ),
63  );
64  }
65 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
InstallDocFormatterTest
Definition: InstallDocFormatterTest.php:7
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
InstallDocFormatterTest\provideDocFormattingTests
static provideDocFormattingTests()
Provider for testFormat()
Definition: InstallDocFormatterTest.php:23
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
InstallDocFormatterTest\testFormat
testFormat( $expected, $unformattedText, $message='')
@covers InstallDocFormatter::format @dataProvider provideDocFormattingTests
Definition: InstallDocFormatterTest.php:12
InstallDocFormatter\format
static format( $text)
Definition: InstallDocFormatter.php:24
some
I won t presume to tell you how to I m just describing the methods I chose to use for myself If you do choose to follow these it will probably be easier for you to collaborate with others on the but if you want to contribute without by all means do which work well I also use K &R brace matching style I know that s a religious issue for some
Definition: design.txt:79