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

InsertTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 77
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testInsert() 0 5 1
B testMultipleInserts() 0 24 1
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 InsertTest extends AbstractTableTest
12
{
13
    /**
14
     * @throws \Exception
15
     */
16
    public function testInsert()
17
    {
18
        $res = $this->insertDocument(1);
19
20
        $this->assertObStatus(['inserted' => 1], $res->getData());
21
    }
22
23
    /**
24
     * @throws \Exception
25
     */
26
    public function testMultipleInserts()
27
    {
28
        $res = $this->r()
29
            ->table('tabletest')
30
            ->insert([
31
                [
32
                    'id' => 1,
33
                    'title' => 'Test document',
34
                    'description' => 'My first document.',
35
                ],
36
                [
37
                    'id' => 2,
38
                    'title' => 'Test document',
39
                    'description' => 'My first document.',
40
                ],
41
                [
42
                    'id' => 3,
43
                    'title' => 'Test document',
44
                    'description' => 'My first document.',
45
                ]
46
            ])
47
            ->run();
48
49
        $this->assertObStatus(['inserted' => 3], $res->getData());
50
    }
51
}
52