3 class TitleTest
extends MediaWikiTestCase
{
5 function testLegalChars() {
6 $titlechars = Title
::legalChars();
8 foreach ( range( 1, 255 ) as $num ) {
10 if ( strpos( "#[]{}<>|", $chr ) !== false ||
preg_match( "/[\\x00-\\x1f\\x7f]/", $chr ) ) {
11 $this->assertFalse( (bool)preg_match( "/[$titlechars]/", $chr ), "chr($num) = $chr is not a valid titlechar" );
13 $this->assertTrue( (bool)preg_match( "/[$titlechars]/", $chr ), "chr($num) = $chr is a valid titlechar" );
19 * @dataProvider dataBug31100
21 function testBug31100FixSpecialName( $text, $expectedParam ) {
22 $title = Title
::newFromText( $text );
23 $fixed = $title->fixSpecialName();
24 $stuff = explode( '/', $fixed->getDbKey(), 2 );
25 if ( count( $stuff ) == 2 ) {
30 $this->assertEquals( $expectedParam, $par, "Bug 31100 regression check: Title->fixSpecialName() should preserve parameter" );
33 function dataBug31100() {
35 array( 'Special:Version', null ),
36 array( 'Special:Version/', '' ),
37 array( 'Special:Version/param', 'param' ),