diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-13 18:14:40 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-13 18:14:40 +0200 |
commit | f9691e0faf7e3844aece1ebedc22805bd5782ba2 (patch) | |
tree | 856a1553279540ca006b039aa5267d26c26add97 /tests | |
parent | dda579ccaac67b5f360af98926a1697389bdbc6c (diff) |
respect articles per update count in item cleanup
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/db/ItemMapperTest.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/unit/db/ItemMapperTest.php b/tests/unit/db/ItemMapperTest.php index ae045ce31..bba3e143e 100644 --- a/tests/unit/db/ItemMapperTest.php +++ b/tests/unit/db/ItemMapperTest.php @@ -325,10 +325,13 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { public function testDeleteReadOlderThanThresholdDoesNotDeleteBelowThreshold(){ $status = StatusFlag::STARRED | StatusFlag::UNREAD; - $sql = 'SELECT COUNT(*) `size`, `feed_id` ' . - 'FROM `*PREFIX*news_items` ' . - 'WHERE NOT ((`status` & ?) > 0) ' . - 'GROUP BY `feed_id` ' . + $sql = 'SELECT COUNT(*) - `feeds`.`articles_per_update` AS `size`, ' . + '`items`.`feed_id` AS `feed_id`, ' . + 'FROM `*PREFIX*news_items` `items` ' . + 'JOIN `*PREFIX*news_feeds` `feeds` ' . + 'ON `feeds`.`id` = `items`.`feed_id` ' . + 'WHERE NOT ((`items`.`status` & ?) > 0) ' . + 'GROUP BY `items`.`feed_id` ' . 'HAVING COUNT(*) > ?'; $threshold = 10; @@ -346,10 +349,13 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { $threshold = 10; $status = StatusFlag::STARRED | StatusFlag::UNREAD; - $sql1 = 'SELECT COUNT(*) `size`, `feed_id` ' . - 'FROM `*PREFIX*news_items` ' . - 'WHERE NOT ((`status` & ?) > 0) ' . - 'GROUP BY `feed_id` ' . + $sql1 = 'SELECT COUNT(*) - `feeds`.`articles_per_update` AS `size`, ' . + '`items`.`feed_id` AS `feed_id`, ' . + 'FROM `*PREFIX*news_items` `items` ' . + 'JOIN `*PREFIX*news_feeds` `feeds` ' . + 'ON `feeds`.`id` = `items`.`feed_id` ' . + 'WHERE NOT ((`items`.`status` & ?) > 0) ' . + 'GROUP BY `items`.`feed_id` ' . 'HAVING COUNT(*) > ?'; $params1 = array($status, $threshold); |