tbolier /
php-rethink-ql
| 1 | <?php |
||
| 2 | declare(strict_types = 1); |
||
| 3 | |||
| 4 | namespace TBolier\RethinkQL\IntegrationTest\Query; |
||
| 5 | |||
| 6 | use TBolier\RethinkQL\Response\ResponseInterface; |
||
| 7 | |||
| 8 | class GetTest extends AbstractTableTest |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @return void |
||
| 12 | * @throws \Exception |
||
| 13 | */ |
||
| 14 | public function testGet(): void |
||
| 15 | { |
||
| 16 | $this->insertDocument(1); |
||
| 17 | |||
| 18 | /** @var ResponseInterface $res */ |
||
| 19 | $res = $this->r() |
||
| 20 | ->table('tabletest') |
||
| 21 | ->get(1) |
||
| 22 | ->run(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 23 | |||
| 24 | /** @var array $array */ |
||
| 25 | $array = $res->getData(); |
||
| 26 | |||
| 27 | $this->assertArraySubset(['id' => 1], $array); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return void |
||
| 32 | * @throws \Exception |
||
| 33 | */ |
||
| 34 | public function testGetNonExistingDocument(): void |
||
| 35 | { |
||
| 36 | /** @var ResponseInterface $res */ |
||
| 37 | $res = $this->r() |
||
| 38 | ->table('tabletest') |
||
| 39 | ->get('bar') |
||
| 40 | ->run(); |
||
| 41 | |||
| 42 | $this->assertEquals(null, $res->getData()); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |