@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | try |
241 | 241 | { |
242 | 242 | $sql = "INSERT INTO MYTABLE (DESCRIPTION, WRONG) VALUES ('Hello world!')"; |
243 | - $result = $conn->execute($sql); |
|
243 | + $result = $conn->execute($sql); |
|
244 | 244 | } |
245 | 245 | catch (\Exception $e) |
246 | 246 | { |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | |
512 | 512 | try |
513 | 513 | { |
514 | - $sql = "INSERT INTO MYTABLE (DESCRIPTION) VALUES ('TRANS_SHORTCUT_1')"; |
|
515 | - $result = $conn->execute($sql); |
|
514 | + $sql = "INSERT INTO MYTABLE (DESCRIPTION) VALUES ('TRANS_SHORTCUT_1')"; |
|
515 | + $result = $conn->execute($sql); |
|
516 | 516 | |
517 | - $sql = "INSERT INTO MYTABLE (DESCRIPTION, WRONG) VALUES ('TRANS_SHORTCUT_2')"; |
|
518 | - $result = $conn->execute($sql); |
|
517 | + $sql = "INSERT INTO MYTABLE (DESCRIPTION, WRONG) VALUES ('TRANS_SHORTCUT_2')"; |
|
518 | + $result = $conn->execute($sql); |
|
519 | 519 | } |
520 | 520 | catch (InvalidQueryException $e) |
521 | 521 | { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public function testCannotStablishConnection() |
146 | 146 | { |
147 | 147 | $options = $this->options; |
148 | - $options["dbhost"] = 'myserver'; // this server does not exists |
|
148 | + $options["dbhost"] = 'myserver'; // this server does not exists |
|
149 | 149 | |
150 | 150 | $conn = new MySQL($options); |
151 | 151 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $this->assertEquals(2, $conn->getNumFields()); |
273 | 273 | $this->assertEquals(0, $conn->getRowsAffected()); |
274 | 274 | |
275 | - $rowset = $conn->getArrayResult(); # array with results |
|
275 | + $rowset = $conn->getArrayResult(); # array with results |
|
276 | 276 | $row = array_shift($rowset); |
277 | 277 | |
278 | 278 | $this->assertArrayHasKey("ID", $row); |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | $result = $conn->execute($sql); |
300 | 300 | $rowcount = count($conn->getArrayResult()); |
301 | 301 | |
302 | - $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
302 | + $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
303 | 303 | |
304 | 304 | # properties modified by execute() method |
305 | 305 | $this->assertEquals(1, $conn->getNumRows()); |
306 | 306 | $this->assertEquals(2, $conn->getNumFields()); |
307 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
307 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
308 | 308 | |
309 | 309 | $this->assertTrue($conn->commit()); |
310 | 310 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $result = $conn->execute($sql); |
314 | 314 | $rowcount = count($conn->getArrayResult()); |
315 | 315 | |
316 | - $this->assertTrue(($rowcount === 1)); # the row is available |
|
316 | + $this->assertTrue(($rowcount === 1)); # the row is available |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -336,12 +336,12 @@ discard block |
||
336 | 336 | $result = $conn->execute($sql); |
337 | 337 | $rowcount = count($conn->getArrayResult()); |
338 | 338 | |
339 | - $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
339 | + $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
340 | 340 | |
341 | 341 | # properties modified by execute() method |
342 | 342 | $this->assertEquals(1, $conn->getNumRows()); |
343 | 343 | $this->assertEquals(2, $conn->getNumFields()); |
344 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
344 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
345 | 345 | |
346 | 346 | $this->assertTrue($conn->rollback()); |
347 | 347 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $result = $conn->execute($sql); |
351 | 351 | $rowcount = count($conn->getArrayResult()); |
352 | 352 | |
353 | - $this->assertNotTrue(($rowcount === 1)); # the row is not available |
|
353 | + $this->assertNotTrue(($rowcount === 1)); # the row is not available |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -382,12 +382,12 @@ discard block |
||
382 | 382 | $result = $conn->execute($sql); |
383 | 383 | $rowcount = count($conn->getArrayResult()); |
384 | 384 | |
385 | - $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
385 | + $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
386 | 386 | |
387 | 387 | # properties modified by execute() method |
388 | 388 | $this->assertEquals(4, $conn->getNumRows()); |
389 | 389 | $this->assertEquals(2, $conn->getNumFields()); |
390 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
390 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
391 | 391 | |
392 | 392 | $this->assertTrue($conn->commit()); |
393 | 393 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $result = $conn->execute($sql); |
397 | 397 | $rowcount = count($conn->getArrayResult()); |
398 | 398 | |
399 | - $this->assertTrue(($rowcount === 4)); # the row is available |
|
399 | + $this->assertTrue(($rowcount === 4)); # the row is available |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -428,12 +428,12 @@ discard block |
||
428 | 428 | $result = $conn->execute($sql); |
429 | 429 | $rowcount = count($conn->getArrayResult()); |
430 | 430 | |
431 | - $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
431 | + $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
432 | 432 | |
433 | 433 | # properties modified by execute() method |
434 | 434 | $this->assertEquals(4, $conn->getNumRows()); |
435 | 435 | $this->assertEquals(2, $conn->getNumFields()); |
436 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
436 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
437 | 437 | |
438 | 438 | $this->assertTrue($conn->rollback()); |
439 | 439 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $result = $conn->execute($sql); |
443 | 443 | $rowcount = count($conn->getArrayResult()); |
444 | 444 | |
445 | - $this->assertNotTrue(($rowcount === 4)); # the row is available |
|
445 | + $this->assertNotTrue(($rowcount === 4)); # the row is available |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
@@ -473,12 +473,12 @@ discard block |
||
473 | 473 | $result = $conn->execute($sql); |
474 | 474 | $rowcount = count($conn->getArrayResult()); |
475 | 475 | |
476 | - $this->assertTrue(($rowcount === 2)); # the rows are available for now |
|
476 | + $this->assertTrue(($rowcount === 2)); # the rows are available for now |
|
477 | 477 | |
478 | 478 | # properties modified by execute() method |
479 | 479 | $this->assertEquals(2, $conn->getNumRows()); |
480 | 480 | $this->assertEquals(2, $conn->getNumFields()); |
481 | - $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
481 | + $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
482 | 482 | |
483 | 483 | # ends the transaction |
484 | 484 | $conn->endTransaction(); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $result = $conn->execute($sql); |
489 | 489 | $rowcount = count($conn->getArrayResult()); |
490 | 490 | |
491 | - $this->assertTrue(($rowcount === 2)); # the row is available |
|
491 | + $this->assertTrue(($rowcount === 2)); # the row is available |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | /** |
@@ -532,6 +532,6 @@ discard block |
||
532 | 532 | $result = $conn->execute($sql); |
533 | 533 | $rowcount = count($conn->getArrayResult()); |
534 | 534 | |
535 | - $this->assertNotTrue(($rowcount === 0)); # the rows are not available |
|
535 | + $this->assertNotTrue(($rowcount === 0)); # the rows are not available |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | \ No newline at end of file |
@@ -84,12 +84,10 @@ discard block |
||
84 | 84 | |
85 | 85 | try { |
86 | 86 | $conn->disconnect(); |
87 | - } |
|
88 | - catch (\Exception $e) |
|
87 | + } catch (\Exception $e) |
|
89 | 88 | { |
90 | 89 | $errorObject = ($e instanceof \LogicException); |
91 | - } |
|
92 | - finally |
|
90 | + } finally |
|
93 | 91 | { |
94 | 92 | $this->assertNotTrue($conn->isConnected()); |
95 | 93 | $this->assertTrue($errorObject, $e->getMessage()); |
@@ -125,12 +123,10 @@ discard block |
||
125 | 123 | |
126 | 124 | try { |
127 | 125 | $conn->reconnect(); |
128 | - } |
|
129 | - catch (\Exception $e) |
|
126 | + } catch (\Exception $e) |
|
130 | 127 | { |
131 | 128 | $errorObject = ($e instanceof \LogicException); |
132 | - } |
|
133 | - finally |
|
129 | + } finally |
|
134 | 130 | { |
135 | 131 | $this->assertTrue($errorObject, $e->getMessage()); |
136 | 132 | $this->assertNotTrue($conn->isConnected()); |
@@ -155,13 +151,11 @@ discard block |
||
155 | 151 | |
156 | 152 | try { |
157 | 153 | $mysqliObject = $conn->connect(); |
158 | - } |
|
159 | - catch (\Exception $e) |
|
154 | + } catch (\Exception $e) |
|
160 | 155 | { |
161 | 156 | $errorObject = ($e instanceof ConnectionException); |
162 | 157 | $message = $e->getMessage(); |
163 | - } |
|
164 | - finally |
|
158 | + } finally |
|
165 | 159 | { |
166 | 160 | $this->assertTrue($errorObject, $message); |
167 | 161 | $this->assertNotTrue($conn->isConnected()); |
@@ -241,13 +235,11 @@ discard block |
||
241 | 235 | { |
242 | 236 | $sql = "INSERT INTO MYTABLE (DESCRIPTION, WRONG) VALUES ('Hello world!')"; |
243 | 237 | $result = $conn->execute($sql); |
244 | - } |
|
245 | - catch (\Exception $e) |
|
238 | + } catch (\Exception $e) |
|
246 | 239 | { |
247 | 240 | $errorObject = ($e instanceof InvalidQueryException); |
248 | 241 | $message = $e->getMessage(); |
249 | - } |
|
250 | - finally |
|
242 | + } finally |
|
251 | 243 | { |
252 | 244 | $this->assertTrue($errorObject, $message); |
253 | 245 | } |
@@ -516,8 +508,7 @@ discard block |
||
516 | 508 | |
517 | 509 | $sql = "INSERT INTO MYTABLE (DESCRIPTION, WRONG) VALUES ('TRANS_SHORTCUT_2')"; |
518 | 510 | $result = $conn->execute($sql); |
519 | - } |
|
520 | - catch (InvalidQueryException $e) |
|
511 | + } catch (InvalidQueryException $e) |
|
521 | 512 | { |
522 | 513 | $message = $e->getMessage(); |
523 | 514 | #·not necessary! |