GetTest   A
last analyzed

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);
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\Assert::assertArraySubset() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3494 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

27
        /** @scrutinizer ignore-deprecated */ $this->assertArraySubset(['id' => 1], $array);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
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