Passed
Pull Request — master (#34)
by Marc
07:28
created

IsEmptyTest::testIsEmpty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\IntegrationTest\Transformation;
5
6
use TBolier\RethinkQL\IntegrationTest\Query\AbstractTableTest;
7
8
class IsEmptyTest extends AbstractTableTest
9
{
10
    /**
11
     * @throws \Exception
12
     */
13
    public function testIsEmpty()
14
    {
15
        $res = $this->r()
16
                    ->table('tabletest')
17
                    ->isEmpty()
18
                    ->run();
19
20
        $this->assertTrue($res->getData());
21
    }
22
23
    /**
24
     * @throws \Exception
25
     */
26
    public function testIsNotEmpty()
27
    {
28
        $this->insertDocument(1);
29
30
        $res = $this->r()
31
                    ->table('tabletest')
32
                    ->isEmpty()
33
                    ->run();
34
35
        $this->assertFalse($res->getData());
36
    }
37
38
    /**
39
     * @throws \Exception
40
     */
41
    public function testFilterIsNotEmpty()
42
    {
43
        $this->insertDocument(1);
44
        $this->insertDocument(2);
45
        $this->insertDocument(3);
46
        $this->insertDocument(4);
47
        $this->insertDocument(5);
48
49
        $res = $this->r()
50
                    ->table('tabletest')
51
                    ->filter(['description' => 'A document description.'])
52
                    ->isEmpty()
0 ignored issues
show
Bug introduced by
The method isEmpty() does not exist on TBolier\RethinkQL\Query\...tion\OperationInterface. It seems like you code against a sub-type of TBolier\RethinkQL\Query\...tion\OperationInterface such as TBolier\RethinkQL\Query\TableInterface or TBolier\RethinkQL\Query\...tTransformationCompound. ( Ignorable by Annotation )

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

52
                    ->/** @scrutinizer ignore-call */ isEmpty()
Loading history...
53
                    ->run();
54
55
        $this->assertFalse($res->getData());
56
    }
57
}
58