/** * @dataProvider getDownloadTest */ public function testDownload($i, $downloadAll) { $series = new Series(); $downloadFake = $this->getMock('Series\\Downloader\\DownloadInterface'); $downloadFake->expects($this->exactly($i))->method('getSupportedType')->will($this->returnValue('FAKE')); $downloadFake->expects($this->exactly($i))->method('download'); $series->setDownloader($downloadFake); $statusFake = $this->getMock('Series\\Show\\Status\\StatusInterface'); $statusFake->expects($this->exactly($i))->method('setMarkAsDownloaded'); $series->setShowStatus($statusFake); $show1 = new MineShow('foo', 1.0); $matchedShow1 = new MatchedShow($show1); $matchedShow1->addMatchedShow(new UpstreamShow('foo-1', '1.0')); $matchedShow1->addMatchedShow(new UpstreamShow('foo-2', '1.0')); $matchedShow1->addMatchedShow(new UpstreamShow('foo-3', '1.0')); $matchedShow1->addMatchedShow(new UpstreamShow('foo-4', '1.0')); $showCollection = new MatchedShowCollection(); $showCollection->add($matchedShow1); $series->download($showCollection, $downloadAll); }
if (is_array($app['series.provider.upstream'])) { foreach ($app['series.provider.upstream'] as $provider) { $series->getUpstreamProvider()->addProvider($provider); } } else { $series->setUpstreamProvider($app['series.provider.upstream']); } } /** Downloader */ if (isset($app['series.downloader'])) { if (is_array($app['series.downloader'])) { foreach ($app['series.downloader'] as $downloader) { $series->getDownloader()->addDownloader($downloader); } } else { $series->setDownloader($app['series.downloader']); } } /** Show Status */ if (isset($app['series.show.status'])) { if (is_array($app['series.show.status'])) { foreach ($app['series.show.status'] as $status) { $series->getShowStatus()->addStatus($status); } } else { $series->setShowStatus($app['series.show.status']); } // Share the same show status between the Matcher (will call isAlreadyDownloaded) // And the Serie Object (will call setMarkAsDownloaded) $series->getMatcher()->setShowStatus($series->getShowStatus()); }