nicer format for static groups record
[lhc/web/wiklou.git] / tests / GlobalTest.php
index aa44a2b..9cb398d 100644 (file)
@@ -2,6 +2,7 @@
 
 require_once( 'PHPUnit.php' );
 require_once( '../includes/Defines.php' );
+require_once( '../includes/Profiling.php' );
 require_once( '../includes/GlobalFunctions.php' );
 
 class GlobalTest extends PHPUnit_TestCase {
@@ -184,6 +185,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! */
 }