protected function setUp() { $this->connection = new Connection('sqlite::memory:'); $this->connection->query('CREATE TABLE users (id INT PRIMARY KEY, username CHAR(50), age INT, registered DATE, spend_time TIME)'); $this->insertStatement = $this->connection->prepare('INSERT INTO users (username, age, registered, spend_time) VALUES(s:username, i:age, d:date, t:time)'); $this->selectStatement = $this->connection->prepare('SELECT * FROM users'); }
public function testParserSkipRepeatedTypes() { $stmt = $this->connection->prepare('SELECT * FROM users WHERE sex = b:sex OR (username = "******" AND sex = :sex)'); $this->assertAttributeSame(['sex', 'sex'], 'placeholders', $stmt); $this->assertAttributeSame(['sex' => \PDO::PARAM_BOOL], 'types', $stmt); }