* Unescape two entities when transforming. Motivation is to allow to use "Foo&nbsp...
[lhc/web/wiklou.git] / t / inc / Title.t
1 #!/usr/bin/env php
2 <?php
3
4 require 't/Test.php';
5
6 plan( 2 + 255 );
7
8 require_ok( 'includes/Defines.php' );
9
10 # require_ok() doesn't work for these, find out why
11 define( 'MEDIAWIKI', 1 );
12 require 'LocalSettings.php';
13 require 'includes/DefaultSettings.php';
14
15 require_ok( 'includes/Title.php' );
16
17 #
18 # legalChars()
19 #
20
21 $titlechars = Title::legalChars();
22
23 foreach ( range( 1, 255 ) as $num ) {
24 $chr = chr( $num );
25 if ( strpos( "#[]{}<>|", $chr ) !== false || preg_match( "/[\\x00-\\x1f\\x7f]/", $chr ) ) {
26 unlike( $chr, "/[$titlechars]/", "chr($num) = $chr is not a valid titlechar" );
27 } else {
28 like( $chr, "/[$titlechars]/", "chr($num) = $chr is a valid titlechar" );
29 }
30 }
31
32 /* vim: set filetype=php: */