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