summaryrefslogtreecommitdiffstats
path: root/tests/unit/db
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-29 13:25:04 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-29 13:30:01 +0200
commit3fc18156ae0b586e8de0c82949acfa6291317536 (patch)
tree201e97511bea44c58b5e9d78d8cf36ae2e2b54f9 /tests/unit/db
parenta03b54c6a59837d0045c140ea7aef3fae95daa95 (diff)
go back to order by id, fix #138, use a newest item id to prevent marking items as read that the user didnt see yet fix #141, also update the starred count periodically
Diffstat (limited to 'tests/unit/db')
-rw-r--r--tests/unit/db/ItemMapperTest.php78
1 files changed, 55 insertions, 23 deletions
diff --git a/tests/unit/db/ItemMapperTest.php b/tests/unit/db/ItemMapperTest.php
index ff5bb1f4c..764042d36 100644
--- a/tests/unit/db/ItemMapperTest.php
+++ b/tests/unit/db/ItemMapperTest.php
@@ -194,17 +194,28 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility {
}
- public function testFindAll(){
- $sql = 'AND `items`.`id` < ? ' .
- 'ORDER BY `items`.`pub_date` DESC, `items`.`id` DESC ';
+ public function testFindAllFeed(){
+ $sql = 'AND `items`.`feed_id` = ? ' .
+ 'AND `items`.`id` < ? ' .
+ 'ORDER BY `items`.`id` DESC ';
$sql = $this->makeSelectQueryStatus($sql, $this->status);
- $params = array($this->user, $this->newestItemId);
- $this->setMapperResult($sql, $params, $this->rows,
- $this->limit, $this->offset);
+ $params = array($this->user, $this->id, $this->offset);
+ $this->setMapperResult($sql, $params, $this->rows);
+ $result = $this->mapper->findAllFeed($this->id, $this->limit,
+ $this->offset, $this->status, $this->user);
+
+ $this->assertEquals($this->items, $result);
+ }
- $result = $this->mapper->findAll($this->limit,
- $this->offset, $this->newestItemId,
- $this->status, $this->user);
+
+ public function testFindAllFeedOffsetZero(){
+ $sql = 'AND `items`.`feed_id` = ? ' .
+ 'ORDER BY `items`.`id` DESC ';
+ $sql = $this->makeSelectQueryStatus($sql, $this->status);
+ $params = array($this->user, $this->id);
+ $this->setMapperResult($sql, $params, $this->rows);
+ $result = $this->mapper->findAllFeed($this->id, $this->limit,
+ 0, $this->status, $this->user);
$this->assertEquals($this->items, $result);
}
@@ -213,37 +224,58 @@ class ItemMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility {
public function testFindAllFolder(){
$sql = 'AND `feeds`.`folder_id` = ? ' .
'AND `items`.`id` < ? ' .
- 'ORDER BY `items`.`pub_date` DESC, `items`.`id` DESC ';
+ 'ORDER BY `items`.`id` DESC ';
$sql = $this->makeSelectQueryStatus($sql, $this->status);
- $params = array($this->user, $this->id, $this->newestItemId);
+ $params = array($this->user, $this->id,
+ $this->offset);
+ $this->setMapperResult($sql, $params, $this->rows);
+ $result = $this->mapper->findAllFolder($this->id, $this->limit,
+ $this->offset, $this->status, $this->user);
+
+ $this->assertEquals($this->items, $result);
+ }
- $this->setMapperResult($sql, $params, $this->rows,
- $this->limit, $this->offset);
+ public function testFindAllFolderOffsetZero(){
+ $sql = 'AND `feeds`.`folder_id` = ? ' .
+ 'ORDER BY `items`.`id` DESC ';
+ $sql = $this->makeSelectQueryStatus($sql, $this->status);
+ $params = array($this->user, $this->id);
+ $this->setMapperResult($sql, $params, $this->rows);
$result = $this->mapper->findAllFolder($this->id, $this->limit,
- $this->offset, $this->newestItemId, $this->status, $this->user);
+ 0, $this->status, $this->user);
$this->assertEquals($this->items, $result);
}
- public function testFindAllFeed(){
- $sql = 'AND `items`.`feed_id` = ? ' .
- 'AND `items`.`id` < ? ' .
- 'ORDER BY `items`.`pub_date` DESC, `items`.`id` DESC ';
+ public function testFindAll(){
+ $sql = 'AND `items`.`id` < ? ' .
+ 'ORDER BY `items`.`id` DESC ';
$sql = $this->makeSelectQueryStatus($sql, $this->status);
- $params = array($this->user, $this->id, $this->newestItemId);
- $this->setMapperResult($sql, $params, $this->rows, $this->limit,
- $this->offset);
+ $params = array($this->user, $this->offset);
+ $this->setMapperResult($sql, $params, $this->rows);
+ $result = $this->mapper->findAll($this->limit,
+ $this->offset, $this->status, $this->user);
- $result = $this->mapper->findAllFeed($this->id, $this->limit,
- $this->offset, $this->newestItemId, $this->status, $this->user);
+ $this->assertEquals($this->items, $result);
+ }
+
+
+ public function testFindAllOffsetZero(){
+ $sql = 'ORDER BY `items`.`id` DESC ';
+ $sql = $this->makeSelectQueryStatus($sql, $this->status);
+ $params = array($this->user);
+ $this->setMapperResult($sql, $params, $this->rows);
+ $result = $this->mapper->findAll($this->limit,
+ 0, $this->status, $this->user);
$this->assertEquals($this->items, $result);
}
+
public function testFindByGuidHash(){
$hash = md5('test');
$feedId = 3;