--- /dev/null
+#!/usr/bin/env php
+<?php
+require 'Test.php';
+
+plan(1);
+
+ok(0 == 0);
+?>
--- /dev/null
+=head1 NAME
+
+F<t> - MediaWiki test tree
+
+=head1 DESCRIPTION
+
+This is the MediaWiki test tree (well, one of them), tests here
+produce TAP output, see L<TAP>.
+
+=cut
--- /dev/null
+#!/usr/bin/env php
+<?php
+
+require 'Test.php';
+
+plan( 'no_plan' );
+
+require_ok( 'includes/IP.php' );
+
+# some of this test data was taken from Data::Validate::IP
+
+#
+# isValid()
+#
+
+foreach ( range( 0, 255 ) as $i ) {
+ $a = sprintf( "%03d", $i );
+ $b = sprintf( "%02d", $i );
+ $c = sprintf( "%01d", $i );
+ foreach ( array_unique( array( $a, $b, $c ) ) as $f ) {
+ $ip = "$f.$f.$f.$f";
+ ok( IP::isValid( $ip ), "$ip is a valid IPv4 address" );
+ }
+}
+
+$valid = array( '216.17.184.1', '0.0.0.0', '000.000.000.000' );
+
+foreach ( $valid as $v ) {
+ ok( IP::isValid( $v ), "$v is a valid IPv4 address" );
+}
+
+$invalid = array(
+ 'www.xn--var-xla.net',
+ '216.17.184.G',
+ '216.17.184.1.',
+ '216.17.184',
+ '216.17.184.',
+ '256.17.184.1'
+);
+
+foreach ( $invalid as $i ) {
+ ok( ! IP::isValid( $i ), "$i is an invalid IPv4 address" );
+}
+
+#
+# isPublic()
+#
+
+$private = array( '10.0.0.1', '172.16.0.1', '192.168.0.1' );
+
+foreach ( $private as $p ) {
+ ok( ! IP::isPublic( $p ), "$p is not a public IP address" );
+}
+
+#is ('127.0.0.1', is_loopback_ipv4('127.0.0.1'), 'is_loopback_ipv4 127.0.0.1');
+#is ('192.0.2.9', is_testnet_ipv4('192.0.2.9'), 'is_testnet_ipv4 192.0.2.9');
+#is ('216.17.184.1', is_public_ipv4('216.17.184.1'), 'is_public_ipv4 216.17.184.1');
+#isnt ('192.168.0.1', is_public_ipv4('192.168.0.1'), 'is_public_ipv4 192.168.0.1');
+#
+?>
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env php
+<?php
+require 'Test.php';
+
+plan(3);
+
+error_reporting( E_ALL );
+
+define( 'MEDIAWIKI', 1 ); // Hack
+
+require_ok( 'languages/Language.php' );
+require_ok( 'includes/GlobalFunctions.php' );
+require_ok( 'includes/Licenses.php' );
+
+$str = "
+* Free licenses:
+** GFLD|Debian disagrees
+";
+
+#$lc = new Licenses ( $str );
+
+#isa_ok( $lc, 'Licenses' );
+
+#echo $lc->html;
+
+
+
+
+?>
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env php
+<?php
+
+require 'Test.php';
+
+plan( 11 );
+
+require_ok( 'includes/Defines.php' );
+require_ok( 'includes/GlobalFunctions.php' );
+require_ok( 'includes/Sanitizer.php' );
+require_ok( 'includes/normal/UtfNormal.php' );
+
+
+#
+# decodeCharReferences
+#
+
+cmp_ok(
+ Sanitizer::decodeCharReferences( 'école' ),
+ '==',
+ "\xc3\xa9cole",
+ 'decode named entities'
+);
+
+cmp_ok(
+ Sanitizer::decodeCharReferences( "Ĉio bonas dans l'école!" ),
+ '==',
+ "\xc4\x88io bonas dans l'\xc3\xa9cole!",
+ 'decode numeric entities'
+);
+
+cmp_ok(
+ Sanitizer::decodeCharReferences( "Ĉio bonas dans l'école!" ),
+ '==',
+ "\xc4\x88io bonas dans l'\xc3\xa9cole!",
+ 'decode mixed numeric/named entities'
+);
+
+cmp_ok(
+ Sanitizer::decodeCharReferences(
+ "Ĉio bonas dans l'école! (mais pas &#x108;io dans l'&eacute;cole)"
+ ),
+ '==',
+ "\xc4\x88io bonas dans l'\xc3\xa9cole! (mais pas Ĉio dans l'école)",
+ 'decode mixed complex entities'
+);
+
+cmp_ok( Sanitizer::decodeCharReferences( 'a & b' ), '==', 'a & b', 'Invalid ampersand' );
+
+cmp_ok( Sanitizer::decodeCharReferences( '&foo;' ), '==', '&foo;', 'Invalid named entity' );
+
+cmp_ok( Sanitizer::decodeCharReferences( "�" ), '==', UTF8_REPLACEMENT, 'Invalid numbered entity' );
+
+
+
--- /dev/null
+#!/usr/bin/env php
+<?php
+
+require 'Test.php';
+
+plan( 8 );
+
+require_ok( 'includes/Sanitizer.php' );
+require_ok( 'includes/Xml.php' );
+
+#
+# element
+#
+
+cmp_ok(
+ Xml::element( 'element', null, null ),
+ '==',
+ '<element>',
+ 'Opening element with no attributes'
+);
+
+cmp_ok(
+ Xml::element( 'element', null, '' ),
+ '==',
+ '<element />',
+ 'Terminated empty element'
+);
+
+cmp_ok(
+ Xml::element( 'element', null, 'hello <there> you & you' ),
+ '==',
+ '<element>hello <there> you & you</element>',
+ 'Element with no attributes and content that needs escaping'
+);
+
+cmp_ok(
+ Xml::element( 'element', array( 'key' => 'value', '<>' => '<>' ), null ),
+ '==',
+ '<element key="value" <>="<>">',
+ 'Element attributes, keys are not escaped'
+);
+
+#
+# open/close element
+#
+
+cmp_ok(
+ Xml::openElement( 'element', array( 'k' => 'v' ) ),
+ '==',
+ '<element k="v">',
+ 'openElement() shortcut'
+);
+
+cmp_ok( Xml::closeElement( 'element' ), '==', '</element>', 'closeElement() shortcut' );
+
+?>
\ No newline at end of file