Example #1
0
 /**
  * @covers \Cougar\PDO\PDO::exec
  * @covers \Cougar\PDO\PDO::lastInsertId
  * @covers \Cougar\PDO\PDO::queryFetchRow
  * @covers \Cougar\PDO\PDO::rollBack
  * @covers \Cougar\PDO\PDO::establishConnection
  */
 public function testRollBack()
 {
     # Insert a record
     $date = date("Y-m-d H:i:s");
     $rows = $this->object->exec("INSERT INTO UnitTest\n            (BinaryValue, StringValue, IntegerValue, FloatValue, BlobValue,\n                DateTimeValue)\n            VALUES(:binaryValue, :stringValue, :integerValue, :floatValue,\n                :blobValue, :dateTimeValue)", array("binaryValue" => "Binary", "stringValue" => "String Value", "integerValue" => 15, "floatValue" => 15.15, "blobValue" => str_repeat("Xx", 10000), "dateTimeValue" => $date));
     $this->assertEquals(1, $rows);
     $row_id = $this->object->lastInsertId();
     # Roll back
     $this->object->rollBack();
     $row = $this->object->queryFetchRow("SELECT * FROM UnitTest\n            WHERE RowID = :row_id", array("row_id" => $row_id));
     $this->assertCount(0, $row);
 }