예제 #1
0
파일: feedmapper.php 프로젝트: hroo772/news
 public function findByUrlHash($hash, $userId)
 {
     $sql = 'SELECT `feeds`.*, COUNT(`items`.`id`) AS `unread_count` ' . 'FROM `*PREFIX*news_feeds` `feeds` ' . 'LEFT JOIN `*PREFIX*news_items` `items` ' . 'ON `feeds`.`id` = `items`.`feed_id` ' . 'AND (`items`.`status` & ' . StatusFlag::UNREAD . ') = ' . StatusFlag::UNREAD . ' ' . 'WHERE `feeds`.`url_hash` = ? ' . 'AND `feeds`.`user_id` = ? ' . 'GROUP BY `feeds`.`id`, `feeds`.`user_id`, `feeds`.`url_hash`,' . '`feeds`.`url`, `feeds`.`title`, `feeds`.`link`,' . '`feeds`.`favicon_link`, `feeds`.`added`, `feeds`.`articles_per_update`,' . '`feeds`.`folder_id`, `feeds`.`prevent_update`, `feeds`.`deleted_at`';
     $params = array($hash, $userId);
     $row = $this->findOneQuery($sql, $params);
     $feed = new Feed();
     $feed->fromRow($row);
     return $feed;
 }
예제 #2
0
 /**
  * @expectedException OCA\News\Service\ServiceNotFoundException
  */
 public function testOrderingDoesNotExist()
 {
     $feed = Feed::fromRow(['id' => 3]);
     $this->feedMapper->expects($this->once())->method('find')->will($this->throwException(new DoesNotExistException('')));
     $this->feedService->setOrdering(3, 2, $this->user);
 }
예제 #3
0
 public function testSetPinned()
 {
     $feed = Feed::fromRow(['id' => 3, 'pinned' => false]);
     $this->feedMapper->expects($this->once())->method('find')->with($this->equalTo($feed->getId()), $this->equalTo($this->user))->will($this->returnValue($feed));
     $feed->setPinned(true);
     $this->feedMapper->expects($this->once())->method('update')->with($this->equalTo($feed));
     $this->feedService->setPinned(3, true, $this->user);
 }