Passed
Push — master ( 2f6a1e...868687 )
by Timon
04:41
created

GetTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 57
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetNonExistingDocument() 0 9 1
A testGet() 0 14 1
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