Example #1
0
 public function testUpdateFails()
 {
     $feed = new Feed();
     $feed->setId(3);
     $feed->setUpdateErrorCount(0);
     $feed->setLastUpdateError('');
     $exptectedFeed = new Feed();
     $exptectedFeed->setId(3);
     $exptectedFeed->setUpdateErrorCount(1);
     $exptectedFeed->setLastUpdateError('hi');
     $ex = new FetcherException('hi');
     $this->feedMapper->expects($this->at(0))->method('find')->with($this->equalTo($feed->getId()), $this->equalTo($this->user))->will($this->returnValue($feed));
     $this->fetcher->expects($this->once())->method('fetch')->will($this->throwException($ex));
     $this->logger->expects($this->any())->method('debug');
     $this->feedMapper->expects($this->at(1))->method('update')->with($exptectedFeed)->will($this->returnValue($exptectedFeed));
     $this->feedMapper->expects($this->at(2))->method('find')->with($feed->getId(), $this->user)->will($this->returnValue($exptectedFeed));
     $return = $this->feedService->update($feed->getId(), $this->user);
     $this->assertEquals($return, $exptectedFeed);
 }