Skip to content

Commit

Permalink
Require DataValues Number 0.8.2
Browse files Browse the repository at this point in the history
Change-Id: I2cd088e09649113f2bbbb810d23419b3f6cd8a97
  • Loading branch information
thiemowmde committed Nov 17, 2016
1 parent 913a278 commit ac302b7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private function getGenericSnaks() {
)
],
'quantity' => [
'42 a [[b]] c',
'42±0 a [[b]] c',
new PropertyValueSnak(
$p4,
new QuantityValue(
Expand All @@ -148,7 +148,7 @@ private function getGenericSnaks() {
)
],
'quantity with unit' => [
'42 label [[with]] wikitext',
'42±0 label [[with]] wikitext',
new PropertyValueSnak(
$p4,
new QuantityValue(
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"data-values/common": "~0.3.0",
"data-values/geo": "~1.0",
"data-values/interfaces": "~0.2.0|~0.1.5",
"data-values/number": "~0.8.1",
"data-values/number": "~0.8.2",
"data-values/time": "~0.8.4",
"data-values/validators": "~0.1.0",
"data-values/data-types": "~0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion lib/includes/Formatters/QuantityDetailsFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function format( $value ) {
*/
private function formatNumber( DecimalValue $number, $unit ) {
return htmlspecialchars( $this->numberFormatter->format(
new QuantityValue( $number, $unit, $number, $number )
new UnboundedQuantityValue( $number, $unit )
) );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use DataValues\QuantityValue;
use DataValues\StringValue;
use DataValues\TimeValue;
use DataValues\UnboundedQuantityValue;
use DataValues\UnDeserializableValue;
use Language;
use MediaWikiTestCase;
Expand Down Expand Up @@ -306,7 +307,7 @@ public function provideNewFormatter() {
'Quantity',
SnakFormatter::FORMAT_PLAIN,
$this->newFormatterOptions( 'de' ),
QuantityValue::newFromNumber( '+123456.789' ),
UnboundedQuantityValue::newFromNumber( '+123456.789' ),
'@^123\\.456,789$@'
),
'quantity details' => array(
Expand Down
3 changes: 2 additions & 1 deletion repo/tests/phpunit/includes/Api/FormatSnakValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use DataValues\StringValue;
use DataValues\TimeValue;
use ApiUsageException;
use DataValues\UnboundedQuantityValue;
use UsageException;
use Wikibase\DataModel\Entity\EntityIdValue;
use Wikibase\DataModel\Entity\Item;
Expand Down Expand Up @@ -101,7 +102,7 @@ public function provideApiRequest() {
'@^http://acme\.test$@'
),
array(
QuantityValue::newFromNumber( '+12.33', '1' ),
UnboundedQuantityValue::newFromNumber( '+12.33' ),
'quantity',
SnakFormatter::FORMAT_PLAIN,
array( 'lang' => 'de' ),
Expand Down

0 comments on commit ac302b7

Please sign in to comment.