Merge "Deleting a page and then immediately create-protecting it caused a PHP Fatal...
[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 $this->iniSet( 'precision', 15 );
8 }
9
10 /**
11 * Test offset usage for a given Language::userAdjust
12 * @dataProvider dataUserAdjust
13 * @covers Language::userAdjust
14 */
15 public function testUserAdjust( $date, $localTZoffset, $expected ) {
16 global $wgContLang;
17
18 $this->setMwGlobals( 'wgLocalTZoffset', $localTZoffset );
19
20 $this->assertEquals(
21 strval( $expected ),
22 strval( $wgContLang->userAdjust( $date, '' ) ),
23 "User adjust {$date} by {$localTZoffset} minutes should give {$expected}"
24 );
25 }
26
27 public static function dataUserAdjust() {
28 return array(
29 array( 20061231235959, 0, 20061231235959 ),
30 array( 20061231235959, 5, 20070101000459 ),
31 array( 20061231235959, 15, 20070101001459 ),
32 array( 20061231235959, 60, 20070101005959 ),
33 array( 20061231235959, 90, 20070101012959 ),
34 array( 20061231235959, 120, 20070101015959 ),
35 array( 20061231235959, 540, 20070101085959 ),
36 array( 20061231235959, -5, 20061231235459 ),
37 array( 20061231235959, -30, 20061231232959 ),
38 array( 20061231235959, -60, 20061231225959 ),
39 );
40 }
41 }