Failed Conditions
Pull Request — master (#34)
by Marc
03:16
created

GetAllTest::testGetAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\IntegrationTest\Query;
5
6
use TBolier\RethinkQL\Response\Cursor;
7
use TBolier\RethinkQL\Response\ResponseInterface;
8
9
class GetAllTest extends AbstractTableTest
10
{
11
    /**
12
     * @return void
13
     * @throws \Exception
14
     */
15
    public function testGetAll(): void
16
    {
17
        $this->insertDocument(1);
18
        $this->insertDocument('stringId');
19
20
        /** @var Cursor $cursor */
21
        $cursor = $this->r()
22
                       ->table('tabletest')
23
                       ->getAll(1, 'stringId')
24
                       ->run();
25
26
        /** @var array $array */
27
        $array = $cursor->current();
28
29
        $this->assertArraySubset(['description' => 'A document description.'], $array);
30
    }
31
32
    /**
33
     * @return void
34
     * @throws \Exception
35
     */
36
    public function testGetAllAndCount(): void
37
    {
38
        $this->insertDocument(1);
39
        $this->insertDocument('stringId');
40
41
        /** @var ResponseInterface $res */
42
        $res = $this->r()
43
                    ->table('tabletest')
44
                    ->getAll(1, 'stringId')
45
                    ->count()
46
                    ->run();
47
48
        $this->assertEquals(2, $res->getData());
49
    }
50
}
51