MediaWiki  REL1_24
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 
00013     public function testUserAdjust( $date, $localTZoffset, $expected ) {
00014         global $wgContLang;
00015 
00016         $this->setMwGlobals( 'wgLocalTZoffset', $localTZoffset );
00017 
00018         $this->assertEquals(
00019             $expected,
00020             strval( $wgContLang->userAdjust( $date, '' ) ),
00021             "User adjust {$date} by {$localTZoffset} minutes should give {$expected}"
00022         );
00023     }
00024 
00025     public static function dataUserAdjust() {
00026         return array(
00027             array( '20061231235959', 0, '20061231235959' ),
00028             array( '20061231235959', 5, '20070101000459' ),
00029             array( '20061231235959', 15, '20070101001459' ),
00030             array( '20061231235959', 60, '20070101005959' ),
00031             array( '20061231235959', 90, '20070101012959' ),
00032             array( '20061231235959', 120, '20070101015959' ),
00033             array( '20061231235959', 540, '20070101085959' ),
00034             array( '20061231235959', -5, '20061231235459' ),
00035             array( '20061231235959', -30, '20061231232959' ),
00036             array( '20061231235959', -60, '20061231225959' ),
00037         );
00038     }
00039 }