Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #29 from HillTravis/patch-1
Browse files Browse the repository at this point in the history
Allow null $parameters in Predicate::expression()
  • Loading branch information
weierophinney committed Sep 22, 2015
2 parents c2b54ad + 51863b7 commit a2337a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Sql/Predicate/Predicate.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function notLike($identifier, $notLike)
* @param $parameters
* @return $this
*/
public function expression($expression, $parameters)
public function expression($expression, $parameters = null)
{
$this->addPredicate(
new Expression($expression, $parameters),
Expand Down
13 changes: 13 additions & 0 deletions test/Sql/Predicate/PredicateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,19 @@ public function testExpression()
$predicate->getExpressionData()
);
}

/**
* @testdox Unit test: Test expression() allows null $parameters
*/
public function testExpressionNullParameters()
{
$predicate = new Predicate;

$predicate->expression('foo = bar');
$predicates = $predicate->getPredicates();
$expression = $predicates[0][1];
$this->assertEquals([null], $expression->getParameters());
}

/**
* @testdox Unit test: Test literal() is chainable, returns proper values, and is backwards compatible with 2.0.*
Expand Down

0 comments on commit a2337a4

Please sign in to comment.