Merge "Use Xml::element instead of Html::element for empty elements"
[lhc/web/wiklou.git] / tests / phpunit / includes / TimeAdjustTest.php
1 <?php
2
3 class TimeAdjustTest extends MediaWikiLangTestCase {
4 protected function setUp() {
5 parent::setUp();
6 }
7
8 /**
9 * Test offset usage for a given Language::userAdjust
10 * @dataProvider dataUserAdjust
11 * @covers Language::userAdjust
12 */
13 public function testUserAdjust( $date, $localTZoffset, $expected ) {
14 global $wgContLang;
15
16 $this->setMwGlobals( 'wgLocalTZoffset', $localTZoffset );
17
18 $this->assertEquals(
19 $expected,
20 strval( $wgContLang->userAdjust( $date, '' ) ),
21 "User adjust {$date} by {$localTZoffset} minutes should give {$expected}"
22 );
23 }
24
25 public static function dataUserAdjust() {
26 return array(
27 array( '20061231235959', 0, '20061231235959' ),
28 array( '20061231235959', 5, '20070101000459' ),
29 array( '20061231235959', 15, '20070101001459' ),
30 array( '20061231235959', 60, '20070101005959' ),
31 array( '20061231235959', 90, '20070101012959' ),
32 array( '20061231235959', 120, '20070101015959' ),
33 array( '20061231235959', 540, '20070101085959' ),
34 array( '20061231235959', -5, '20061231235459' ),
35 array( '20061231235959', -30, '20061231232959' ),
36 array( '20061231235959', -60, '20061231225959' ),
37 );
38 }
39 }