/**
  * @covers ::__construct
  * @covers ::setStatement
  * @covers ::getStatement
  * @covers ::execute
  *
  * @throws ParserConfigurationException
  * @throws ParserRuntimeException
  */
 public function testValidPrepare()
 {
     $this->adapterInstance->exec('CREATE TABLE IF NOT EXISTS dummy (foo INTEGER)');
     $this->adapterInstance->exec('INSERT INTO dummy VALUES (123),(234),(345)');
     $preparedStatement = $this->adapterInstance->prepare('SELECT COUNT(*) AS cnt FROM dummy WHERE foo >= :value');
     $result = $preparedStatement->execute(['value' => 234]);
     $count = 0;
     if (array_key_exists(0, $result) && array_key_exists('cnt', $result[0])) {
         $count = (int) $result[0]['cnt'];
     }
     static::assertSame(2, $count);
 }
Exemple #2
0
 /**
  * @covers ::__destruct
  *
  * @throws ParserConditionNotSatisfiedException
  * @throws ParserConfigurationException
  * @throws ParserRuntimeException
  */
 public function testDestructor()
 {
     $tempFile = tempnam(sys_get_temp_dir(), 'cb-');
     $adapter = new Pdo($tempFile);
     $adapter->query('SELECT 1');
     unset($adapter);
     @unlink($tempFile);
 }