/**
  * @expectedException \RuntimeException
  */
 public function testGetUrlBodyError()
 {
     $guzzleResponse = $this->getMock('\\Psr\\Http\\Message\\ResponseInterface');
     $guzzleResponse->method('getStatusCode')->will($this->returnValue(404));
     $guzzleResponse->method('getBody')->will($this->returnValue('mock'));
     $this->httpClient->method('request')->will($this->returnValue($guzzleResponse));
     $this->client->getUrlBody('http://google.com/notfound');
 }
 /**
  * @param WeburgClient $weburgClient
  * @param $movieId
  * @param $daysMax
  * @param $allowedMisses
  * @return array
  */
 public function getMovieTorrentsUrls(WeburgClient $weburgClient, $movieId, $daysMax, $allowedMisses)
 {
     $torrentsUrls = [];
     $logger = $this->getApplication()->getLogger();
     $movieId = $weburgClient->cleanMovieId($movieId);
     if (!$movieId) {
         throw new \RuntimeException($movieId . ' seems not weburg movie ID or URL');
     }
     $movieInfo = $weburgClient->getMovieInfoById($movieId);
     $logger->info('Search series ' . $movieId);
     if (!empty($movieInfo['hashes'])) {
         $seriesUrls = $weburgClient->getSeriesTorrents($movieId, $movieInfo['hashes'], $daysMax, $allowedMisses);
         $torrentsUrls = array_merge($torrentsUrls, $seriesUrls);
         if (count($seriesUrls)) {
             $logger->info('Download series ' . $movieId . ': ' . $movieInfo['title'] . ' (' . count($seriesUrls) . ')');
         }
     } else {
         $torrentsUrls = array_merge($torrentsUrls, $weburgClient->getMovieTorrentUrlsById($movieId));
     }
     return $torrentsUrls;
 }