public function testDoQuery() { $apiMock = $this->getMockBuilder('WikidataQueryApi\\WikidataQueryApi')->disableOriginalConstructor()->getMock(); $apiMock->expects($this->any())->method('doQuery')->with($this->equalTo(['q' => 'claim[42:42]']))->will($this->returnValue(['status' => ['error' => 'OK'], 'items' => [42]])); $service = new SimpleQueryService($apiMock, new ClaimQuerySerializer()); $this->assertEquals([new ItemId('Q42')], $service->doQuery(new ClaimQuery(new PropertyId('P42'), new ItemId('Q42')))); }
/** * @see ItemIdForQueryLookup::getItemIdsForQuery */ public function getItemIdsForQuery(Description $queryDescription, QueryOptions $queryOptions = null) { return $this->queryService->doQuery($this->buildQueryForDescription($queryDescription)); }