public function testGivenIdInExceptionList_hasEntityThrowsException() { $lookup = new InMemoryEntityLookup(); $lookup->addException(new EntityLookupException(new ItemId('Q1'))); $lookup->hasEntity(new ItemId('Q2')); $this->setExpectedException('Wikibase\\DataModel\\Services\\Lookup\\EntityLookupException'); $lookup->hasEntity(new ItemId('Q1')); }
/** * @return EntityLookup */ private function getEntityLookup() { $entityLookup = new InMemoryEntityLookup(); $entityLookup->addException(new EntityLookupException(new ItemId('Q503'))); $item = new Item(new ItemId('Q116')); $item->setLabel('en', 'New York City'); $item->setLabel('es', 'Nueva York'); $item->setDescription('de', 'Metropole an der Ostküste der Vereinigten Staaten'); $item->setDescription('en', 'largest city in New York and the United States of America'); $entityLookup->addEntity($item); $item = new Item(new ItemId('Q117')); $item->setLabel('de', 'Berlin'); $entityLookup->addEntity($item); return $entityLookup; }