@@ -83,12 +83,10 @@ discard block |
||
83 | 83 | |
84 | 84 | try { |
85 | 85 | $conn->disconnect(); |
86 | - } |
|
87 | - catch (\Exception $e) |
|
86 | + } catch (\Exception $e) |
|
88 | 87 | { |
89 | 88 | $errorObject = ($e instanceof \LogicException); |
90 | - } |
|
91 | - finally |
|
89 | + } finally |
|
92 | 90 | { |
93 | 91 | $this->assertNotTrue($conn->isConnected()); |
94 | 92 | $this->assertTrue($errorObject, $e->getMessage()); |
@@ -124,12 +122,10 @@ discard block |
||
124 | 122 | |
125 | 123 | try { |
126 | 124 | $conn->reconnect(); |
127 | - } |
|
128 | - catch (\Exception $e) |
|
125 | + } catch (\Exception $e) |
|
129 | 126 | { |
130 | 127 | $errorObject = ($e instanceof \LogicException); |
131 | - } |
|
132 | - finally |
|
128 | + } finally |
|
133 | 129 | { |
134 | 130 | $this->assertTrue($errorObject, $e->getMessage()); |
135 | 131 | $this->assertNotTrue($conn->isConnected()); |
@@ -154,13 +150,11 @@ discard block |
||
154 | 150 | |
155 | 151 | try { |
156 | 152 | $mysqliObject = $conn->connect(); |
157 | - } |
|
158 | - catch (\Exception $e) |
|
153 | + } catch (\Exception $e) |
|
159 | 154 | { |
160 | 155 | $errorObject = ($e instanceof ConnectionException); |
161 | 156 | $message = $e->getMessage(); |
162 | - } |
|
163 | - finally |
|
157 | + } finally |
|
164 | 158 | { |
165 | 159 | $this->assertTrue($errorObject, $message); |
166 | 160 | $this->assertNotTrue($conn->isConnected()); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function testCannotStablishConnection() |
145 | 145 | { |
146 | 146 | $options = $this->options; |
147 | - $options["dbhost"] = 'myserver'; // this server does not exists |
|
147 | + $options["dbhost"] = 'myserver'; // this server does not exists |
|
148 | 148 | |
149 | 149 | $conn = new MySQL($options); |
150 | 150 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->assertEquals(2, $conn->getNumFields()); |
241 | 241 | $this->assertEquals(0, $conn->getRowsAffected()); |
242 | 242 | |
243 | - $rowset = $conn->getArrayResult(); # array with results |
|
243 | + $rowset = $conn->getArrayResult(); # array with results |
|
244 | 244 | $row = array_shift($rowset); |
245 | 245 | |
246 | 246 | $this->assertArrayHasKey("ID", $row); |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | $result = $conn->execute($sql); |
268 | 268 | $rowcount = count($conn->getArrayResult()); |
269 | 269 | |
270 | - $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
270 | + $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
271 | 271 | |
272 | 272 | # properties modified by execute() method |
273 | 273 | $this->assertEquals(1, $conn->getNumRows()); |
274 | 274 | $this->assertEquals(2, $conn->getNumFields()); |
275 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
275 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
276 | 276 | |
277 | 277 | $this->assertTrue($conn->commit()); |
278 | 278 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $result = $conn->execute($sql); |
282 | 282 | $rowcount = count($conn->getArrayResult()); |
283 | 283 | |
284 | - $this->assertTrue(($rowcount === 1)); # the row is available |
|
284 | + $this->assertTrue(($rowcount === 1)); # the row is available |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | $result = $conn->execute($sql); |
305 | 305 | $rowcount = count($conn->getArrayResult()); |
306 | 306 | |
307 | - $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
307 | + $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
308 | 308 | |
309 | 309 | # properties modified by execute() method |
310 | 310 | $this->assertEquals(1, $conn->getNumRows()); |
311 | 311 | $this->assertEquals(2, $conn->getNumFields()); |
312 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
312 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
313 | 313 | |
314 | 314 | $this->assertTrue($conn->rollback()); |
315 | 315 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $result = $conn->execute($sql); |
319 | 319 | $rowcount = count($conn->getArrayResult()); |
320 | 320 | |
321 | - $this->assertNotTrue(($rowcount === 1)); # the row is not available |
|
321 | + $this->assertNotTrue(($rowcount === 1)); # the row is not available |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -350,12 +350,12 @@ discard block |
||
350 | 350 | $result = $conn->execute($sql); |
351 | 351 | $rowcount = count($conn->getArrayResult()); |
352 | 352 | |
353 | - $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
353 | + $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
354 | 354 | |
355 | 355 | # properties modified by execute() method |
356 | 356 | $this->assertEquals(4, $conn->getNumRows()); |
357 | 357 | $this->assertEquals(2, $conn->getNumFields()); |
358 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
358 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
359 | 359 | |
360 | 360 | $this->assertTrue($conn->commit()); |
361 | 361 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $result = $conn->execute($sql); |
365 | 365 | $rowcount = count($conn->getArrayResult()); |
366 | 366 | |
367 | - $this->assertTrue(($rowcount === 4)); # the row is available |
|
367 | + $this->assertTrue(($rowcount === 4)); # the row is available |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -396,12 +396,12 @@ discard block |
||
396 | 396 | $result = $conn->execute($sql); |
397 | 397 | $rowcount = count($conn->getArrayResult()); |
398 | 398 | |
399 | - $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
399 | + $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
400 | 400 | |
401 | 401 | # properties modified by execute() method |
402 | 402 | $this->assertEquals(4, $conn->getNumRows()); |
403 | 403 | $this->assertEquals(2, $conn->getNumFields()); |
404 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
404 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
405 | 405 | |
406 | 406 | $this->assertTrue($conn->rollback()); |
407 | 407 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $result = $conn->execute($sql); |
411 | 411 | $rowcount = count($conn->getArrayResult()); |
412 | 412 | |
413 | - $this->assertNotTrue(($rowcount === 4)); # the row is available |
|
413 | + $this->assertNotTrue(($rowcount === 4)); # the row is available |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -441,12 +441,12 @@ discard block |
||
441 | 441 | $result = $conn->execute($sql); |
442 | 442 | $rowcount = count($conn->getArrayResult()); |
443 | 443 | |
444 | - $this->assertTrue(($rowcount === 2)); # the rows are available for now |
|
444 | + $this->assertTrue(($rowcount === 2)); # the rows are available for now |
|
445 | 445 | |
446 | 446 | # properties modified by execute() method |
447 | 447 | $this->assertEquals(2, $conn->getNumRows()); |
448 | 448 | $this->assertEquals(2, $conn->getNumFields()); |
449 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
449 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
450 | 450 | |
451 | 451 | # ends the transaction |
452 | 452 | $conn->endTransaction(); |
@@ -456,6 +456,6 @@ discard block |
||
456 | 456 | $result = $conn->execute($sql); |
457 | 457 | $rowcount = count($conn->getArrayResult()); |
458 | 458 | |
459 | - $this->assertTrue(($rowcount === 2)); # the row is available |
|
459 | + $this->assertTrue(($rowcount === 2)); # the row is available |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | \ No newline at end of file |