Test Failed
Pull Request — master (#34)
by Timon
06:34
created

IsEmptyTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 48
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsNotEmpty() 0 10 1
A testIsEmpty() 0 8 1
A testFilterIsNotEmpty() 0 15 1
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()
53
                    ->run();
54
55
        $this->assertFalse($res->getData());
56
    }
57
}
58