From: Brion Vibber Date: Tue, 19 Oct 2004 08:38:08 +0000 (+0000) Subject: Add more globals tests X-Git-Tag: 1.5.0alpha1~1512 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=8e9174f2537be10c85ad6413785a9a639380ba6f;p=lhc%2Fweb%2Fwiklou.git Add more globals tests --- diff --git a/tests/GlobalTest.php b/tests/GlobalTest.php index aa44a2b0b7..b6815758da 100644 --- a/tests/GlobalTest.php +++ b/tests/GlobalTest.php @@ -184,6 +184,48 @@ class GlobalTest extends PHPUnit_TestCase { array( 'application/xhtml+xml' => 1.0 ) ) ); } + function testTimestamp() { + $t = gmmktime( 12, 34, 56, 1, 15, 2001 ); + $this->assertEquals( + '20010115123456', + wfTimestamp( TS_MW, $t ), + 'TS_UNIX to TS_MW' ); + $this->assertEquals( + 979562096, + wfTimestamp( TS_UNIX, $t ), + 'TS_UNIX to TS_UNIX' ); + $this->assertEquals( + '2001-01-15 12:34:56', + wfTimestamp( TS_DB, $t ), + 'TS_UNIX to TS_DB' ); + + $this->assertEquals( + '20010115123456', + wfTimestamp( TS_MW, '20010115123456' ), + 'TS_MW to TS_MW' ); + $this->assertEquals( + 979562096, + wfTimestamp( TS_UNIX, '20010115123456' ), + 'TS_MW to TS_UNIX' ); + $this->assertEquals( + '2001-01-15 12:34:56', + wfTimestamp( TS_DB, '20010115123456' ), + 'TS_MW to TS_DB' ); + + $this->assertEquals( + '20010115123456', + wfTimestamp( TS_MW, '2001-01-15 12:34:56' ), + 'TS_DB to TS_MW' ); + $this->assertEquals( + 979562096, + wfTimestamp( TS_UNIX, '2001-01-15 12:34:56' ), + 'TS_DB to TS_UNIX' ); + $this->assertEquals( + '2001-01-15 12:34:56', + wfTimestamp( TS_DB, '2001-01-15 12:34:56' ), + 'TS_DB to TS_DB' ); + } + /* TODO: many more! */ }