/** * @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); }
<?php use Series\Series; use Series\Downloader\TorrentInotify; use Series\Provider\Upstream\DailyTvTorrentProvider; use Series\Provider\Upstream\TorrenthoundTorrentProvider; use Series\Provider\Upstream\Torrenthound720TorrentProvider; use Series\Provider\Mine\Yaml; use Series\Show\Status\Filesystem; // Global $app['series.download_all'] = false; // series $app['series.serie'] = function ($app) { $series = new Series(); /** Provider */ if (isset($app['series.provider.mine'])) { if (is_array($app['series.provider.mine'])) { foreach ($app['series.provider.mine'] as $provider) { $series->getMineProvider()->addProvider($provider); } } else { $series->setMineProvider($app['series.provider.mine']); } } if (isset($app['series.provider.upstream'])) { 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']);