Skip to content
Permalink
Browse files

Fix backward incompatibility of QueryExpression::type()

  • Loading branch information...
chinpei215 committed Aug 15, 2017
1 parent af2e473 commit 3f24349015264adb3a0060ed74059026b89575d0
@@ -122,7 +122,7 @@ public function tieWith($conjunction = null)
*/
public function type($conjunction = null)
{
return $this->setConjunction($conjunction);
return $this->tieWith($conjunction);
}
/**
@@ -23,6 +23,57 @@
*/
class QueryExpressionTest extends TestCase
{
/**
* Test setConjunction()/getConjunction() works.
*
* @return
*/
public function testConjunction()
{
$expr = new QueryExpression(['1', '2']);
$binder = new ValueBinder();
$this->assertSame($expr, $expr->setConjunction('+'));
$this->assertSame('+', $expr->getConjunction());
$result = $expr->sql($binder);
$this->assertEquals('(1 + 2)', $result);
}
/**
* Test tieWith() works.
*
* @return
*/
public function testTieWith()
{
$expr = new QueryExpression(['1', '2']);
$binder = new ValueBinder();
$this->assertSame($expr, $expr->tieWith('+'));
$this->assertSame('+', $expr->tieWith());
$result = $expr->sql($binder);
$this->assertEquals('(1 + 2)', $result);
}
/**
* Test type() works.
*
* @return
*/
public function testType()
{
$expr = new QueryExpression(['1', '2']);
$binder = new ValueBinder();
$this->assertSame($expr, $expr->type('+'));
$this->assertSame('+', $expr->type());
$result = $expr->sql($binder);
$this->assertEquals('(1 + 2)', $result);
}
/**
* Test and() and or() calls work transparently
*

0 comments on commit 3f24349

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