jenkins-bot has submitted this change and it was merged.
Change subject: Add more time parser test cases
......................................................................
Add more time parser test cases
Change-Id: I305c7c9e0d451d6d6d291c5e1ae80bd5f3ad1175
---
M lib/tests/phpunit/parsers/DateTimeParserTest.php
M lib/tests/phpunit/parsers/TimeParserTest.php
M lib/tests/phpunit/parsers/YearMonthTimeParserTest.php
3 files changed, 18 insertions(+), 2 deletions(-)
Approvals:
Tobias Gritschacher: Looks good to me, but someone else must approve
WikidataJenkins: Verified
Thiemo Mättig (WMDE): Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/tests/phpunit/parsers/DateTimeParserTest.php
b/lib/tests/phpunit/parsers/DateTimeParserTest.php
index 88a51c8..a03c6bb 100644
--- a/lib/tests/phpunit/parsers/DateTimeParserTest.php
+++ b/lib/tests/phpunit/parsers/DateTimeParserTest.php
@@ -177,12 +177,15 @@
'Jann 2014',
'1980x',
'1980s', // supported by MWTimeIsoParser
+ '1980s ',
+ '1980 ',
'1980ss',
'1980er',
'1980UTC', // we don't support year + timezone here
'1980America/New_York',
'1980 America/New_York',
'1980+3',
+ '1980+x'
);
foreach ( $invalid as $value ) {
diff --git a/lib/tests/phpunit/parsers/TimeParserTest.php
b/lib/tests/phpunit/parsers/TimeParserTest.php
index 2e03ff0..4e887bb 100644
--- a/lib/tests/phpunit/parsers/TimeParserTest.php
+++ b/lib/tests/phpunit/parsers/TimeParserTest.php
@@ -52,6 +52,8 @@
array( '+0000000000002000-00-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_YEAR , TimeFormatter::CALENDAR_GREGORIAN ),
'2010' =>
array( '+0000000000002010-00-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_YEAR , TimeFormatter::CALENDAR_GREGORIAN ),
+ '1980 ' =>
+ array( '+0000000000001980-00-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_YEAR , TimeFormatter::CALENDAR_GREGORIAN ),
'1' =>
array( '+0000000000000001-00-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_YEAR , TimeFormatter::CALENDAR_GREGORIAN ),
'-1000000001' =>
@@ -66,6 +68,10 @@
//Wikibase\Lib\YearMonthTimeParser
'1 1999' =>
array( '+0000000000001999-01-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
+ 'March 1999' =>
+ array( '+0000000000001999-03-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
+ '1999 March' =>
+ array( '+0000000000001999-03-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
//ValueParsers\TimeParser
'+0000000000000000-01-01T00:00:00Z (Gregorian)' =>
@@ -120,7 +126,10 @@
'111 111 111',
'Jann 2014',
'1980x',
- '1980ss'
+ '1980ss',
+ '1980UTC',
+ '1980 America/New_York',
+ '1980America/New_York'
);
foreach ( $invalid as $value ) {
diff --git a/lib/tests/phpunit/parsers/YearMonthTimeParserTest.php
b/lib/tests/phpunit/parsers/YearMonthTimeParserTest.php
index f3b0ff9..745c468 100644
--- a/lib/tests/phpunit/parsers/YearMonthTimeParserTest.php
+++ b/lib/tests/phpunit/parsers/YearMonthTimeParserTest.php
@@ -57,6 +57,10 @@
array( '+0000000000001999-01-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
'January/1' =>
array( '+0000000000000001-01-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
+ '1999 January' =>
+ array( '+0000000000001999-01-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
+ 'January 1999' =>
+ array( '+0000000000001999-01-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
'January-1' =>
array( '+0000000000000001-01-00T00:00:00Z', 0 ,
0 , 0 , TimeValue::PRECISION_MONTH , TimeFormatter::CALENDAR_GREGORIAN ),
'JanuARY-1' =>
@@ -153,4 +157,4 @@
return $argLists;
}
-}
\ No newline at end of file
+}
--
To view, visit https://gerrit.wikimedia.org/r/130305
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I305c7c9e0d451d6d6d291c5e1ae80bd5f3ad1175
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Adrian Lang <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: WikidataJenkins <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits