public function testComment() { $c = new Criteria(); $this->assertNull($c->getComment(), 'Comment is null by default'); $c2 = $c->setComment('foo'); $this->assertEquals('foo', $c->getComment(), 'Comment is set by setComment()'); $this->assertEquals($c, $c2, 'setComment() returns the current Criteria'); $c->setComment(); $this->assertNull($c->getComment(), 'Comment is reset by setComment(null)'); }
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'); }