This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
BuildersAccessTest.php
104 lines (85 loc) · 2.58 KB
/
BuildersAccessTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Spiral, Core Components
*
* @author Wolfy-J
*/
declare(strict_types=1);
namespace Spiral\Database\Tests;
use Spiral\Database\Driver\CompilerInterface;
use Spiral\Database\Driver\Driver;
use Spiral\Database\Query\DeleteQuery;
use Spiral\Database\Query\InsertQuery;
use Spiral\Database\Query\SelectQuery;
use Spiral\Database\Query\UpdateQuery;
use Spiral\Database\Schema\AbstractTable;
use Spiral\Database\Table;
abstract class BuildersAccessTest extends BaseTest
{
public function testDriverAccess(): void
{
$this->assertInstanceOf(Driver::class, $this->db()->getDriver());
}
public function testTableAccess(): void
{
$this->assertInstanceOf(
Table::class,
$this->db()->table('sample')
);
}
public function testTableSchemaAccess(): void
{
$this->assertInstanceOf(
AbstractTable::class,
$this->db()->table('sample')->getSchema()
);
}
public function testTableDatabaseAccess(): void
{
$this->assertEquals(
$this->db(),
$this->db()->table('sample')->getDatabase()
);
}
public function testCompilerAccess(): void
{
$this->assertInstanceOf(
CompilerInterface::class,
$this->db()->getDriver()->getQueryCompiler('')
);
}
//via db
public function testSelectQueryAccess(): void
{
$this->assertInstanceOf(SelectQuery::class, $this->db()->select());
}
public function testInsertQueryAccess(): void
{
$this->assertInstanceOf(InsertQuery::class, $this->db()->insert());
}
public function testUpdateQueryAccess(): void
{
$this->assertInstanceOf(UpdateQuery::class, $this->db()->update());
}
public function testDeleteQueryAccess(): void
{
$this->assertInstanceOf(DeleteQuery::class, $this->db()->delete());
}
//via table
public function testSelectQueryAccessThoughtTable(): void
{
$this->assertInstanceOf(SelectQuery::class, $this->db()->table('sample')->select());
}
public function testSelectQueryAccessThoughtTableIterator(): void
{
$this->assertInstanceOf(SelectQuery::class, $this->db()->table('sample')->getIterator());
}
public function testUpdateQueryAccessThoughtTable(): void
{
$this->assertInstanceOf(UpdateQuery::class, $this->db()->table('sample')->update());
}
public function testDeleteQueryAccessThoughtTable(): void
{
$this->assertInstanceOf(DeleteQuery::class, $this->db()->table('sample')->delete());
}
}