/** * @covers Fobia\DataBase\Query\QueryReplace::getQuery * @todo Implement testGetQuery(). */ public function testGetQuery() { $q = $this->db->createReplaceQuery(); $str = "REPLACE INTO user ( Host, User, Password ) VALUES ( 'localhost', 'test', '' )"; $q->insertInto('user')->set('Host', $this->db->quote('localhost'))->set('User', $this->db->quote('test'))->set('Password', $this->db->quote('')); $this->assertEquals($str, $q->getQuery()); }
/** * @covers Fobia\DataBase\Query\QueryInsert::getQuery * @todo Implement testGetQuery(). */ public function testGetQuery() { $q = $this->db->createInsertQuery(); $str = "INSERT INTO user ( Host, User, Password ) VALUES ( 'localhost', 'test', '' )"; $q->set('Host', $this->db->quote('localhost'))->set('User', $this->db->quote('test'))->set('Password', $this->db->quote('')); $qi = clone $q; $q->insertInto('user'); $qi->insertIntoIgnore('user'); $this->assertEquals($str, $q->getQuery()); $this->assertRegExp('/^INSERT IGNORE /', $qi->getQuery()); }
/** * @covers Fobia\DataBase\Query\QueryUpdate::getQuery * @todo Implement testGetQuery(). */ public function testGetQuery() { $q = $this->q; $q->update('test')->orderBy('test')->limit(1)->set('id', $this->db->quote(2))->where($q->expr->eq('id', $this->db->quote(1))); $this->assertEquals("UPDATE test SET id = '2' WHERE id = '1' ORDER BY test LIMIT 1", $q->getQuery()); }