diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-21 16:45:36 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-21 16:45:36 +0200 |
commit | 42d69a95f3276a2d6089ca68f635c4e2f6aa7a23 (patch) | |
tree | 6a17fd7998f291e6dec1d996c1e7c724b92b8e58 /tests/unit/db/postgres | |
parent | 0e6598b0734fb927109f745d9c0f3a8605a30ca5 (diff) |
convert tabs indention to indention with 4 spaces because of mixing of both variants in code and better readability on github and websites because you cant set the indention width there and 8 spaces will be used for a tab
Diffstat (limited to 'tests/unit/db/postgres')
-rw-r--r-- | tests/unit/db/postgres/ItemMapperTest.php | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/tests/unit/db/postgres/ItemMapperTest.php b/tests/unit/db/postgres/ItemMapperTest.php index 528f6003a..04550695d 100644 --- a/tests/unit/db/postgres/ItemMapperTest.php +++ b/tests/unit/db/postgres/ItemMapperTest.php @@ -19,104 +19,104 @@ use \OCA\News\Db\StatusFlag; class ItemMapperTest extends \Test\AppFramework\Db\MapperTestUtility { - private $mapper; - private $items; - private $newestItemId; - private $limit; - private $user; - private $offset; - private $updatedSince; - private $status; + private $mapper; + private $items; + private $newestItemId; + private $limit; + private $user; + private $offset; + private $updatedSince; + private $status; - public function setUp() { - parent::setUp(); + public function setUp() { + parent::setUp(); - $this->mapper = new ItemMapper($this->db); + $this->mapper = new ItemMapper($this->db); - // create mock items - $item1 = new Item(); - $item2 = new Item(); + // create mock items + $item1 = new Item(); + $item2 = new Item(); - $this->items = [$item1, $item2]; + $this->items = [$item1, $item2]; - $this->userId = 'john'; - $this->id = 3; - $this->folderId = 2; + $this->userId = 'john'; + $this->id = 3; + $this->folderId = 2; - $this->row = [['id' => $this->items[0]->getId()]]; + $this->row = [['id' => $this->items[0]->getId()]]; - $this->rows = [ - ['id' => $this->items[0]->getId()], - ['id' => $this->items[1]->getId()] - ]; + $this->rows = [ + ['id' => $this->items[0]->getId()], + ['id' => $this->items[1]->getId()] + ]; - $this->user = 'john'; - $this->limit = 10; - $this->offset = 3; - $this->id = 11; - $this->status = 333; - $this->updatedSince = 323; - $this->newestItemId = 2; + $this->user = 'john'; + $this->limit = 10; + $this->offset = 3; + $this->id = 11; + $this->status = 333; + $this->updatedSince = 323; + $this->newestItemId = 2; - } + } - public function testDeleteReadOlderThanThresholdDoesNotDeleteBelowThreshold(){ - $status = StatusFlag::STARRED | StatusFlag::UNREAD; - $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`, `feeds`.`articles_per_update` ' . - 'HAVING COUNT(*) > ?'; + public function testDeleteReadOlderThanThresholdDoesNotDeleteBelowThreshold(){ + $status = StatusFlag::STARRED | StatusFlag::UNREAD; + $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`, `feeds`.`articles_per_update` ' . + 'HAVING COUNT(*) > ?'; - $threshold = 10; - $rows = [['feed_id' => 30, 'size' => 9]]; - $params = [$status, $threshold]; + $threshold = 10; + $rows = [['feed_id' => 30, 'size' => 9]]; + $params = [$status, $threshold]; - $this->setMapperResult($sql, $params, $rows); - $this->mapper->deleteReadOlderThanThreshold($threshold); + $this->setMapperResult($sql, $params, $rows); + $this->mapper->deleteReadOlderThanThreshold($threshold); - } + } - public function testDeleteReadOlderThanThreshold(){ - $threshold = 10; - $status = StatusFlag::STARRED | StatusFlag::UNREAD; + public function testDeleteReadOlderThanThreshold(){ + $threshold = 10; + $status = StatusFlag::STARRED | StatusFlag::UNREAD; - $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`, `feeds`.`articles_per_update` ' . - 'HAVING COUNT(*) > ?'; - $params1 = [$status, $threshold]; + $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`, `feeds`.`articles_per_update` ' . + 'HAVING COUNT(*) > ?'; + $params1 = [$status, $threshold]; - $row = ['feed_id' => 30, 'size' => 11]; + $row = ['feed_id' => 30, 'size' => 11]; - $sql2 = 'DELETE FROM `*PREFIX*news_items` ' . - 'WHERE `id` IN (' . - 'SELECT `id` FROM `*PREFIX*news_items` ' . - 'WHERE NOT ((`status` & ?) > 0) ' . - 'AND `feed_id` = ? ' . - 'ORDER BY `id` ASC ' . - 'LIMIT ?' . - ')'; - $params2 = [$status, 30, 1]; + $sql2 = 'DELETE FROM `*PREFIX*news_items` ' . + 'WHERE `id` IN (' . + 'SELECT `id` FROM `*PREFIX*news_items` ' . + 'WHERE NOT ((`status` & ?) > 0) ' . + 'AND `feed_id` = ? ' . + 'ORDER BY `id` ASC ' . + 'LIMIT ?' . + ')'; + $params2 = [$status, 30, 1]; - $this->setMapperResult($sql1, $params1, [$row]); - $this->setMapperResult($sql2, $params2); + $this->setMapperResult($sql1, $params1, [$row]); + $this->setMapperResult($sql2, $params2); - $this->mapper->deleteReadOlderThanThreshold($threshold); - } + $this->mapper->deleteReadOlderThanThreshold($threshold); + } } |