Skip to content

Commit

Permalink
Merge branch 'DDC-1683'
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 14, 2012
2 parents 9b4d608 + 18f1d56 commit 0e1eff1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Doctrine/ORM/Query/Expr.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ private function _quoteLiteral($literal)
{
if (is_numeric($literal) && !is_string($literal)) {
return (string) $literal;
} else if (is_bool($literal)) {
return $literal ? "true" : "false";
} else {
return "'" . str_replace("'", "''", $literal) . "'";
}
Expand Down
11 changes: 10 additions & 1 deletion tests/Doctrine/Tests/ORM/Query/ExprTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,13 @@ public function testAddThrowsException()
$orExpr = $this->_expr->orx();
$orExpr->add($this->_expr->quot(5, 2));
}
}

/**
* @group DDC-1683
*/
public function testBooleanLiteral()
{
$this->assertEquals('true', $this->_expr->literal(true));
$this->assertEquals('false', $this->_expr->literal(false));
}
}

0 comments on commit 0e1eff1

Please sign in to comment.