Exemplo n.º 1
0
 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');
 }
Exemplo n.º 2
0
 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);
 }