Failed Conditions
Pull Request — master (#74)
by Timon
04:03 queued 01:17
created

GetTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGet() 0 14 1
A testGetNonExistingDocument() 0 9 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\IntegrationTest\Operation;
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