summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-05-24 13:06:09 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-05-24 13:06:22 +0200
commitd529559942841d455c917845d1f06c6d98e77cf4 (patch)
tree4599f5c13399764f8b61c91eb24b67533b1659da /tests
parent7ed7b4ff808bfc335c86365e4266432f643be3af (diff)
dont use table in subselect of mark read query to not fail on mysql, fixes #173
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/db/ItemMapperTest.php30
1 files changed, 13 insertions, 17 deletions
diff --git a/tests/unit/db/ItemMapperTest.php b/tests/unit/db/ItemMapperTest.php
index 6d0de6459..5f2639979 100644
--- a/tests/unit/db/ItemMapperTest.php
+++ b/tests/unit/db/ItemMapperTest.php
@@ -128,14 +128,12 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility {
public function testReadAll(){
$sql = 'UPDATE `*PREFIX*news_items` ' .
'SET `status` = `status` & ? ' .
- 'WHERE `id` IN (' .
- 'SELECT `items`.`id` FROM `*PREFIX*news_items` `items` ' .
- 'JOIN `*PREFIX*news_feeds` `feeds` ' .
- 'ON `feeds`.`id` = `items`.`feed_id` '.
- 'AND `items`.`id` <= ? ' .
- 'AND `feeds`.`user_id` = ? ' .
- ') ';
- $params = array(~StatusFlag::UNREAD, 3, $this->user);
+ 'WHERE `feed_id` IN (' .
+ 'SELECT `id` FROM `*PREFIX*news_feeds` ' .
+ 'WHERE `user_id` = ? ' .
+ ') '.
+ 'AND `id` <= ?';
+ $params = array(~StatusFlag::UNREAD, $this->user, 3);
$this->setMapperResult($sql, $params);
$this->mapper->readAll(3, $this->user);
}
@@ -144,15 +142,13 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility {
public function testReadFolder(){
$sql = 'UPDATE `*PREFIX*news_items` ' .
'SET `status` = `status` & ? ' .
- 'WHERE `id` IN (' .
- 'SELECT `items`.`id` FROM `*PREFIX*news_items` `items` ' .
- 'JOIN `*PREFIX*news_feeds` `feeds` ' .
- 'ON `feeds`.`id` = `items`.`feed_id` '.
- 'AND `feeds`.`folder_id` = ? ' .
- 'AND `items`.`id` <= ? ' .
- 'AND `feeds`.`user_id` = ? ' .
- ') ';
- $params = array(~StatusFlag::UNREAD, 3, 6, $this->user);
+ 'WHERE `feed_id` IN (' .
+ 'SELECT `id` FROM `*PREFIX*news_feeds` ' .
+ 'WHERE `folder_id` = ? ' .
+ 'AND `user_id` = ? ' .
+ ') '.
+ 'AND `id` <= ?';
+ $params = array(~StatusFlag::UNREAD, 3, $this->user, 6);
$this->setMapperResult($sql, $params);
$this->mapper->readFolder(3, 6, $this->user);
}