Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/177198
Change subject: Clean up MockPropertyLabelResolver ...................................................................... Clean up MockPropertyLabelResolver Change-Id: Ibad4935c6ebd4b726cf2d61bd2fc62e702d233a5 --- M lib/tests/phpunit/MockPropertyLabelResolver.php 1 file changed, 20 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/98/177198/1 diff --git a/lib/tests/phpunit/MockPropertyLabelResolver.php b/lib/tests/phpunit/MockPropertyLabelResolver.php index 2a454fc..d9627cf 100644 --- a/lib/tests/phpunit/MockPropertyLabelResolver.php +++ b/lib/tests/phpunit/MockPropertyLabelResolver.php @@ -14,37 +14,43 @@ */ class MockPropertyLabelResolver implements PropertyLabelResolver { - protected $repo; - - protected $lang; + /** + * @var MockRepository + */ + private $mockRepository; /** - * @param string $lang - * @param MockRepository $repo + * @var string */ - public function __construct( $lang, MockRepository $repo ) { - $this->lang = $lang; - $this->repo = $repo; + private $languageCode; + + /** + * @param string $languageCode + * @param MockRepository $mockRepository + */ + public function __construct( $languageCode, MockRepository $mockRepository ) { + $this->languageCode = $languageCode; + $this->mockRepository = $mockRepository; } /** - * @param string[] $labels the labels + * @param string[] $labels * @param string $recache ignored * * @return EntityId[] a map of strings from $labels to the corresponding entity ID. */ public function getPropertyIdsForLabels( array $labels, $recache = '' ) { - $ids = array(); + $entityIds = array(); foreach ( $labels as $label ) { - $prop = $this->repo->getPropertyByLabel( $label, $this->lang ); + $entity = $this->mockRepository->getPropertyByLabel( $label, $this->languageCode ); - if ( $prop !== null ) { - $ids[$label] = $prop->getId(); + if ( $entity !== null ) { + $entityIds[$label] = $entity->getId(); } } - return $ids; + return $entityIds; } } -- To view, visit https://gerrit.wikimedia.org/r/177198 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibad4935c6ebd4b726cf2d61bd2fc62e702d233a5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits