public function testRedirectUpdated() { $mock = new MockRepository(); $id = new ItemId('Q123'); $item = new Item($id); $mock->putEntity($item, 11); $lookup = new CachingEntityRevisionLookup($mock, new HashBagOStuff()); $lookup->setVerifyRevision(false); // fetch first revision, so it gets cached $lookup->getEntityRevision($id); // replace by a redirect $targetId = new ItemId('Q222'); $redir = new EntityRedirect($id, $targetId); $mock->putRedirect($redir); // now, notify the cache $lookup->redirectUpdated($redir, 17); // make sure we get the new revision now try { $lookup->getEntityRevision($id); $this->fail('UnresolvedRedirectException expected; perhaps the cache did not get purged properly.'); } catch (RevisionedUnresolvedRedirectException $ex) { $this->assertEquals($targetId, $ex->getRedirectTargetId()); } }