| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function testDoQuery() { |
||
| 18 | $apiMock = $this->getMockBuilder( 'WikidataQueryApi\WikidataQueryApi' ) |
||
| 19 | ->disableOriginalConstructor() |
||
| 20 | ->getMock(); |
||
| 21 | $apiMock->expects( $this->any() ) |
||
| 22 | ->method( 'doQuery' ) |
||
| 23 | ->with( $this->equalTo( [ |
||
| 24 | 'q' => 'claim[42:42]' |
||
| 25 | ] ) ) |
||
| 26 | ->will( $this->returnValue( [ |
||
| 27 | 'status' => [ 'error' => 'OK' ], |
||
| 28 | 'items' => [ 42 ] |
||
| 29 | ] ) ); |
||
| 30 | |||
| 31 | $service = new SimpleQueryService( $apiMock, new ClaimQuerySerializer() ); |
||
| 32 | $this->assertEquals( |
||
| 33 | [ |
||
| 34 | new ItemId( 'Q42' ) |
||
| 35 | ], |
||
| 36 | $service->doQuery( |
||
| 37 | new ClaimQuery( new PropertyId('P42'), new ItemId( 'Q42' ) ) |
||
| 38 | ) |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |