Passed
Pull Request — master (#28)
by Timon
03:18
created

GetTest::tearDown()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
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();
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