diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:31:04 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:58:39 +0200 |
commit | f6d65e533c62f6deb21342d4901ece24497b433e (patch) | |
tree | f28adf0362d14bcd448f7b65a7aaf38650f923aa /tests/phpunit/includes/MWTimestampTest.php | |
parent | c27b2e832fe25651ef2410fae85b41072aae7519 (diff) |
Update to MediaWiki 1.25.1
Diffstat (limited to 'tests/phpunit/includes/MWTimestampTest.php')
-rw-r--r-- | tests/phpunit/includes/MWTimestampTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/phpunit/includes/MWTimestampTest.php b/tests/phpunit/includes/MWTimestampTest.php index dcb98563..36562545 100644 --- a/tests/phpunit/includes/MWTimestampTest.php +++ b/tests/phpunit/includes/MWTimestampTest.php @@ -8,6 +8,9 @@ class MWTimestampTest extends MediaWikiLangTestCase { protected function setUp() { parent::setUp(); + // Avoid 'GetHumanTimestamp' hook and others + $this->setMwGlobals( 'wgHooks', array() ); + RequestContext::getMain()->setLanguage( Language::factory( 'en' ) ); } @@ -79,6 +82,17 @@ class MWTimestampTest extends MediaWikiLangTestCase { } /** + * Test an out of range timestamp + * @dataProvider provideOutOfRangeTimestamps + * @expectedException TimestampException + * @covers MWTimestamp + */ + public function testOutOfRangeTimestamps( $format, $input ) { + $timestamp = new MWTimestamp( $input ); + $timestamp->getTimestamp( $format ); + } + + /** * Test requesting an invalid output format. * @expectedException TimestampException * @covers MWTimestamp::getTimestamp @@ -111,6 +125,18 @@ class MWTimestampTest extends MediaWikiLangTestCase { } /** + * Returns a list of out of range timestamps in the format: + * array( type, timestamp_of_type ) + */ + public static function provideOutOfRangeTimestamps() { + return array( + // Various formats + array( TS_MW, '-62167219201' ), // -0001-12-31T23:59:59Z + array( TS_MW, '253402300800' ), // 10000-01-01T00:00:00Z + ); + } + + /** * @dataProvider provideHumanTimestampTests * @covers MWTimestamp::getHumanTimestamp */ |