Skip to content
Permalink
Browse files

Added test case for closures in QueryExpression.

  • Loading branch information...
wadosm committed Jul 1, 2014
1 parent 184bbd4 commit 689504294e2ee8de08009f3e2ede3916aac1b7ca
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/TestCase/Database/Expression/TupleComparisonTest.php
@@ -69,6 +69,21 @@ public function testTupleWithExpressionValues() {
$this->assertSame(2, $binder->bindings()[':c1']['value']);
}
/**
* Tests generating tuples in the values side containing expressions
*
* @return void
*/
public function testTupleWithClosureExpression() {
$field1 = new QueryExpression([function($e){return $e->eq('a', 1);}]);
$f = new TupleComparison([$field1, 'field2'], [4, 5], ['integer', 'integer'], '>');
$binder = new ValueBinder;
$this->assertEquals('(a = :c0, field2) > (:c1, :c2)', $f->sql($binder));
$this->assertSame(1, $binder->bindings()[':c0']['value']);
$this->assertSame(4, $binder->bindings()[':c1']['value']);
$this->assertSame(5, $binder->bindings()[':c2']['value']);
}
/**
* Tests generating tuples using the IN conjunction
*

0 comments on commit 6895042

Please sign in to comment.
You can’t perform that action at this time.