Skip to content

Commit

Permalink
Unit testing append in combination with update
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 21, 2013
1 parent 64f3eb1 commit 9bc5afd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Cake/Test/TestCase/Database/QueryTest.php
Expand Up @@ -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.
Expand Down

0 comments on commit 9bc5afd

Please sign in to comment.