Skip to content
Permalink
Browse files

Added test for value object in conditions

  • Loading branch information...
lorenzo committed Apr 2, 2016
1 parent f52cea8 commit 0b92431838878796be105933341c770502e2570c
Showing with 23 additions and 0 deletions.
  1. +23 −0 tests/TestCase/Database/ExpressionTypeCastingIntegrationTest.php
@@ -48,6 +48,9 @@ public function toPHP($value, Driver $d)
public function toExpression($value)
{
if ($value instanceof UuidValue) {
$value = $value->value;
}
$substr = function ($start, $length = null) use ($value) {
return new FunctionExpression(
'SUBSTR',
@@ -139,6 +142,26 @@ public function testSelectWithConditions()
$this->assertEquals('4c2681c048298a29a7fb413140cf8569', $result[0]['id']);
}
/**
* Tests Select using value object in conditions
*
* @return void
*/
public function testSelectWithConditionsValueObject()
{
$this->_insert();
$result = $this->connection->newQuery()
->select('id')
->from('ordered_uuid_items')
->where(['id' => new UuidValue('48298a29-81c0-4c26-a7fb-413140cf8569')], ['id' => 'ordered_uuid'])
->execute()
->fetchAll('assoc');
$this->assertCount(1, $result);
$this->assertEquals('4c2681c048298a29a7fb413140cf8569', $result[0]['id']);
}
/**
* Tests using the expression type in with an IN condition
*

0 comments on commit 0b92431

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