1
0
mirror of synced 2024-12-14 15:16:04 +03:00

Merge branch 'DDC-1012'

This commit is contained in:
Guilherme Blanco 2011-02-20 01:54:05 -03:00
commit a18a7bb678
2 changed files with 32 additions and 0 deletions

View File

@ -443,6 +443,28 @@ class Expr
return new Expr\Func($x . ' NOT IN', (array) $y);
}
/**
* Creates an IS NULL expression with the given arguments.
*
* @param string $x Field in string format to be restricted by IS NULL
* @return string
*/
public function isNull($x)
{
return $x . ' IS NULL';
}
/**
* Creates an IS NOT NULL expression with the given arguments.
*
* @param string $x Field in string format to be restricted by IS NOT NULL
* @return string
*/
public function isNotNull($x)
{
return $x . ' IS NOT NULL';
}
/**
* Creates a LIKE() comparison expression with the given arguments.
*

View File

@ -256,6 +256,16 @@ class ExprTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals('TRIM(u.id)', (string) $this->_expr->trim('u.id'));
}
public function testIsNullExpr()
{
$this->assertEquals('u.id IS NULL', (string) $this->_expr->isNull('u.id'));
}
public function testIsNotNullExpr()
{
$this->assertEquals('u.id IS NOT NULL', (string) $this->_expr->isNotNull('u.id'));
}
public function testInExpr()
{
$this->assertEquals('u.id IN(1, 2, 3)', (string) $this->_expr->in('u.id', array(1, 2, 3)));