/** * Tests that it is possible to nest expression objects and pass them as arguments * In particular nesting multiple FunctionExpression * * @return void */ public function testFunctionNesting() { $binder = new ValueBinder(); $f = new FunctionExpression('MyFunction', ['foo', 'bar']); $g = new FunctionExpression('Wrapper', ['bar' => 'literal', $f]); $this->assertEquals("Wrapper(bar, MyFunction(:c0, :c1))", $g->sql($binder)); }
/** * Tests that it is possible to use a number as a literal in a function. * * @return void */ public function testNumericLiteral() { $binder = new ValueBinder(); $f = new FunctionExpression('MyFunction', ['a_field' => 'literal', '32' => 'literal']); $this->assertEquals('MyFunction(a_field, 32)', $f->sql($binder)); $f = new FunctionExpression('MyFunction', ['a_field' => 'literal', 32 => 'literal']); $this->assertEquals('MyFunction(a_field, 32)', $f->sql($binder)); }