Passed
Push — master ( 2f6a1e...868687 )
by Timon
04:41
created

DeleteTest::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\IntegrationTest\Query;
5
6
use ArrayObject;
7
use TBolier\RethinkQL\Response\Cursor;
8
use TBolier\RethinkQL\Response\ResponseInterface;
9
use TBolier\RethinkQL\IntegrationTest\AbstractTestCase;
10
11
class DeleteTest extends AbstractTableTest
12
{
13
    /**
14
     * @throws \Exception
15
     */
16
    public function testDeleteDocument()
17
    {
18
        $this->r()
19
            ->table('tabletest')
20
            ->insert([
21
                'title' => 'Delete document',
22
            ])
23
            ->run();
24
25
        /** @var ResponseInterface $count */
26
        $count = $this->r()
27
            ->table('tabletest')
28
            ->filter(['title' => 'Delete document'])
29
            ->count()
30
            ->run();
31
32
        $this->assertInternalType('int', $count->getData());
33
34
        /** @var ResponseInterface $res */
35
        $res = $this->r()
36
            ->table('tabletest')
37
            ->filter(['title' => 'Delete document'])
38
            ->delete()
39
            ->run();
40
41
        $this->assertObStatus(['deleted' => $count->getData()], $res->getData());
42
    }
43
}
44