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

Commit

Permalink
Merge branch 'hotfix/29'
Browse files Browse the repository at this point in the history
Close #29
  • Loading branch information
weierophinney committed Sep 22, 2015
2 parents c2b54ad + d20f994 commit ce05c93
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ All notable changes to this project will be documented in this file, in reverse

### Removed

- Nothing.
- [#29](https://github.com/zendframework/zend-db/pull/29) removes the required
second argument to `Zend\Db\Predicate\Predicate::expression()`, allowing it to
be nullable, and mirroring the constructor of `Zend\Db\Predicate\Expression`.

### Fixed

Expand Down
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 @@ -229,6 +229,19 @@ public function testExpression()
);
}

/**
* @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 ce05c93

Please sign in to comment.