| @@ 48-64 (lines=17) @@ | ||
| 45 | * |
|
| 46 | * @dataProvider dataElemMatchOperator |
|
| 47 | */ |
|
| 48 | public function testElemMatchOperator($rqlQuery, array $expectedIds) |
|
| 49 | { |
|
| 50 | $client = static::createRestClient(); |
|
| 51 | $client->request('GET', '/testcase/elemmatch-operator/?'.$rqlQuery); |
|
| 52 | $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
|
| 53 | ||
| 54 | $foundIds = array_map( |
|
| 55 | function ($item) { |
|
| 56 | return $item->id; |
|
| 57 | }, |
|
| 58 | $client->getResults() |
|
| 59 | ); |
|
| 60 | ||
| 61 | sort($expectedIds); |
|
| 62 | sort($foundIds); |
|
| 63 | $this->assertEquals($expectedIds, $foundIds); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Data for elemMatch() operator test |
|
| @@ 328-344 (lines=17) @@ | ||
| 325 | * |
|
| 326 | * @return void |
|
| 327 | */ |
|
| 328 | public function testExtrefOperators($rqlQuery, array $expectedIds) |
|
| 329 | { |
|
| 330 | $client = static::createRestClient(); |
|
| 331 | $client->request('GET', '/core/module/?'.$rqlQuery); |
|
| 332 | $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
|
| 333 | ||
| 334 | $foundIds = array_map( |
|
| 335 | function ($item) { |
|
| 336 | return $item->id; |
|
| 337 | }, |
|
| 338 | $client->getResults() |
|
| 339 | ); |
|
| 340 | ||
| 341 | sort($foundIds); |
|
| 342 | sort($expectedIds); |
|
| 343 | $this->assertEquals($expectedIds, $foundIds); |
|
| 344 | } |
|
| 345 | ||
| 346 | /** |
|
| 347 | * @return array |
|