Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/254421
Change subject: Remove redundant TimeValue validation from ValidatorBuilders
......................................................................
Remove redundant TimeValue validation from ValidatorBuilders
Note the comment: It said that this should be removed when the TimeValue
class implements basic validation of it's own timestamp string. It does
that for a long time now. All this additional validation of the format,
month and day is not needed any more.
Change-Id: I76fe8bc864e4cd6df9f62d5617fe1a858beca3c8
---
M repo/includes/ValidatorBuilders.php
M repo/tests/phpunit/includes/ValidatorBuildersTest.php
2 files changed, 1 insertion(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/21/254421/1
diff --git a/repo/includes/ValidatorBuilders.php
b/repo/includes/ValidatorBuilders.php
index 7ecbdcc..963ee21 100644
--- a/repo/includes/ValidatorBuilders.php
+++ b/repo/includes/ValidatorBuilders.php
@@ -214,13 +214,9 @@
$timeStringValidators = array();
$timeStringValidators[] = new TypeValidator( 'string' );
- // down to the second
- //$maxPrecision = TimeValue::PRECISION_SECOND;
- //$isoDataPattern =
'!^[-+]\d{1,16}-(0\d|1[012])-([012]\d|3[01])T([01]\d|2[0123]):[0-5]\d:([0-5]\d|6[012])Z$!';
-
// down to the day
$maxPrecision = TimeValue::PRECISION_DAY;
- $isoDataPattern =
'!^[-+]\d{1,16}-(0\d|1[012])-([012]\d|3[01])T00:00:00Z$!';
+ $isoDataPattern = '/T00:00:00Z$/';
$timeStringValidators[] = new RegexValidator( $isoDataPattern );
diff --git a/repo/tests/phpunit/includes/ValidatorBuildersTest.php
b/repo/tests/phpunit/includes/ValidatorBuildersTest.php
index 59a1c40..c74b5e3 100644
--- a/repo/tests/phpunit/includes/ValidatorBuildersTest.php
+++ b/repo/tests/phpunit/includes/ValidatorBuildersTest.php
@@ -157,11 +157,6 @@
'precision: second'
),
- //time['time']
- //NOTE: The below will fail with a
IllegalValueExcpetion once the TimeValue constructor enforces the time format.
- // Once that is done, this test and the respective
validator can and should both be removed.
- //array( 'string', new TimeValue( '2013-06-06
11:22:33', 0, 0, 0, 0, 'http://acme.com/calendar' ), false, 'time: not ISO
8601' ),
-
//TODO: calendar must be an item reference
//TODO: calendar must be from a list of configured
values
--
To view, visit https://gerrit.wikimedia.org/r/254421
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I76fe8bc864e4cd6df9f62d5617fe1a858beca3c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits