Skip to content
Permalink
Browse files

Unit testing append in combination with update

  • Loading branch information...
lorenzo committed Oct 21, 2013
1 parent 64f3eb1 commit 9bc5afd0f84e5d7f0c0c58bb3c8339107f843901
Showing with 18 additions and 0 deletions.
  1. +18 −0 Cake/Test/TestCase/Database/QueryTest.php
@@ -1974,6 +1974,24 @@ public function testAppendInsert() {
$this->assertEquals(' RETURNING id', substr($sql, -13));
}
/**
* Test that append() will actually append a string to a select query
*
* @return void
*/
public function testAppendUpdate() {
$query = new Query($this->connection);
$sql = $query
->update('articles')
->set(['title' => 'foo'])
->where(['id' => 1])
->append('RETURNING id')
->sql();
$this->assertContains('UPDATE', $sql);
$this->assertContains('SET', $sql);
$this->assertContains('WHERE', $sql);
$this->assertEquals(' RETURNING id', substr($sql, -13));
}
/**
* Assertion for comparing a table's contents with what is in it.

0 comments on commit 9bc5afd

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