Exemplo n.º 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);
 }