/** * @param string|EntityId $id * @param bool $resolveRedirects * * @return null|EntityDocument */ public function getEntity($id, $resolveRedirects = false) { if (is_string($id)) { $id = $this->idParser->parse($id); } if ($resolveRedirects) { return $this->redirectResolvingEntityLookup->getEntity($id); } else { return $this->mockRepository->getEntity($id); } }
public function testGetEntity_doubleRedirect() { $lookup = new RedirectResolvingEntityLookup($this->getLookupDouble()); $id = new ItemId('Q12'); // Q12 is a double redirect $this->setExpectedException('Wikibase\\DataModel\\Services\\Lookup\\UnresolvedEntityRedirectException'); $lookup->getEntity($id); }