|
@@ -145,7 +145,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |