private function testAddAndGetOtherUsage() { $q2 = new ItemId('Q2'); $this->usageAccumulator->addOtherUsage($q2); $expected = new EntityUsage($q2, EntityUsage::OTHER_USAGE); $usages = $this->usageAccumulator->getUsages(); $this->assertContainsUsage($expected, $usages); }
/** * @param string $prefixedEntityId * * @since 0.5 * @return string|null Null if entity couldn't be found/ no description present */ public function getDescription($prefixedEntityId) { try { $entityId = $this->entityIdParser->parse($prefixedEntityId); } catch (EntityIdParsingException $e) { return null; } try { $term = $this->labelDescriptionLookup->getDescription($entityId); } catch (StorageException $ex) { // TODO: verify this catch is still needed return null; } catch (LabelDescriptionLookupException $ex) { return null; } if ($term === null) { return null; } // XXX: This. Sucks. A lot. // Also notes about language fallbacks from getLabel apply $this->usageAccumulator->addOtherUsage($entityId); return $term->getText(); }