public function testDoDelete()
 {
     try {
         $c = new Criteria();
         $c->setPrimaryTableName(BookPeer::TABLE_NAME);
         $c->add(BookPeer::ID, 12, ' BAD SQL');
         BasePeer::doDelete($c, Propel::getServiceContainer()->getWriteConnection(BookPeer::DATABASE_NAME));
     } catch (RuntimeException $e) {
         $this->assertContains('[DELETE FROM `book` WHERE book.ID BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message');
     }
 }
Beispiel #2
0
 public function testCommentDoDelete()
 {
     $c = new Criteria();
     $c->setComment('Foo');
     $c->add(BookPeer::TITLE, 'War And Peace');
     $con = Propel::getServiceContainer()->getConnection(BookPeer::DATABASE_NAME);
     BasePeer::doDelete($c, $con);
     $expected = 'DELETE /* Foo */ FROM `book` WHERE book.TITLE=\'War And Peace\'';
     $this->assertEquals($expected, $con->getLastExecutedQuery(), 'Criteria::setComment() adds a comment to delete queries');
 }