public function testGetEntityDocumentsForIdsWithNoRetuls() { $entityDocumentLookupMock = $this->getMockBuilder('Wikibase\\EntityStore\\EntityDocumentLookup')->disableOriginalConstructor()->getMock(); $entityDocumentLookupMock->expects($this->once())->method('getEntityDocumentsForIds')->with($this->equalTo(array(new ItemId('Q1'))))->willReturn(array()); $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->assertEquals(array(), $entityLookup->getEntityDocumentsForIds(array(new ItemId('Q1')))); }
public function testGetEntityDocumentsForIdsWithoutReturns() { $entityDocumentLookupMock = $this->getMockBuilder('Wikibase\\EntityStore\\EntityDocumentLookup')->disableOriginalConstructor()->getMock(); $entityDocumentLookupMock->expects($this->once())->method('getEntityDocumentsForIds')->with($this->equalTo([new ItemId('Q1')]))->willReturn([]); $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->assertEquals([], $entityLookup->getEntityDocumentsForIds([new ItemId('Q1')])); }