コード例 #1
0
 public function testSelectComWheresComOrEAnd()
 {
     $select = new Select();
     $where = new Where();
     $where->set('id', '=', 1);
     $where->set('last_name', '=', 1, 'or');
     $where->set('name', '=', 'Erik', 'or');
     $select->table = 'pages';
     $select->where($where);
     $sql = $select->sql();
     $this->assertEquals('SELECT * FROM pages WHERE `id`=:id and `last_name`=:last_name or `name`=:name;', $sql);
 }
コード例 #2
0
 public function testChecarSeOSqlRetornaCorretoComWhere()
 {
     $update = new Update();
     $where = new Where();
     $where->set('id', '=', 1);
     $update->where($where);
     $fields = ['name' => 'Erik'];
     $update->fields($fields);
     $sql = $update->sql();
     $this->assertEquals('UPDATE `users` SET `name`=:name WHERE `id`=:id;', $sql);
 }