Skip to content
Permalink
Browse files

Fixing lastInserId() use

  • Loading branch information...
lorenzo committed Mar 19, 2016
1 parent 135aa72 commit fef4769acab4a88abc0cff3f0dfddd25c31a6cf5
Showing with 9 additions and 5 deletions.
  1. +9 −5 tests/TestCase/Database/QueryTest.php
@@ -3604,16 +3604,18 @@ public function testSelectTypeConversion()
public function testSymetricJsonType()
{
$query = new Query($this->connection);
$id = $query
$insert = $query
->insert(['comment', 'article_id', 'user_id'], ['comment' => 'json'])
->into('comments')
->values([
'comment' => ['a' => 'b', 'c' => true],
'article_id' => 1,
'user_id' => 1
])
->execute()
->lastInsertId('id');
->execute();
$id = $insert->lastInsertId('comments', 'id');
$insert->closeCursor();
$query = new Query($this->connection);
$query
@@ -3622,8 +3624,10 @@ public function testSymetricJsonType()
->where(['id' => $id])
->selectTypeMap()->types(['comment' => 'json']);
$result = $query->execute()->fetchAll('assoc')[0]['comment'];
$this->assertSame(['a' => 'b', 'c' => true], $result);
$result = $query->execute();
$comment = $result->fetchAll('assoc')[0]['comment'];
$result->closeCursor();
$this->assertSame(['a' => 'b', 'c' => true], $comment);
}
/**

0 comments on commit fef4769

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