예제 #1
0
 public function testUpdateDoesNotFindUpdatedEntry()
 {
     $feed = new Feed();
     $feed->setId(3);
     $feed->setArticlesPerUpdate(1);
     $item = new Item();
     $item->setGuidHash(md5('hi'));
     $item->setPubDate(3333);
     $item->setId(4);
     $items = [$item];
     $item2 = new Item();
     $item2->setPubDate(111);
     $fetchReturn = [$feed, $items];
     $ex = new DoesNotExistException('');
     $this->feedMapper->expects($this->at(0))->method('find')->with($this->equalTo($feed->getId()), $this->equalTo($this->user))->will($this->returnValue($feed));
     $this->feedMapper->expects($this->at(1))->method('update')->with($this->equalTo($feed));
     $this->fetcher->expects($this->once())->method('fetch')->will($this->returnValue($fetchReturn));
     $this->itemMapper->expects($this->once())->method('findByGuidHash')->with($this->equalTo($item->getGuidHash()), $this->equalTo($feed->getId()), $this->equalTo($this->user))->will($this->returnValue($item2));
     $this->feedMapper->expects($this->at(2))->method('find')->with($this->equalTo($feed->getId()), $this->equalTo($this->user))->will($this->throwException($ex));
     $this->setExpectedException('\\OCA\\News\\Service\\ServiceNotFoundException');
     $this->feedService->update($feed->getId(), $this->user);
 }
예제 #2
0
파일: bootstrap.php 프로젝트: sbambach/news
 private function createFeed($feed)
 {
     $newFeed = new Feed();
     $newFeed->setUserId($this->userId);
     $newFeed->setFolderId($feed['folderId']);
     $newFeed->setTitle($feed['title']);
     $newFeed->setUrl($feed['url']);
     $newFeed->setLocation($feed['location']);
     $newFeed->setFaviconLink($feed['faviconLink']);
     $newFeed->setAdded($feed['added']);
     $newFeed->setLink($feed['link']);
     $newFeed->setPreventUpdate($feed['preventUpdate']);
     $newFeed->setDeletedAt($feed['deletedAt']);
     $newFeed->setArticlesPerUpdate($feed['articlesPerUpdate']);
     $newFeed->setLastModified($feed['lastModified']);
     $newFeed->setEtag($feed['etag']);
     return $this->feedMapper->insert($newFeed);
 }