From 6cd83ea1da4d24d439a5f30bfc13349f0c25e597 Mon Sep 17 00:00:00 2001 From: Benjamin Brahmer Date: Thu, 11 Feb 2021 07:56:31 +0100 Subject: remove unused lastModified from feed fetcher Signed-off-by: Benjamin Brahmer --- composer.lock | 4 ++-- lib/Command/ShowFeed.php | 2 +- lib/Fetcher/FeedFetcher.php | 1 - lib/Fetcher/Fetcher.php | 4 ---- lib/Fetcher/IFeedFetcher.php | 5 +---- lib/Service/FeedServiceV2.php | 1 - tests/Unit/Command/ShowFeedTest.php | 4 ++-- tests/Unit/Fetcher/FeedFetcherTest.php | 15 +++++++-------- tests/Unit/Fetcher/FetcherTest.php | 3 +-- 9 files changed, 14 insertions(+), 25 deletions(-) diff --git a/composer.lock b/composer.lock index 4a244a51a..6f47a8f6e 100644 --- a/composer.lock +++ b/composer.lock @@ -3358,7 +3358,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -3417,7 +3417,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" }, "funding": [ { diff --git a/lib/Command/ShowFeed.php b/lib/Command/ShowFeed.php index 180c6ca3a..7408ed191 100644 --- a/lib/Command/ShowFeed.php +++ b/lib/Command/ShowFeed.php @@ -70,7 +70,7 @@ class ShowFeed extends Command $fullTextEnabled = (bool) $input->getOption('full-text'); try { - list($feed, $items) = $this->feedFetcher->fetch($url, null, $fullTextEnabled, $user, $password); + list($feed, $items) = $this->feedFetcher->fetch($url, $fullTextEnabled, $user, $password); } catch (\Exception $ex) { $output->writeln('Failed to fetch feed info:'); $output->writeln($ex->getMessage()); diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php index a70e67114..3035b0e5e 100755 --- a/lib/Fetcher/FeedFetcher.php +++ b/lib/Fetcher/FeedFetcher.php @@ -107,7 +107,6 @@ class FeedFetcher implements IFeedFetcher */ public function fetch( string $url, - ?string $lastModified, bool $fullTextEnabled, ?string $user, ?string $password diff --git a/lib/Fetcher/Fetcher.php b/lib/Fetcher/Fetcher.php index 724c264bc..8c755bc85 100644 --- a/lib/Fetcher/Fetcher.php +++ b/lib/Fetcher/Fetcher.php @@ -44,8 +44,6 @@ class Fetcher * Fetch a feed from remote * * @param string $url remote url of the feed - * @param string|null $lastModified a last modified value from an http header defaults to false. - * If lastModified matches the http header from the feed no results are fetched * @param bool $fullTextEnabled If true use a scraper to download the full article * @param string|null $user if given, basic auth is set for this feed * @param string|null $password if given, basic auth is set for this feed. Ignored if user is empty @@ -56,7 +54,6 @@ class Fetcher */ public function fetch( string $url, - ?string $lastModified = null, bool $fullTextEnabled = false, ?string $user = null, ?string $password = null @@ -67,7 +64,6 @@ class Fetcher } return $fetcher->fetch( $url, - $lastModified, $fullTextEnabled, $user, $password diff --git a/lib/Fetcher/IFeedFetcher.php b/lib/Fetcher/IFeedFetcher.php index abb367889..45e0915f0 100644 --- a/lib/Fetcher/IFeedFetcher.php +++ b/lib/Fetcher/IFeedFetcher.php @@ -24,9 +24,7 @@ interface IFeedFetcher * Fetch feed content. * * @param string $url remote url of the feed - * @param string|null $lastModified a last modified value from an http header defaults to false. - * If lastModified matches the http header from the feed no results are fetched - * @param bool $fullTextEnabled If true use a scraper to download the full article + * @param bool $fullTextEnabled If true use a scraper to download the full article * @param string|null $user if given, basic auth is set for this feed * @param string|null $password if given, basic auth is set for this feed. Ignored if user is empty * @@ -37,7 +35,6 @@ interface IFeedFetcher */ public function fetch( string $url, - ?string $lastModified, bool $fullTextEnabled, ?string $user, ?string $password diff --git a/lib/Service/FeedServiceV2.php b/lib/Service/FeedServiceV2.php index f340bfc8d..d49c540b1 100644 --- a/lib/Service/FeedServiceV2.php +++ b/lib/Service/FeedServiceV2.php @@ -258,7 +258,6 @@ class FeedServiceV2 extends Service */ list($fetchedFeed, $items) = $this->feedFetcher->fetch( $location, - $feed->getHttpLastModified(), $feed->getFullTextEnabled(), $feed->getBasicAuthUser(), $feed->getBasicAuthPassword() diff --git a/tests/Unit/Command/ShowFeedTest.php b/tests/Unit/Command/ShowFeedTest.php index 6383c3f19..ace16e0af 100644 --- a/tests/Unit/Command/ShowFeedTest.php +++ b/tests/Unit/Command/ShowFeedTest.php @@ -72,7 +72,7 @@ class ShowFeedTest extends TestCase $this->fetcher->expects($this->exactly(1)) ->method('fetch') - ->with('feed', null, true, 'user', 'user') + ->with('feed', true, 'user', 'user') ->willReturn([['feed'], [['items']]]); $this->consoleOutput->expects($this->exactly(2)) @@ -106,7 +106,7 @@ class ShowFeedTest extends TestCase $this->fetcher->expects($this->exactly(1)) ->method('fetch') - ->with('feed', null, true, 'user', 'user') + ->with('feed', true, 'user', 'user') ->will($this->throwException(new ServiceNotFoundException('test'))); $this->consoleOutput->expects($this->exactly(2)) diff --git a/tests/Unit/Fetcher/FeedFetcherTest.php b/tests/Unit/Fetcher/FeedFetcherTest.php index 4d5f45f73..ead4a67eb 100644 --- a/tests/Unit/Fetcher/FeedFetcherTest.php +++ b/tests/Unit/Fetcher/FeedFetcherTest.php @@ -310,7 +310,7 @@ class FeedFetcherTest extends TestCase $item = $this->createItem(); $feed = $this->createFeed(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -326,7 +326,6 @@ class FeedFetcherTest extends TestCase $this->mockIterator($this->feed_mock, [$this->item_mock]); $result = $this->fetcher->fetch( $this->url, - '@1553118393', false, 'account@email.com', 'F9sEU*Rt%:KFK8HMHT&' @@ -344,7 +343,7 @@ class FeedFetcherTest extends TestCase $item = $this->createItem('audio/ogg'); $feed = $this->createFeed(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -358,7 +357,7 @@ class FeedFetcherTest extends TestCase $item = $this->createItem('video/ogg'); $feed = $this->createFeed(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -373,7 +372,7 @@ class FeedFetcherTest extends TestCase $feed = $this->createFeed('de-DE'); $item = $this->createItem(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - $result = $this->fetcher->fetch($this->url, '@1553118393', false, null, null); + $result = $this->fetcher->fetch($this->url, false, null, null); $this->assertEquals([$feed, [$item]], $result); } @@ -387,7 +386,7 @@ class FeedFetcherTest extends TestCase $this->createFeed('he-IL'); $this->createItem(); $this->mockIterator($this->feed_mock, [$this->item_mock]); - list($_, $items) = $this->fetcher->fetch($this->url, '@1553118393', false, null, null); + list($_, $items) = $this->fetcher->fetch($this->url, false, null, null); $this->assertTrue($items[0]->getRtl()); } @@ -413,7 +412,7 @@ class FeedFetcherTest extends TestCase $this->mockIterator($this->feed_mock, [$this->item_mock]); - list($feed, $items) = $this->fetcher->fetch($this->url, '@1553118393', false, null, null); + list($feed, $items) = $this->fetcher->fetch($this->url, false, null, null); $this->assertSame($items[0]->getPubDate(), 1522180229); } @@ -439,7 +438,7 @@ class FeedFetcherTest extends TestCase $this->mockIterator($this->feed_mock, [$this->item_mock]); - list($feed, $items) = $this->fetcher->fetch($this->url, '@1553118393', false, null, null); + list($feed, $items) = $this->fetcher->fetch($this->url, false, null, null); $this->assertSame($items[0]->getPubDate(), 1519761029); } diff --git a/tests/Unit/Fetcher/FetcherTest.php b/tests/Unit/Fetcher/FetcherTest.php index a90a2da04..157ce6905 100644 --- a/tests/Unit/Fetcher/FetcherTest.php +++ b/tests/Unit/Fetcher/FetcherTest.php @@ -54,14 +54,13 @@ class FetcherTest extends TestCase ->method('fetch') ->with( $this->equalTo($url), - $this->equalTo(true), $this->equalTo(1), $this->equalTo(2), $this->equalTo(3) ); $this->fetcher->registerFetcher($mockFetcher); - $this->fetcher->fetch($url, true, 1, 2, 3); + $this->fetcher->fetch($url, 1, 2, 3); } -- cgit v1.2.3