public function testGetEntityDocumentForIdWithoutDocument()
 {
     $entityDocumentLookupMock = $this->getMockBuilder('Wikibase\\EntityStore\\EntityDocumentLookup')->disableOriginalConstructor()->getMock();
     $entityDocumentLookupMock->expects($this->once())->method('getEntityDocumentForId')->with($this->equalTo(new ItemId('Q1')))->willReturn(null);
     $entityDocumentCacheMock = $this->getMockBuilder('Wikibase\\EntityStore\\Cache\\EntityDocumentCache')->disableOriginalConstructor()->getMock();
     $entityDocumentCacheMock->expects($this->once())->method('fetch')->with($this->equalTo(new ItemId('Q1')))->willReturn(null);
     $entityLookup = new CachedEntityDocumentLookup($entityDocumentLookupMock, $entityDocumentCacheMock);
     $this->assertNull($entityLookup->getEntityDocumentForId(new ItemId('Q1')));
 }
 public function testGetEntityDocumentForIdWithException()
 {
     $entityDocumentLookupMock = $this->getMockBuilder('Wikibase\\EntityStore\\EntityDocumentLookup')->disableOriginalConstructor()->getMock();
     $entityDocumentLookupMock->expects($this->once())->method('getEntityDocumentForId')->with($this->equalTo(new ItemId('Q1')))->willThrowException(new EntityNotFoundException(new ItemId('Q1')));
     $entityDocumentCacheMock = $this->getMockBuilder('Wikibase\\EntityStore\\Cache\\EntityDocumentCache')->disableOriginalConstructor()->getMock();
     $entityDocumentCacheMock->expects($this->once())->method('fetch')->with($this->equalTo(new ItemId('Q1')))->willThrowException(new EntityNotFoundException(new ItemId('Q1')));
     $entityLookup = new CachedEntityDocumentLookup($entityDocumentLookupMock, $entityDocumentCacheMock);
     $this->setExpectedException('Wikibase\\EntityStore\\EntityNotFoundException');
     $entityLookup->getEntityDocumentForId(new ItemId('Q1'));
 }