public function testCommentDoDelete() { $c = new Criteria(); $c->setComment('Foo'); $c->add(BookTableMap::COL_TITLE, 'War And Peace'); $con = Propel::getServiceContainer()->getConnection(BookTableMap::DATABASE_NAME); $c->doDelete($con); $expected = $this->getSql('DELETE /* Foo */ FROM `book` WHERE book.TITLE=\'War And Peace\''); $this->assertEquals($expected, $con->getLastExecutedQuery(), 'Criteria::setComment() adds a comment to delete queries'); }
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)'); }