Lucas Werkmeister (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/351618 )
Change subject: Remove DataValue objects from test parameters
......................................................................
Remove DataValue objects from test parameters
Outside of the tests, the parameters are parsed JSON objects from the
database – it doesn’t make sense to put objects in them: if the checkers
need objects instead of strings, they have to parse the strings.
This causes one test to fail (the checker doesn’t actually parse yet),
so we skip the test for now.
Bug: T164279
Change-Id: Ia9c67d90fead25d87ab108b781d49fb44d4683bc
---
M tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
1 file changed, 14 insertions(+), 12 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
refs/changes/18/351618/1
diff --git a/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
b/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
index 0f14c35..aee6272 100644
--- a/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
+++ b/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
@@ -102,8 +102,9 @@
}
public function testRangeConstraintTimeWithinRange() {
- $min = new TimeValue( '+00000001960-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
- $max = new TimeValue( '+00000001980-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
+ $this->markTestSkipped( 'RangeChecker does not correctly parse
the parameters to compare – see T164279.' );
+ $min = '+00000001960-01-01T00:00:00Z';
+ $max = '+00000001980-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
$constraintParameters = array(
'minimum_date' => $min,
@@ -114,8 +115,8 @@
}
public function testRangeConstraintTimeTooSmall() {
- $min = new TimeValue( '+00000001975-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
- $max = new TimeValue( '+00000001980-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
+ $min = '+00000001975-01-01T00:00:00Z';
+ $max = '+00000001980-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
$constraintParameters = array(
'minimum_date' => $min,
@@ -126,8 +127,8 @@
}
public function testRangeConstraintTimeTooBig() {
- $min = new TimeValue( '+00000001960-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
- $max = new TimeValue( '+00000001965-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
+ $min = '+00000001960-01-01T00:00:00Z';
+ $max = '+00000001965-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
$constraintParameters = array(
'minimum_date' => $min,
@@ -138,8 +139,9 @@
}
public function testRangeConstraintQuantityWrongParameter() {
- $min = new TimeValue( '+00000001970-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
- $value = $max = new DecimalValue( 42 );
+ $min = '+00000001970-01-01T00:00:00Z';
+ $max = 42;
+ $value = new DecimalValue( 42 );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new QuantityValue( $value, '1', $value, $value ) ) );
$constraintParameters = array(
'minimum_quantity' => $min,
@@ -150,8 +152,8 @@
}
public function testRangeConstraintTimeWrongParameter() {
- $min = new TimeValue( '+00000001970-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
- $max = new DecimalValue( 42 );
+ $min = '+00000001970-01-01T00:00:00Z';
+ $max = 42;
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
$constraintParameters = array(
'minimum_quantity' => $min,
@@ -162,8 +164,8 @@
}
public function testRangeConstraintWrongType() {
- $min = new TimeValue( '+00000001960-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
- $max = new TimeValue( '+00000001965-01-01T00:00:00Z', 0, 0, 0,
11, 'http://www.wikidata.org/entity/Q1985727' );
+ $min = '+00000001960-01-01T00:00:00Z';
+ $max = '+00000001965-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new StringValue( '1.1.1970' ) ) );
$constraintParameters = array(
'minimum_date' => $min,
--
To view, visit https://gerrit.wikimedia.org/r/351618
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9c67d90fead25d87ab108b781d49fb44d4683bc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits