jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/405895 )
Change subject: Fix smaller mistakes in UsageDeduplicator
......................................................................
Fix smaller mistakes in UsageDeduplicator
Bug: T178079
Change-Id: I72fe1aeb3df2d36f322e6579994584f88aa0e4a8
---
M client/includes/Usage/UsageDeduplicator.php
M client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php
2 files changed, 27 insertions(+), 12 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/client/includes/Usage/UsageDeduplicator.php
b/client/includes/Usage/UsageDeduplicator.php
index 10c5feb..8c7e4ce 100644
--- a/client/includes/Usage/UsageDeduplicator.php
+++ b/client/includes/Usage/UsageDeduplicator.php
@@ -25,9 +25,8 @@
$return = [];
array_walk_recursive(
$structuredUsages,
- function( $a ) use ( &$return ) {
- /* @var EntityUsage $a */
- $return[$a->getIdentityString()] = $a;
+ function ( EntityUsage $usage ) use ( &$return ) {
+ $return[$usage->getIdentityString()] = $usage;
}
);
return $return;
@@ -65,8 +64,8 @@
}
/**
- * @param EntityUsage[] $usages
- * @return EntityUsage[]
+ * @param array[] $usages
+ * @return array[]
*/
private function deduplicateUsagesPerEntity( array $usages ) {
$usages[EntityUsage::DESCRIPTION_USAGE] =
$this->deduplicatePerType(
diff --git a/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php
b/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php
index cf2041e..a536369 100644
--- a/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php
+++ b/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php
@@ -31,19 +31,35 @@
$q2DescriptionFa = new EntityUsage( $q2,
EntityUsage::DESCRIPTION_USAGE, 'fa' );
return [
- [ [ $q1LabelEn, $q1Label ], [ $q1Label ] ],
- [ [ $q1LabelEn ], [ $q1LabelEn ] ],
- [ [ $q1LabelEn, $q1Label, $q2Description, $q1All ], [
$q1Label, $q1All, $q2Description ] ],
- [ [ $q1LabelEn, $q2Label, $q1Statement ], [ $q1LabelEn,
$q1Statement, $q2Label ] ],
- [ [ $q2DescriptionFa, $q2Description, $q1All ], [
$q2Description, $q1All ] ],
+ [
+ [ $q1LabelEn, $q1Label ],
+ [ $q1Label ]
+ ],
+ [
+ [ $q1LabelEn ],
+ [ $q1LabelEn ]
+ ],
+ [
+ [ $q1Label, $q1LabelEn, $q2Description, $q1All
],
+ [ $q1Label, $q2Description, $q1All ]
+ ],
+ [
+ [ $q1LabelEn, $q2Label, $q1Statement ],
+ [ $q1LabelEn, $q2Label, $q1Statement ]
+ ],
+ [
+ [ $q2Description, $q2DescriptionFa, $q1All ],
+ [ $q2Description, $q1All ]
+ ],
];
}
/**
- * @covers \Wikibase\Client\Usage\UsageDeduplicator::deduplicate
* @dataProvider provideDeduplicate
+ * @param EntityUsage[] $usages
+ * @param EntityUsage[] $output
*/
- public function testDeduplicate( $usages, $output ) {
+ public function testDeduplicate( array $usages, array $output ) {
$expected = [];
foreach ( $output as $usage ) {
$expected[$usage->getIdentityString()] = $usage;
--
To view, visit https://gerrit.wikimedia.org/r/405895
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I72fe1aeb3df2d36f322e6579994584f88aa0e4a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits