Starting to phase out /t in favor of /tests, so removing things already covered by...
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 3 Feb 2010 14:58:44 +0000 (14:58 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 3 Feb 2010 14:58:44 +0000 (14:58 +0000)
t/00-test.t [deleted file]
t/inc/Database.t [deleted file]
t/inc/Global.t [deleted file]
t/inc/IP.t [deleted file]
t/inc/ImageFunctions.t [deleted file]
t/inc/LocalFile.t [deleted file]
t/inc/Parser.t [deleted file]

diff --git a/t/00-test.t b/t/00-test.t
deleted file mode 100644 (file)
index b9ed203..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env php
-<?php
-require 'Test.php';
-
-plan(1);
-
-ok(0 == 0);
-
-/* vim: set filetype=php: */
-?>
diff --git a/t/inc/Database.t b/t/inc/Database.t
deleted file mode 100644 (file)
index 9356248..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-define( 'MEDIAWIKI', true );
-require 't/Test.php';
-
-require 'includes/Defines.php';
-require 'LocalSettings.php';
-require 'includes/ProfilerStub.php';
-require 'includes/AutoLoader.php';
-require 'includes/Setup.php';
-
-plan( 9 );
-
-$db = new DatabaseMysql( $wgDBserver, $wgDBuser, $wgDBpassword );
-
-cmp_ok( $db->addQuotes( null ), '==',
-       'NULL', 'Add quotes to NULL' );
-
-cmp_ok( $db->addQuotes( 1234 ), '==',
-       "'1234'", 'Add quotes to int' );
-
-cmp_ok( $db->addQuotes( 1234.5678 ), '==',
-       "'1234.5678'", 'Add quotes to float' );
-
-cmp_ok( $db->addQuotes( 'string' ), '==',
-       "'string'", 'Add quotes to string' );
-       
-cmp_ok( $db->addQuotes( "string's cause trouble" ), '==',
-       "'string\'s cause trouble'", 'Add quotes to quoted string' );
-
-$sql = $db->fillPrepared(
-       'SELECT * FROM interwiki', array() );
-cmp_ok( $sql, '==',
-       'SELECT * FROM interwiki', 'FillPrepared empty' );
-
-$sql = $db->fillPrepared(
-       'SELECT * FROM cur WHERE cur_namespace=? AND cur_title=?',
-       array( 4, "Snicker's_paradox" ) );
-cmp_ok( $sql, '==',
-       "SELECT * FROM cur WHERE cur_namespace='4' AND cur_title='Snicker\'s_paradox'", 'FillPrepared question' );
-
-$sql = $db->fillPrepared(
-       'SELECT user_id FROM ! WHERE user_name=?',
-       array( '"user"', "Slash's Dot" ) );
-cmp_ok( $sql, '==',
-       "SELECT user_id FROM \"user\" WHERE user_name='Slash\'s Dot'", 'FillPrepared quoted' );
-
-$sql = $db->fillPrepared(
-       "SELECT * FROM cur WHERE cur_title='This_\\&_that,_WTF\\?\\!'",
-       array( '"user"', "Slash's Dot" ) );
-cmp_ok( $sql, '==',
-       "SELECT * FROM cur WHERE cur_title='This_&_that,_WTF?!'", 'FillPrepared raw' );
diff --git a/t/inc/Global.t b/t/inc/Global.t
deleted file mode 100644 (file)
index c76ff6a..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-define( 'MEDIAWIKI', true );
-require 't/Test.php';
-
-require 'LocalSettings.php';
-require 'includes/Defines.php';
-require 'includes/ProfilerStub.php';
-require 'includes/AutoLoader.php';
-require 'includes/Setup.php';
-
-plan( 46 );
-
-$wgReadOnly = null;
-$wgReadOnlyFile = tempnam(wfTempDir(), "mwtest_readonly");
-unlink( $wgReadOnlyFile );
-
-isnt( wfRandom(), wfRandom(), "Two differents random" );
-
-is( wfUrlencode( "\xE7\x89\xB9\xE5\x88\xA5:Contributions/Foobar" ),
-       "%E7%89%B9%E5%88%A5:Contributions/Foobar", 'Urlencode' );
-
-is( wfReadOnly(), false, 'Empty read only' );
-
-is( wfReadOnly(), false, 'Empty read only, second time' );
-
-$f = fopen( $wgReadOnlyFile, "wt" );
-fwrite( $f, 'Message' );
-fclose( $f );
-$wgReadOnly = null;
-
-is( wfReadOnly(), true, 'Read only file set' );
-
-is( wfReadOnly(), true, 'Read only file set, second time' );
-
-unlink( $wgReadOnlyFile );
-$wgReadOnly = null;
-
-is( wfReadOnly(), false, 'Read only reset' );
-
-is( wfReadOnly(), false, 'Read only reset, second time' );
-
-
-is( wfQuotedPrintable( "\xc4\x88u legebla?", "UTF-8" ), 
-       "=?UTF-8?Q?=C4=88u=20legebla=3F?=", 'Quoted printable' );
-
-$start = wfTime();
-is( gettype( $start ), 'double', 'Time (type)' );
-$end = wfTime();
-cmp_ok( $end, '>', $start, 'Time (compare)' );
-
-$arr = wfArrayToCGI(
-       array( 'baz' => 'AT&T', 'ignore' => '' ),
-       array( 'foo' => 'bar', 'baz' => 'overridden value' ) );
-is( $arr, "baz=AT%26T&foo=bar", 'Array to CGI' );
-
-$mime = mimeTypeMatch( 'text/html', array(
-       'application/xhtml+xml' => 1.0,
-       'text/html'  => 0.7,
-       'text/plain' => 0.3
-) );
-is( $mime, 'text/html', 'Mime (1)' );
-
-$mime = mimeTypeMatch( 'text/html', array(
-       'image/*' => 1.0,
-       'text/*'  => 0.5
-) );
-is( $mime, 'text/*', 'Mime (2)' );
-
-$mime = mimeTypeMatch( 'text/html', array( '*/*' => 1.0 ) );
-is( $mime, '*/*', 'Mime (3)' );
-
-$mime = mimeTypeMatch( 'text/html', array(
-       'image/png'     => 1.0,
-       'image/svg+xml' => 0.5
-) );
-is( $mime, null, 'Mime (4)' );
-
-$mime = wfNegotiateType(
-       array( 'application/xhtml+xml' => 1.0,
-              'text/html'             => 0.7,
-              'text/plain'            => 0.5,
-              'text/*'                => 0.2 ),
-       array( 'text/html'             => 1.0 ) );
-is( $mime, 'text/html', 'Negotiate Mime (1)' );
-
-$mime = wfNegotiateType(
-       array( 'application/xhtml+xml' => 1.0,
-              'text/html'             => 0.7,
-              'text/plain'            => 0.5,
-              'text/*'                => 0.2 ),
-       array( 'application/xhtml+xml' => 1.0,
-              'text/html'             => 0.5 ) );
-is( $mime, 'application/xhtml+xml', 'Negotiate Mime (2)' );
-
-$mime = wfNegotiateType(
-       array( 'text/html'             => 1.0,
-              'text/plain'            => 0.5,
-              'text/*'                => 0.5,
-              'application/xhtml+xml' => 0.2 ),
-       array( 'application/xhtml+xml' => 1.0,
-              'text/html'             => 0.5 ) );
-is( $mime, 'text/html', 'Negotiate Mime (3)' );
-
-$mime = wfNegotiateType(
-       array( 'text/*'                => 1.0,
-              'image/*'               => 0.7,
-              '*/*'                   => 0.3 ),
-       array( 'application/xhtml+xml' => 1.0,
-              'text/html'             => 0.5 ) );
-is( $mime, 'text/html', 'Negotiate Mime (4)' );
-
-$mime = wfNegotiateType(
-       array( 'text/*'                => 1.0 ),
-       array( 'application/xhtml+xml' => 1.0 ) );
-is( $mime, null, 'Negotiate Mime (5)' );
-
-$t = gmmktime( 12, 34, 56, 1, 15, 2001 );
-is( wfTimestamp( TS_MW, $t ), '20010115123456', 'TS_UNIX to TS_MW' );
-is( wfTimestamp( TS_UNIX, $t ), 979562096, 'TS_UNIX to TS_UNIX' );
-is( wfTimestamp( TS_DB, $t ), '2001-01-15 12:34:56', 'TS_UNIX to TS_DB' );
-$t = '20010115123456';
-is( wfTimestamp( TS_MW, $t ), '20010115123456', 'TS_MW to TS_MW' );
-is( wfTimestamp( TS_UNIX, $t ), 979562096, 'TS_MW to TS_UNIX' );
-is( wfTimestamp( TS_DB, $t ), '2001-01-15 12:34:56', 'TS_MW to TS_DB' );
-$t = '2001-01-15 12:34:56';
-is( wfTimestamp( TS_MW, $t ), '20010115123456', 'TS_DB to TS_MW' );
-is( wfTimestamp( TS_UNIX, $t ), 979562096, 'TS_DB to TS_UNIX' );
-is( wfTimestamp( TS_DB, $t ), '2001-01-15 12:34:56', 'TS_DB to TS_DB' );
-
-$sets = array(
-       '' => '',
-       '/' => '',
-       '\\' => '',
-       '//' => '',
-       '\\\\' => '',
-       'a' => 'a',
-       'aaaa' => 'aaaa',
-       '/a' => 'a',
-       '\\a' => 'a',
-       '/aaaa' => 'aaaa',
-       '\\aaaa' => 'aaaa',
-       '/aaaa/' => 'aaaa',
-       '\\aaaa\\' => 'aaaa',
-       '\\aaaa\\' => 'aaaa',
-       '/mnt/upload3/wikipedia/en/thumb/8/8b/Zork_Grand_Inquisitor_box_cover.jpg/93px-Zork_Grand_Inquisitor_box_cover.jpg' => '93px-Zork_Grand_Inquisitor_box_cover.jpg',
-       'C:\\Progra~1\\Wikime~1\\Wikipe~1\\VIEWER.EXE' => 'VIEWER.EXE',
-       'Östergötland_coat_of_arms.png' => 'Östergötland_coat_of_arms.png',
-);
-foreach( $sets as $from => $to ) {
-       is( $to, wfBaseName( $from ),
-               "wfBaseName('$from') => '$to'");
-}
\ No newline at end of file
diff --git a/t/inc/IP.t b/t/inc/IP.t
deleted file mode 100644 (file)
index eb71725..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-require 't/Test.php';
-
-plan( 1120 );
-
-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" );
-       }
-}
-
-# A bit excessive perhaps? meh..
-foreach ( range( 256, 999 ) 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 not 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" ); 
-}
-
-/* vim: set filetype=php: */
diff --git a/t/inc/ImageFunctions.t b/t/inc/ImageFunctions.t
deleted file mode 100644 (file)
index 3a69bf7..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-define( 'MEDIAWIKI', true );
-require 't/Test.php';
-
-require 'includes/Defines.php';
-
-$vals = array(
-       array(
-               'width' => 50,
-               'height' => 50,
-               'tests' => array(
-                       50 => 50,
-                       17 => 17,
-                       18 => 18 ) ),
-       array(
-               'width' => 366,
-               'height' => 300,
-               'tests' => array(
-                       50 => 61,
-                       17 => 21,
-                       18 => 22 ) ),
-       array(
-               'width' => 300,
-               'height' => 366,
-               'tests' => array(
-                       50 => 41,
-                       17 => 14,
-                       18 => 15 ) ),
-       array(
-               'width' => 100,
-               'height' => 400,
-               'tests' => array(
-                       50 => 12,
-                       17 => 4,
-                       18 => 4 ) )
-);
-
-plan( 3 + 3 * count( $vals ) );
-
-require_ok( 'includes/ProfilerStub.php' );
-require_ok( 'includes/GlobalFunctions.php' );
-require_ok( 'includes/ImageFunctions.php' );
-
-foreach( $vals as $row ) {
-       extract( $row );
-       foreach( $tests as $max => $expected ) {
-               $y = round( $expected * $height / $width );
-               $result = wfFitBoxWidth( $width, $height, $max );
-               $y2 = round( $result * $height / $width );
-               is( $result, $expected,
-                       "($width, $height, $max) wanted: {$expected}x{$y}, got: {$result}x{$y2}" );
-       }
-}
-
diff --git a/t/inc/LocalFile.t b/t/inc/LocalFile.t
deleted file mode 100644 (file)
index 2bd88cb..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-define( 'MEDIAWIKI', true );
-require 't/Test.php';
-
-require 'includes/Defines.php';
-require 'includes/ProfilerStub.php';
-require 'LocalSettings.php';
-require 'includes/Setup.php';
-
-/**
- * These tests should work regardless of $wgCapitalLinks
- */
-
-$info = array(
-       'name' => 'test',
-       'directory' => '/testdir',
-       'url' => '/testurl',
-       'hashLevels' => 2,
-       'transformVia404' => false,
-);
-
-plan( 35 );
-
-$repo_hl0 = new LocalRepo( array( 'hashLevels' => 0 ) + $info );
-$repo_hl2 = new LocalRepo( array( 'hashLevels' => 2 ) + $info );
-$repo_lc = new LocalRepo( array( 'initialCapital' => false ) + $info );
-
-$file_hl0 = $repo_hl0->newFile( 'test!' );
-$file_hl2 = $repo_hl2->newFile( 'test!' );
-$file_lc = $repo_lc->newFile( 'test!' );
-
-is( $file_hl0->getHashPath(), '', 'Get hash path, hasLev 0' );
-is( $file_hl2->getHashPath(), 'a/a2/', 'Get hash path, hasLev 2' );
-is( $file_lc->getHashPath(), 'c/c4/', 'Get hash path, lc first' );
-
-is( $file_hl0->getRel(), 'Test!', 'Get rel path, hasLev 0' );
-is( $file_hl2->getRel(), 'a/a2/Test!', 'Get rel path, hasLev 2' );
-is( $file_lc->getRel(), 'c/c4/test!', 'Get rel path, lc first' );
-
-is( $file_hl0->getUrlRel(), 'Test%21', 'Get rel url, hasLev 0' );
-is( $file_hl2->getUrlRel(), 'a/a2/Test%21', 'Get rel url, hasLev 2' );
-is( $file_lc->getUrlRel(), 'c/c4/test%21', 'Get rel url, lc first' );
-
-is( $file_hl0->getArchivePath(), '/testdir/archive', 'Get archive path, hasLev 0' );
-is( $file_hl2->getArchivePath(), '/testdir/archive/a/a2', 'Get archive path, hasLev 2' );
-is( $file_hl0->getArchivePath( '!' ), '/testdir/archive/!', 'Get archive path, hasLev 0' );
-is( $file_hl2->getArchivePath( '!' ), '/testdir/archive/a/a2/!', 'Get archive path, hasLev 2' );
-
-is( $file_hl0->getThumbPath(), '/testdir/thumb/Test!', 'Get thumb path, hasLev 0' );
-is( $file_hl2->getThumbPath(), '/testdir/thumb/a/a2/Test!', 'Get thumb path, hasLev 2' );
-is( $file_hl0->getThumbPath( 'x' ), '/testdir/thumb/Test!/x', 'Get thumb path, hasLev 0' );
-is( $file_hl2->getThumbPath( 'x' ), '/testdir/thumb/a/a2/Test!/x', 'Get thumb path, hasLev 2' );
-
-is( $file_hl0->getArchiveUrl(), '/testurl/archive', 'Get archive url, hasLev 0' );
-is( $file_hl2->getArchiveUrl(), '/testurl/archive/a/a2', 'Get archive url, hasLev 2' );
-is( $file_hl0->getArchiveUrl( '!' ), '/testurl/archive/%21', 'Get archive url, hasLev 0' );
-is( $file_hl2->getArchiveUrl( '!' ), '/testurl/archive/a/a2/%21', 'Get archive url, hasLev 2' );
-
-is( $file_hl0->getThumbUrl(), '/testurl/thumb/Test%21', 'Get thumb url, hasLev 0' );
-is( $file_hl2->getThumbUrl(), '/testurl/thumb/a/a2/Test%21', 'Get thumb url, hasLev 2' );
-is( $file_hl0->getThumbUrl( 'x' ), '/testurl/thumb/Test%21/x', 'Get thumb url, hasLev 0' );
-is( $file_hl2->getThumbUrl( 'x' ), '/testurl/thumb/a/a2/Test%21/x', 'Get thumb url, hasLev 2' );
-
-is( $file_hl0->getArchiveVirtualUrl(), 'mwrepo://test/public/archive', 'Get archive virtual url, hasLev 0' );
-is( $file_hl2->getArchiveVirtualUrl(), 'mwrepo://test/public/archive/a/a2', 'Get archive virtual url, hasLev 2' );
-is( $file_hl0->getArchiveVirtualUrl( '!' ), 'mwrepo://test/public/archive/%21', 'Get archive virtual url, hasLev 0' );
-is( $file_hl2->getArchiveVirtualUrl( '!' ), 'mwrepo://test/public/archive/a/a2/%21', 'Get archive virtual url, hasLev 2' );
-
-is( $file_hl0->getThumbVirtualUrl(), 'mwrepo://test/thumb/Test%21', 'Get thumb virtual url, hasLev 0' );
-is( $file_hl2->getThumbVirtualUrl(), 'mwrepo://test/thumb/a/a2/Test%21', 'Get thumb virtual url, hasLev 2' );
-is( $file_hl0->getThumbVirtualUrl( '!' ), 'mwrepo://test/thumb/Test%21/%21', 'Get thumb virtual url, hasLev 0' );
-is( $file_hl2->getThumbVirtualUrl( '!' ), 'mwrepo://test/thumb/a/a2/Test%21/%21', 'Get thumb virtual url, hasLev 2' );
-
-is( $file_hl0->getUrl(), '/testurl/Test%21', 'Get url, hasLev 0' );
-is( $file_hl2->getUrl(), '/testurl/a/a2/Test%21', 'Get url, hasLev 2' );
diff --git a/t/inc/Parser.t b/t/inc/Parser.t
deleted file mode 100644 (file)
index 9df21d9..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-require 't/Test.php';
-require 'maintenance/parserTests.inc';
-
-error_reporting( E_ALL ^ E_NOTICE );
-
-class ProveTestRecorder extends TestRecorder {
-
-       function record( $name, $res ){}
-       function report(){}
-       function reportPercentage( $success, $total ){}
-}
-
-class ProveParserTest extends ParserTest {
-       
-       function showSuccess( $desc ){
-               pass( $desc );
-       }
-       
-       function showFailure( $desc, $exp, $got ){
-               _proclaim( false, $desc, false, $got, $exp );
-       }
-       
-       function showRunFile( $path ){}
-}
-
-$options = array( 'quick', 'quiet', 'compare' );
-$tester = new ProveParserTest();
-$tester->showProgress = false;
-$tester->showFailure = false;
-$tester->recorder = new ProveTestRecorder( $tester->term );
-
-// Do not output the number of tests, if will be done automatically at the end
-
-$tester->runTestsFromFiles( $wgParserTestFiles );
-
-/* vim: set filetype=php: */