Example #1
0
 /**
  * @covers PitchBlade\Storage\Database\PDOStatement::__construct
  * @covers PitchBlade\Storage\Database\PDOStatement::execute
  */
 public function testExecuteWithParams($bound_input_params = null)
 {
     $dbConnection = new PDO($this->dsn, $this->username, $this->password, $this->driverOptions, $this->getMock('\\PitchBlade\\Logging\\Timeable'));
     $stmt = $dbConnection->prepare("INSERT INTO test_table (name) VALUES (:name)");
     $this->assertTrue($stmt->execute(['name' => 'withparams']));
     $stmt = $dbConnection->query('SELECT count(*) FROM test_table');
     $this->assertSame('1', $stmt->fetch()->count);
 }
Example #2
0
 /**
  * Commits a transaction
  *
  * @return boolean True on success
  */
 public function commit()
 {
     $logId = $this->logger->start();
     $result = parent::commit();
     $this->logger->end($logId, 'PDO::commit', null);
     return $result;
 }