Passed
Pull Request — master (#28)
by Timon
04:16 queued 42s
created

GetTest::testGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
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
        $this->assertArraySubset(['id' => 1], $res->getData());
1 ignored issue
show
Bug introduced by
It seems like $res->getData() can also be of type string; however, parameter $array of PHPUnit\Framework\Assert::assertArraySubset() does only seem to accept ArrayAccess|array, maybe add an additional type check? ( Ignorable by Annotation )

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

24
        $this->assertArraySubset(['id' => 1], /** @scrutinizer ignore-type */ $res->getData());
Loading history...
25
    }
26
27
    /**
28
     * @return void
29
     * @throws \Exception
30
     */
31
    public function testGetNonExistingDocument(): void
32
    {
33
        /** @var ResponseInterface $res */
34
        $res = $this->r()
35
            ->table('tabletest')
36
            ->get('bar')
37
            ->run();
38
39
        $this->assertEquals(null, $res->getData());
40
    }
41
}
42