private function testAddAndGetAllUsage()
 {
     $q3 = new ItemId('Q3');
     $this->usageAccumulator->addAllUsage($q3);
     $expected = new EntityUsage($q3, EntityUsage::ALL_USAGE);
     $usages = $this->usageAccumulator->getUsages();
     $this->assertContainsUsage($expected, $usages);
 }
 /**
  * Get entity from prefixed ID (e.g. "Q23") and return it as serialized array.
  *
  * @since 0.5
  *
  * @param string $prefixedEntityId
  *
  * @return array|null
  */
 public function getEntity($prefixedEntityId)
 {
     $prefixedEntityId = trim($prefixedEntityId);
     $entityId = $this->entityIdParser->parse($prefixedEntityId);
     $this->usageAccumulator->addAllUsage($entityId);
     try {
         $entityObject = $this->entityLookup->getEntity($entityId);
     } catch (RevisionedUnresolvedRedirectException $ex) {
         // We probably hit a double redirect
         wfLogWarning('Encountered a UnresolvedRedirectException when trying to load ' . $prefixedEntityId);
         return null;
     }
     if ($entityObject === null) {
         return null;
     }
     $entityArr = $this->newClientEntitySerializer()->serialize($entityObject);
     // Renumber the entity as Lua uses 1-based array indexing
     $this->renumber($entityArr);
     $entityArr['schemaVersion'] = 2;
     return $entityArr;
 }