MediaWiki REL1_31
CoreParserFunctionsTest.php
Go to the documentation of this file.
1<?php
7
8 public function testGender() {
9 $user = User::createNew( '*Female' );
10 $user->setOption( 'gender', 'female' );
11 $user->saveSettings();
12
13 $msg = ( new RawMessage( '{{GENDER:*Female|m|f|o}}' ) )->parse();
14 $this->assertEquals( $msg, 'f', 'Works unescaped' );
15 $escapedName = wfEscapeWikiText( '*Female' );
16 $msg2 = ( new RawMessage( '{{GENDER:' . $escapedName . '|m|f|o}}' ) )
17 ->parse();
18 $this->assertEquals( $msg, 'f', 'Works escaped' );
19 }
20
21}
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Database CoreParserFunctions.
Variant of the Message class.
static createNew( $name, $params=[])
Add a user to the database, return the user object.
Definition User.php:4297