Passed
Push — master ( 28768d...a4b5ac )
by Timon
02:33
created

DeleteTest::testDeleteDocument()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

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