/** * @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); }
/** * @covers ::prepare * @covers ::exec * * @throws ParserConfigurationException * @throws ParserRuntimeException */ public function testValidPrepare() { $this->adapterInstance->exec('CREATE TABLE IF NOT EXISTS dummy (foo TEXT)'); $result = $this->adapterInstance->prepare('SELECT COUNT(*) AS cnt FROM dummy WHERE foo = :value'); static::assertInstanceOf('\\Crossjoin\\Browscap\\Parser\\Sqlite\\Adapter\\PdoPreparedStatement', $result); }