From 8f416baead93a48e5799e44b8bd2e2c4859f4e04 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 14 Sep 2007 13:18:58 +0200 Subject: auf Version 1.11 aktualisiert; Login-Bug behoben --- t/inc/IP.t | 1 + t/inc/Language.t | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ t/inc/Licenses.t | 6 ++---- t/inc/Sanitizer.t | 3 +++ t/inc/Title.t | 2 +- t/inc/Xml.t | 3 ++- 6 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 t/inc/Language.t (limited to 't/inc') diff --git a/t/inc/IP.t b/t/inc/IP.t index eb4978b9..82a61fe1 100644 --- a/t/inc/IP.t +++ b/t/inc/IP.t @@ -57,4 +57,5 @@ foreach ( $private as $p ) { ok( ! IP::isPublic( $p ), "$p is not a public IP address" ); } +/* vim: set filetype=php: */ ?> diff --git a/t/inc/Language.t b/t/inc/Language.t new file mode 100644 index 00000000..df5e491d --- /dev/null +++ b/t/inc/Language.t @@ -0,0 +1,62 @@ +#!/usr/bin/env php +userAdjust( $date, '' ), + '==', + $expected, + "User adjust $date by $offset minutes should give $expected" + ); +} + +# Collection of parameters for Language_t_Offset. +# Format: date to be formatted, localTZoffset value, expected date +$userAdjust_tests = array( + array( 20061231235959, 0, 20061231235959 ), + array( 20061231235959, 5, 20070101000459 ), + array( 20061231235959, 15, 20070101001459 ), + array( 20061231235959, 60, 20070101005959 ), + array( 20061231235959, 90, 20070101012959 ), + array( 20061231235959, 120, 20070101015959 ), + array( 20061231235959, 540, 20070101085959 ), + array( 20061231235959, -5, 20061231235459 ), + array( 20061231235959, -30, 20061231232959 ), + array( 20061231235959, -60, 20061231225959 ), +); + +plan( 7 + count($userAdjust_tests) ); + +require_ok( 'includes/Defines.php' ); + +# require_ok() doesn't work for these, find out why +define( 'MEDIAWIKI', 1 ); +require 'LocalSettings.php'; +require 'includes/DefaultSettings.php'; + +# Create a language object +require_ok( 'languages/Language.php' ); +require_ok( 'includes/Title.php' ); +$wgContLang = $en = Language::factory( 'en' ); + +# We need an user to test the lang +require_ok( 'includes/GlobalFunctions.php' ); +require_ok( 'includes/ProfilerStub.php' ); +require_ok( 'includes/Exception.php' ); +require_ok( 'includes/User.php' ); +global $wgUser; +$wgUser = new User(); + +# Launch tests for language::userAdjust +foreach( $userAdjust_tests as $data ) { + test_userAdjust( $en, $data[0], $data[1], $data[2] ); +} + +/* vim: set filetype=php: */ +?> diff --git a/t/inc/Licenses.t b/t/inc/Licenses.t index 86202bd6..7e9f67c8 100644 --- a/t/inc/Licenses.t +++ b/t/inc/Licenses.t @@ -23,7 +23,5 @@ $str = " #echo $lc->html; - - - -?> \ No newline at end of file +/* vim: set filetype=php: */ +?> diff --git a/t/inc/Sanitizer.t b/t/inc/Sanitizer.t index e3b11b6f..601f8a88 100644 --- a/t/inc/Sanitizer.t +++ b/t/inc/Sanitizer.t @@ -60,3 +60,6 @@ cmp_ok( '
Hello world
', 'Self-closing closing div' ); + +/* vim: set filetype=php: */ +?> diff --git a/t/inc/Title.t b/t/inc/Title.t index 51157197..53ebfcd8 100644 --- a/t/inc/Title.t +++ b/t/inc/Title.t @@ -29,5 +29,5 @@ foreach ( range( 1, 255 ) as $num ) { } } - +/* vim: set filetype=php: */ ?> diff --git a/t/inc/Xml.t b/t/inc/Xml.t index bf95cce2..527cd7f5 100644 --- a/t/inc/Xml.t +++ b/t/inc/Xml.t @@ -53,4 +53,5 @@ cmp_ok( cmp_ok( Xml::closeElement( 'element' ), '==', '', 'closeElement() shortcut' ); -?> \ No newline at end of file +/* vim: set filetype=php: */ +?> -- cgit v1.2.3-54-g00ecf