40 $contLang = Language::factory(
'en' );
43 $this->testParser =
new Parser();
44 $this->testParser->Options( ParserOptions::newFromUserAndLang(
new User, $contLang ) );
46 # initialize parser output
47 $this->testParser->clearState();
49 # Needs a title to do magic word stuff
50 $title = Title::newFromText(
'Tests' );
51 # Else it needs a db connection just to check if it's a redirect
52 # (when deciding the page language).
53 $title->mRedirect =
false;
55 $this->testParser->setTitle( $title );
64 for ( $i = 1; $i <=
$num; $i++ ) {
85 # ############## TESTS #############################################
87 # - those got copy pasted, we can probably make them cleaner
88 # - tests are lacking useful messages
158 # ############## HELPERS ############################################
177 # Initialize parser timestamp as year 2010 at 12h34 56s.
178 # month and day are given by the caller ($value). Month < 12!
189 # please keep the following commented line of code. It helps debugging.
192 # format expectation and test it
202 $this->testParser->Options()->setTimestamp( $ts );
203 $this->testParser->mRevisionTimestamp = $ts;
212 if (
in_array( $magic, $this->expectedAsInteger ) ) {
213 $expected = (
int)$expected;
216 # Generate a message for the assertion
217 $msg =
sprintf(
"Magic %s should be <%s:%s>",
225 $this->testParser->getVariableValue( $magic ),
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Database Parser::getVariableValue.
assertZeroPadded( $magic, $value)
assertion helper expecting a magic output which is zero padded
setParserTS( $ts)
helper to set the parser timestamp and revision timestamp
static createProviderUpTo( $num)
testRevisiondayIsUnPadded( $day)
provideDays
setUp()
setup a basic parser object
testLocaldaytwoIsZeroPadded( $day)
provideDays
testCurrentdayIsUnPadded( $day)
provideDays
$expectedAsInteger
An array of magicword returned as type integer by the parser They are usually returned as a string fo...
testLocalmonthoneIsUnPadded( $month)
provideMonths
testLocaldayIsUnPadded( $day)
provideDays
testRevisiondaytwoIsZeroPadded( $day)
provideDays
testCurrentdaytwoIsZeroPadded( $day)
provideDays
testRevisionmonthIsZeroPadded( $month)
provideMonths
assertMagic( $expected, $magic)
Assertion helper to test a magic variable output.
testCurrentmonthIsZeroPadded( $month)
provideMonths
assertMagicPadding( $magic, $value, $format)
Main assertion helper for magic variables padding.
testRevisionmonthoneIsUnPadded( $month)
provideMonths
testLocalmonthIsZeroPadded( $month)
provideMonths
assertUnPadded( $magic, $value)
assertion helper expecting a magic output which is unpadded
testCurrentmonthoneIsUnPadded( $month)
provideMonths
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret