MediaWiki  REL1_22
TimeAdjustTest.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class TimeAdjustTest extends MediaWikiLangTestCase {
00004     protected function setUp() {
00005         parent::setUp();
00006 
00007         $this->iniSet( 'precision', 15 );
00008     }
00009 
00015     public function testUserAdjust( $date, $localTZoffset, $expected ) {
00016         global $wgContLang;
00017 
00018         $this->setMwGlobals( 'wgLocalTZoffset', $localTZoffset );
00019 
00020         $this->assertEquals(
00021             strval( $expected ),
00022             strval( $wgContLang->userAdjust( $date, '' ) ),
00023             "User adjust {$date} by {$localTZoffset} minutes should give {$expected}"
00024         );
00025     }
00026 
00027     public static function dataUserAdjust() {
00028         return array(
00029             array( 20061231235959, 0, 20061231235959 ),
00030             array( 20061231235959, 5, 20070101000459 ),
00031             array( 20061231235959, 15, 20070101001459 ),
00032             array( 20061231235959, 60, 20070101005959 ),
00033             array( 20061231235959, 90, 20070101012959 ),
00034             array( 20061231235959, 120, 20070101015959 ),
00035             array( 20061231235959, 540, 20070101085959 ),
00036             array( 20061231235959, -5, 20061231235459 ),
00037             array( 20061231235959, -30, 20061231232959 ),
00038             array( 20061231235959, -60, 20061231225959 ),
00039         );
00040     }
00041 }