jenkins-bot has submitted this change and it was merged.
Change subject: Fix array keys for external identifier datatype
......................................................................
Fix array keys for external identifier datatype
The definition was wrong in WikibaseRepo where it was just PT:id instead
of PT:external-id. Furthermore, in the SnakFormatter dispatching we need
to add the PT prefix in order to get the correct formatter.
Bug: T124902
Change-Id: I1101538b245b7e9d79f77100abf73115cbdf81d9
---
M lib/includes/formatters/DispatchingSnakFormatter.php
M lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
M lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
M repo/WikibaseRepo.datatypes.php
4 files changed, 5 insertions(+), 5 deletions(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/includes/formatters/DispatchingSnakFormatter.php
b/lib/includes/formatters/DispatchingSnakFormatter.php
index 9e27d59..4f08cb7 100644
--- a/lib/includes/formatters/DispatchingSnakFormatter.php
+++ b/lib/includes/formatters/DispatchingSnakFormatter.php
@@ -141,8 +141,8 @@
$dataType = $this->getSnakDataType( $snak );
- if ( isset( $this->formattersByDataType[$dataType] ) ) {
- $formatter = $this->formattersByDataType[$dataType];
+ if ( isset( $this->formattersByDataType["PT:$dataType"] ) ) {
+ $formatter =
$this->formattersByDataType["PT:$dataType"];
return $formatter->formatSnak( $snak );
}
diff --git a/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
b/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
index 10de96d..23ad602 100644
--- a/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
+++ b/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
@@ -198,7 +198,7 @@
);
$formattersByDataType = array(
- 'string' => $this->makeSnakFormatter( 'STRING VALUE' ),
+ 'PT:string' => $this->makeSnakFormatter( 'STRING VALUE'
),
'*' => $this->makeSnakFormatter( 'OTHER VALUE' ),
);
diff --git
a/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
b/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
index 5eee006..e722ffe 100644
--- a/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
+++ b/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
@@ -34,7 +34,7 @@
$self = $this;
$snakFormatterCallbacks = array(
- 'commonsMedia' => function( $format, FormatterOptions
$options ) use ( $self ) {
+ 'PT:commonsMedia' => function( $format,
FormatterOptions $options ) use ( $self ) {
return $self->makeMockSnakFormatter( $format );
},
);
diff --git a/repo/WikibaseRepo.datatypes.php b/repo/WikibaseRepo.datatypes.php
index 2078091..6521acf 100644
--- a/repo/WikibaseRepo.datatypes.php
+++ b/repo/WikibaseRepo.datatypes.php
@@ -242,7 +242,7 @@
return new ObjectUriRdfBuilder();
},
),
- 'PT:id' => array(
+ 'PT:external-id' => array(
'validator-factory-callback' => function() {
$factory =
WikibaseRepo::getDefaultValidatorBuilders();
return $factory->buildStringValidators();
--
To view, visit https://gerrit.wikimedia.org/r/266746
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1101538b245b7e9d79f77100abf73115cbdf81d9
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits