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

GetAllTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 43
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAllAndCount() 0 14 1
A testGetAll() 0 16 1
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')
0 ignored issues
show
Bug introduced by
1 of type integer is incompatible with the type array expected by parameter $keys of TBolier\RethinkQL\Query\...tionInterface::getAll(). ( Ignorable by Annotation )

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

23
                       ->getAll(/** @scrutinizer ignore-type */ 1, 'stringId')
Loading history...
Bug introduced by
'stringId' of type string is incompatible with the type array expected by parameter $keys of TBolier\RethinkQL\Query\...tionInterface::getAll(). ( Ignorable by Annotation )

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

23
                       ->getAll(1, /** @scrutinizer ignore-type */ 'stringId')
Loading history...
24
                       ->run();
25
26
        /** @var array $array */
27
        $array = $cursor->current();
28
29
        // todo: remove assertNull
30
        $this->assertNull($array);
31
//        $this->assertArraySubset(['title' => 'Test document 1'], $array);
32
    }
33
34
    /**
35
     * @return void
36
     * @throws \Exception
37
     */
38
    public function testGetAllAndCount(): void
39
    {
40
        $this->insertDocument(1);
41
        $this->insertDocument(2);
42
43
        /** @var ResponseInterface $res */
44
        $res = $this->r()
45
                    ->table('tabletest')
46
                    ->getAll(1, 2)
0 ignored issues
show
Bug introduced by
1 of type integer is incompatible with the type array expected by parameter $keys of TBolier\RethinkQL\Query\...tionInterface::getAll(). ( Ignorable by Annotation )

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

46
                    ->getAll(/** @scrutinizer ignore-type */ 1, 2)
Loading history...
47
                    ->count()
48
                    ->run();
49
50
        // todo: change to 2
51
        $this->assertEquals(0, $res->getData());
52
    }
53
}
54