Test Failed
Push — master ( dee30b...0770f4 )
by Adam
02:27
created

DatabaseTest::testConnectFailure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
4
namespace DBAL\Tests;
5
6
use DBAL\Database;
7
use PHPUnit\Framework\TestCase;
8
use PHPUnit\DbUnit\TestCaseTrait;
9
10
class DatabaseTest extends TestCase{
11
    
12
    use TestCaseTrait;
13
    
14
    public static $db;
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $db. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
15
    CONST HOSTNAME = 'localhost';
16
    CONST DATABASE = 'my_database';
17
    CONST USER = 'my_user';
18
    CONST PASSWORD = 'my_password';
19
    
20
    public function getConnection() {
21
        $pdo = new PDO('mysql:'.self::HOSTNAME, self::USER, self::PASSWORD);
22
        return $this->createDefaultDBConnection($pdo, self::DATABASE);
23
    }
24
    
25
    public function getDataSet(){
26
        $this->getConnection()->createDataSet(['test_table']);
27
    }
28
    /**
29
     * @covers DBAL\Database::__construct
30
     * @covers DBAL\Database::connectToServer
31
     */
32
    public static function setUpBeforeClass(){
33
        self::$db = new Database(self::HOSTNAME, self::USER, self::PASSWORD, self::DATABASE);
34
    }
35
    
36
    /**
37
     * @covers DBAL\Database::__destruct
38
    
39
    public static function tearDownAfterClass(){
40
        self::$db = null;
41
    } */
42
43
    
44
    /**
45
     * @covers DBAL\Database::__construct
46
     * @covers DBAL\Database::connectToServer
47
     */
48
    public function testConnect(){
49
        $this->assertObjectHasAttribute('db', self::$db);
50
    }
51
    
52
    /**
53
     * @covers DBAL\Database
54
     */
55
    public function testConnectFailure(){
56
        $this->assertFalse(false);
57
    }
58
    
59
    /**
60
     * @covers DBAL\Database::query
61
     */
62
    public function testQuery(){
63
        $query = self::$db->query("SELECT * FROM `test_table` WHERE `id` = ?", array(1));
64
        $this->assertArrayHasKey('0', $query);
65
        $this->assertCount(1, $query);
66
    }
67
    
68
    /**
69
     * @covers DBAL\Database::select
70
     * @covers DBAL\Database::buildSelectQuery
71
     * @covers DBAL\Database::where
72
     * @covers DBAL\Database::orderBy
73
     * @covers DBAL\Database::limit
74
     * @covers DBAL\Database::executeQuery
75
     */
76
    public function testSelect(){
77
        $simpleSelect = self::$db->select('test_table', array('id' => array('>', 1)), '*', array('id' => 'ASC'));
78
        $this->assertArrayHasKey('name', $simpleSelect);
79
    }
80
    
81
    /**
82
     * @covers DBAL\Database::selectAll
83
     * @covers DBAL\Database::buildSelectQuery
84
     * @covers DBAL\Database::where
85
     * @covers DBAL\Database::orderBy
86
     * @covers DBAL\Database::limit
87
     * @covers DBAL\Database::executeQuery
88
     */
89
    public function testSelectAll(){
90
        $this->assertFalse(false);
91
    }
92
    
93
    /**
94
     * @covers DBAL\Database::select
95
     * @covers DBAL\Database::selectAll
96
     * @covers DBAL\Database::buildSelectQuery
97
     * @covers DBAL\Database::where
98
     * @covers DBAL\Database::orderBy
99
     * @covers DBAL\Database::limit
100
     * @covers DBAL\Database::executeQuery
101
     */
102
    public function testSelectFailure(){
103
        $this->assertFalse(false);
104
    }
105
    
106
    /**
107
     * @covers DBAL\Database::insert
108
     * @covers DBAL\Database::fields
109
     * @covers DBAL\Database::executeQuery
110
     * @covers DBAL\Database::numRows
111
     */
112
    public function testInsert(){
113
        $this->assertFalse(false);
114
    }
115
    
116
    /**
117
     * @covers DBAL\Database::insert
118
     * @covers DBAL\Database::fields
119
     * @covers DBAL\Database::executeQuery
120
     * @covers DBAL\Database::numRows
121
     */
122
    public function tsetInsertFailure(){
123
        $this->assertFalse(false);
124
    }
125
    
126
    /**
127
     * @covers DBAL\Database::update
128
     * @covers DBAL\Database::fields
129
     * @covers DBAL\Database::where
130
     * @covers DBAL\Database::limit
131
     * @covers DBAL\Database::executeQuery
132
     * @covers DBAL\Database::numRows
133
     */
134
    public function testUpdate(){
135
        $this->assertFalse(false);
136
    }
137
    
138
    /**
139
     * @covers DBAL\Database::update
140
     * @covers DBAL\Database::fields
141
     * @covers DBAL\Database::where
142
     * @covers DBAL\Database::limit
143
     * @covers DBAL\Database::executeQuery
144
     * @covers DBAL\Database::numRows
145
     */
146
    public function testUpdateFailure(){
147
        $this->assertFalse(false);
148
    }
149
    
150
    /**
151
     * @covers DBAL\Database::delete
152
     * @covers DBAL\Database::where
153
     * @covers DBAL\Database::limit
154
     * @covers DBAL\Database::executeQuery
155
     * @covers DBAL\Database::numRows
156
     */
157
    public function testDelete(){
158
        $this->assertFalse(false);
159
    }
160
    
161
    /**
162
     * @covers DBAL\Database::delete
163
     * @covers DBAL\Database::where
164
     * @covers DBAL\Database::limit
165
     * @covers DBAL\Database::executeQuery
166
     * @covers DBAL\Database::numRows
167
     */
168
    public function testDeleteFailure(){
169
        $this->assertFalse(false);
170
    }
171
    
172
    /**
173
     * @covers DBAL\Database::count
174
     * @covers DBAL\Database::where
175
     * @covers DBAL\Database::executeQuery
176
     */
177
    public function testCount(){
178
        $this->assertFalse(false);
179
    }
180
    
181
    /**
182
     * @covers DBAL\Database::fulltextIndex
183
     */
184
    public function testFulltextIndex(){
185
        $this->assertFalse(false);
186
    }
187
    
188
    /**
189
     * @covers DBAL\Database::numRows
190
     * @covers DBAL\Database::rowCount
191
     */
192
    public function testNumRows(){
193
        $this->assertFalse(false);
194
    }
195
    
196
    /**
197
     * @covers DBAL\Database::lastInsertId
198
     */
199
    public function testLastInsertID(){
200
        $this->assertFalse(false);
201
    }
202
    
203
    /**
204
     * @covers DBAL|Database::setCaching
205
     */
206
    public function testCaching(){
207
        $this->assertFalse(false);
208
    }
209
}
210