/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @covers \Cougar\PDO\PDO::__construct * @covers \Cougar\PDO\PDO::establishConnection * @covers \Cougar\PDO\PDO::exec * @covers \Cougar\PDO\PDO::prepare * @covers \Cougar\PDO\PDO::commit */ protected function setUp() { # Connect to the database $this->object = new PDO($this->dsn, $this->username, $this->password); # Create the temporary table $this->object->exec("CREATE TEMPORARY TABLE UnitTest (\n RowID int(10) unsigned NOT NULL AUTO_INCREMENT,\n BinaryValue varbinary(12) DEFAULT NULL,\n StringValue varchar(255) DEFAULT NULL,\n IntegerValue int(11) DEFAULT NULL,\n FloatValue double DEFAULT NULL,\n BlobValue mediumblob,\n DateTimeValue datetime DEFAULT NULL,\n LastModified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (RowID))"); # Insert some records $statement = $this->object->prepare("INSERT INTO UnitTest\n (BinaryValue, StringValue, IntegerValue, FloatValue, BlobValue,\n DateTimeValue)\n VALUES(:binaryValue, :stringValue, :integerValue, :floatValue,\n :blobValue, :dateTimeValue)"); foreach ($this->data as $row) { $statement->execute($row); } $this->object->commit(); }