Passed
Push — master ( 9e6879...fd4e7d )
by Timon
03:32
created

DatabaseTest::assertObStatus()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
c 0
b 0
f 0
rs 9.3142
cc 3
eloc 12
nc 4
nop 2
1
<?php
2
declare(strict_types=1);
3
4
namespace TBolier\RethinkConnect\Test\Connection;
5
6
use ArrayObject;
7
use TBolier\RethinkQL\IntegrationTest\BaseTestCase;
8
9
class DatabaseTest extends BaseTestCase
10
{
11
    /**
12
     * @throws \Exception
13
     */
14
    public function testTableList()
15
    {
16
        $res = $this->r()
17
            ->db()
18
            ->tableList()
19
            ->run();
20
21
        $this->assertInternalType('array', $res->getData());
22
    }
23
24
    /**
25
     * @throws \Exception
26
     */
27
    public function testCreateTable()
28
    {
29
        $res = $this->r()
30
            ->db()
31
            ->tableCreate('createtable')
32
            ->run();
33
34
        $this->assertObStatus(['tables_created' => 1], $res->getData());
35
    }
36
37
    /**
38
     * @throws \Exception
39
     */
40
    public function testDropTable()
41
    {
42
        $this->r()
43
            ->db()
44
            ->tableCreate('createtable')
45
            ->run();
46
47
        $res = $this->r()
48
            ->db()
49
            ->tableDrop('createtable')
50
            ->run();
51
52
        $this->assertObStatus(['tables_dropped' => 1], $res->getData());
53
    }
54
}
55