Skip to content
This repository was archived by the owner on Nov 26, 2022. It is now read-only.

Commit 0c40d7b

Browse files
author
Daniel Opitz
committed
Reformat code
1 parent 0f64c16 commit 0c40d7b

5 files changed

Lines changed: 121 additions & 122 deletions

File tree

tests/RawExpTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class RawExpTest extends BaseTest
1111
{
1212
/**
13-
* Test
13+
* Test.
1414
*
1515
* @covers ::getValue
1616
*/
@@ -21,7 +21,7 @@ public function testGetValue()
2121
}
2222

2323
/**
24-
* Test
24+
* Test.
2525
*
2626
* @covers ::__toString
2727
*/
@@ -32,7 +32,7 @@ public function testToString()
3232
}
3333

3434
/**
35-
* Test
35+
* Test.
3636
*
3737
* @covers ::getValue
3838
*/
@@ -51,7 +51,7 @@ public function testColumnsRaw()
5151
}
5252

5353
/**
54-
* Test
54+
* Test.
5555
*
5656
* @covers ::getValue
5757
*/

tests/SchemaTest.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testInstance()
2222
}
2323

2424
/**
25-
* Test setDbName method
25+
* Test setDbName method.
2626
*
2727
* @return void
2828
* @covers ::setDatabase
@@ -53,7 +53,7 @@ public function testSetDbName()
5353
}
5454

5555
/**
56-
* Test getTables method
56+
* Test getTables method.
5757
*
5858
* @return void
5959
* @covers ::getTables
@@ -128,10 +128,10 @@ public function testTables()
128128
$this->assertSame(false, $result);
129129

130130
$tables = $schema->getTables();
131-
$this->assertSame(array(0 => 'test'), $tables);
131+
$this->assertSame([0 => 'test'], $tables);
132132

133133
$tables = $schema->getTables('te%');
134-
$this->assertSame(array(0 => 'test'), $tables);
134+
$this->assertSame([0 => 'test'], $tables);
135135

136136
$columns = $schema->getColumns('test');
137137
$this->assertSame(true, !empty($columns));
@@ -145,28 +145,28 @@ public function testTables()
145145
$this->assertSame(true, !empty($columns));
146146
$this->assertSame(10, count($columns));
147147

148-
$insert = $this->getConnection()->insert()->into('test')->set(array(
148+
$insert = $this->getConnection()->insert()->into('test')->set([
149149
'keyname' => 'test',
150-
'keyvalue' => '123'
151-
));
150+
'keyvalue' => '123',
151+
]);
152152
$stmt = $insert->prepare();
153153
$stmt->execute();
154154
$this->assertTrue($stmt->rowCount() > 0);
155155

156156
// With ON DUPLICATE KEY UPDATE, the affected-rows value per row
157157
// is 1 if the row is inserted as a new row, and 2 if an existing row is updated.
158158
// http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
159-
$insert = $db->insert()->into('test')->set(array(
159+
$insert = $db->insert()->into('test')->set([
160160
'id' => 1,
161161
'keyname' => 'test',
162162
'keyvalue' => '123',
163-
'boolvalue' => 1
164-
))->onDuplicateKeyUpdate(array(
163+
'boolvalue' => 1,
164+
])->onDuplicateKeyUpdate([
165165
'id' => 1,
166166
'keyname' => 'testx',
167167
'keyvalue' => '123',
168-
'boolvalue' => 1
169-
));
168+
'boolvalue' => 1,
169+
]);
170170
$stmt = $insert->prepare();
171171
$stmt->execute();
172172
$result = $stmt->rowCount();
@@ -175,81 +175,81 @@ public function testTables()
175175
$result = $db->lastInsertId();
176176
$this->assertSame('1', $result);
177177

178-
$result = $db->query("SELECT COUNT(*) AS count FROM `test`")->fetchAll(PDO::FETCH_ASSOC);
179-
$this->assertSame(array(0 => array('count' => '1')), $result);
178+
$result = $db->query('SELECT COUNT(*) AS count FROM `test`')->fetchAll(PDO::FETCH_ASSOC);
179+
$this->assertSame([0 => ['count' => '1']], $result);
180180

181-
$result = $db->queryValue("SELECT COUNT(*) AS count FROM `test`", 'count');
181+
$result = $db->queryValue('SELECT COUNT(*) AS count FROM `test`', 'count');
182182
$this->assertSame('1', $result);
183183

184-
$result = $db->queryValue("SELECT * FROM `test` WHERE id = 9999999;", 'id');
184+
$result = $db->queryValue('SELECT * FROM `test` WHERE id = 9999999;', 'id');
185185
$this->assertSame(null, $result);
186186

187-
$rows = array(
188-
0 => array('keyname' => 'test', 'keyvalue' => '123'),
189-
1 => array('keyname' => 'test2', 'keyvalue' => '1234')
190-
);
187+
$rows = [
188+
0 => ['keyname' => 'test', 'keyvalue' => '123'],
189+
1 => ['keyname' => 'test2', 'keyvalue' => '1234'],
190+
];
191191
$result = $db->insert()->into('test')->set($rows)->prepare();
192192
$result->execute();
193193
$this->assertSame(2, $result->rowCount());
194194

195195
$result = $db->lastInsertId();
196196
$this->assertSame('2', $result);
197197

198-
$result = $db->queryValue("SELECT COUNT(*) AS count FROM `test`", 'count');
198+
$result = $db->queryValue('SELECT COUNT(*) AS count FROM `test`', 'count');
199199
$this->assertSame('3', $result);
200200

201201
$result = $schema->truncateTable('test');
202202
$this->assertSame(0, $result);
203203

204-
$result = $db->queryValue("SELECT COUNT(*) AS count FROM `test`", 'count');
204+
$result = $db->queryValue('SELECT COUNT(*) AS count FROM `test`', 'count');
205205
$this->assertSame('0', $result);
206206

207207
$result = $db->insert()->into('test')->set($rows)->prepare();
208208
$result->execute();
209209
$this->assertSame(2, $result->rowCount());
210210

211-
$result = $db->queryValues("SELECT id,keyvalue FROM `test`", 'keyvalue');
212-
$this->assertSame(array('123', '1234'), $result);
211+
$result = $db->queryValues('SELECT id,keyvalue FROM `test`', 'keyvalue');
212+
$this->assertSame(['123', '1234'], $result);
213213

214-
$result = $db->queryMapColumn("SELECT id,keyname,keyvalue FROM `test`", 'keyname');
215-
$expected = array(
216-
'test' => array(
214+
$result = $db->queryMapColumn('SELECT id,keyname,keyvalue FROM `test`', 'keyname');
215+
$expected = [
216+
'test' => [
217217
'id' => '1',
218218
'keyname' => 'test',
219219
'keyvalue' => '123',
220-
),
221-
'test2' => array(
220+
],
221+
'test2' => [
222222
'id' => '2',
223223
'keyname' => 'test2',
224224
'keyvalue' => '1234',
225-
),
226-
);
225+
],
226+
];
227227
$this->assertSame($expected, $result);
228228

229229
$result = $schema->clearTable('test');
230230
$this->assertSame(2, $result);
231231

232-
$result = $db->queryValue("SELECT COUNT(*) AS count FROM `test`", 'count');
232+
$result = $db->queryValue('SELECT COUNT(*) AS count FROM `test`', 'count');
233233
$this->assertSame('0', $result);
234234

235235
$result = $db->queryValue("SHOW TABLE STATUS FROM `database_test` LIKE 'test'; ", 'Auto_increment');
236236
$this->assertSame('3', $result);
237237

238-
$rows = array();
238+
$rows = [];
239239
for ($i = 0; $i < 100; $i++) {
240-
$rows[] = array('keyname' => 'test', 'keyvalue' => 'value-' . $i);
240+
$rows[] = ['keyname' => 'test', 'keyvalue' => 'value-' . $i];
241241
}
242242
$result = $db->insert()->into('test')->set($rows)->prepare();
243243
$result->execute();
244244
$this->assertSame(100, $result->rowCount());
245245

246-
$result = $db->query("SELECT keyname,keyvalue FROM test;")->fetchAll(PDO::FETCH_ASSOC);
246+
$result = $db->query('SELECT keyname,keyvalue FROM test;')->fetchAll(PDO::FETCH_ASSOC);
247247
$this->assertSame(true, $rows == $result);
248248

249-
$fields = array(
249+
$fields = [
250250
'keyname' => 'test-new',
251-
'keyvalue' => 'value-new'
252-
);
251+
'keyvalue' => 'value-new',
252+
];
253253
$stmt = $db->update()->table('test')->set($fields)->where('keyname', '=', 'test')->prepare();
254254
$stmt->execute();
255255
$this->assertSame(100, $stmt->rowCount());
@@ -287,7 +287,7 @@ public function testTables()
287287
}
288288

289289
/**
290-
* Test getTables method
290+
* Test getTables method.
291291
*
292292
* @return void
293293
* @covers ::getColumnNames

0 commit comments

Comments
 (0)