From 910132fe725cb31a93e8498e9080b939261e1500 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 12 Jul 2024 17:08:40 +0200 Subject: [PATCH 1/2] Fix tests Looks like lemonde.fr doesn't work anymore in wallabag for test. Switching to an other great media. Also update site configs. --- composer.lock | 12 ++++++------ .../Controller/Api/EntryRestControllerTest.php | 16 ++++++++-------- tests/Controller/EntryControllerTest.php | 10 +++++----- .../Controller/Import/FirefoxControllerTest.php | 17 ----------------- .../Import/PocketHtmlControllerTest.php | 13 ------------- .../Controller/Import/ShaarliControllerTest.php | 13 ------------- tests/fixtures/Import/firefox-bookmarks.json | 10 ---------- tests/fixtures/Import/ril_export.html | 1 - tests/fixtures/Import/shaarli-bookmarks.html | 2 +- 9 files changed, 20 insertions(+), 74 deletions(-) diff --git a/composer.lock b/composer.lock index 9ff544365..4d7328dea 100644 --- a/composer.lock +++ b/composer.lock @@ -4567,16 +4567,16 @@ }, { "name": "j0k3r/graby-site-config", - "version": "1.0.187", + "version": "1.0.189", "source": { "type": "git", "url": "https://github.com/j0k3r/graby-site-config.git", - "reference": "4bcb5a7fac83b7276a0fade2daf388747404d66f" + "reference": "4c4721be3e7b8830dd6881ff80e149fb14a19bb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/4bcb5a7fac83b7276a0fade2daf388747404d66f", - "reference": "4bcb5a7fac83b7276a0fade2daf388747404d66f", + "url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/4c4721be3e7b8830dd6881ff80e149fb14a19bb8", + "reference": "4c4721be3e7b8830dd6881ff80e149fb14a19bb8", "shasum": "" }, "require": { @@ -4605,9 +4605,9 @@ "description": "Graby site config files", "support": { "issues": "https://github.com/j0k3r/graby-site-config/issues", - "source": "https://github.com/j0k3r/graby-site-config/tree/1.0.187" + "source": "https://github.com/j0k3r/graby-site-config/tree/1.0.189" }, - "time": "2024-05-27T07:27:31+00:00" + "time": "2024-07-01T02:17:59+00:00" }, { "name": "j0k3r/httplug-ssrf-plugin", diff --git a/tests/Controller/Api/EntryRestControllerTest.php b/tests/Controller/Api/EntryRestControllerTest.php index b5011f637..25ffe612b 100644 --- a/tests/Controller/Api/EntryRestControllerTest.php +++ b/tests/Controller/Api/EntryRestControllerTest.php @@ -559,7 +559,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testPostEntry() { $this->client->request('POST', '/api/entries.json', [ - 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment', 'tags' => 'google', 'title' => 'New title for my article', 'content' => 'my content', @@ -574,7 +574,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame('https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment', $content['url']); $this->assertSame(0, $content['is_archived']); $this->assertSame(0, $content['is_starred']); $this->assertNull($content['starred_at']); @@ -596,7 +596,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $em = $this->client->getContainer()->get(EntityManagerInterface::class); $entry = new Entry($em->getReference(User::class, $this->getUserId())); - $entry->setUrl('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html'); + $entry->setUrl('https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment'); $entry->setArchived(true); $entry->addTag((new Tag())->setLabel('google')); $entry->addTag((new Tag())->setLabel('apple')); @@ -605,7 +605,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $em->clear(); $this->client->request('POST', '/api/entries.json', [ - 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment', 'archive' => '1', 'tags' => 'google, apple', ]); @@ -615,7 +615,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame('https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment', $content['url']); $this->assertSame(1, $content['is_archived']); $this->assertSame(0, $content['is_starred']); $this->assertCount(3, $content['tags']); @@ -699,7 +699,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testPostEntryWithOriginUrl() { $this->client->request('POST', '/api/entries.json', [ - 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment', 'tags' => 'google', 'title' => 'New title for my article', 'content' => 'my content', @@ -715,7 +715,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame('https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment', $content['url']); $this->assertSame('http://mysource.tld', $content['origin_url']); } @@ -1223,7 +1223,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testReloadEntry() { $this->client->request('POST', '/api/entries.json', [ - 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment', 'archive' => '1', 'tags' => 'google, apple', ]); diff --git a/tests/Controller/EntryControllerTest.php b/tests/Controller/EntryControllerTest.php index a09f8bf51..86d74a1d7 100644 --- a/tests/Controller/EntryControllerTest.php +++ b/tests/Controller/EntryControllerTest.php @@ -17,9 +17,9 @@ use Wallabag\Helper\CryptoProxy; class EntryControllerTest extends WallabagTestCase { - public const AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'https://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html'; + public const AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment'; public $downloadImagesEnabled = false; - public $url = 'https://www.lemonde.fr/pixels/article/2019/06/18/ce-qu-il-faut-savoir-sur-le-libra-la-cryptomonnaie-de-facebook_5477887_4408996.html'; + public $url = 'https://www.20minutes.fr/sport/jo_2024/4095122-20240712-jo-paris-2024-saut-ange-bombe-comment-anne-hidalgo-va-plonger-seine-si-fait-vraiment'; private $entryDataTestAttribute = '[data-test="entry"]'; /** @@ -175,9 +175,9 @@ class EntryControllerTest extends WallabagTestCase $this->assertInstanceOf(Entry::class, $content); $this->assertSame($this->url, $content->getUrl()); - $this->assertStringContainsString('la cryptomonnaie de Facebook', $content->getTitle()); + $this->assertStringContainsString('Comment Hidalgo', $content->getTitle()); $this->assertSame('fr', $content->getLanguage()); - $this->assertArrayHasKey('x-frame-options', $content->getHeaders()); + $this->assertArrayHasKey('cache-control', $content->getHeaders()); $client->getContainer()->get(Config::class)->set('store_article_headers', 0); } @@ -1246,7 +1246,7 @@ class EntryControllerTest extends WallabagTestCase $this->assertInstanceOf(Entry::class, $entry); $this->assertSame($url, $entry->getUrl()); - $this->assertStringContainsString('Judo', $entry->getTitle()); + $this->assertStringContainsString('Comment Hidalgo', $entry->getTitle()); // instead of checking for the filename (which might change) check that the image is now local $this->assertStringContainsString(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent()); diff --git a/tests/Controller/Import/FirefoxControllerTest.php b/tests/Controller/Import/FirefoxControllerTest.php index 0c9827a18..c285018d7 100644 --- a/tests/Controller/Import/FirefoxControllerTest.php +++ b/tests/Controller/Import/FirefoxControllerTest.php @@ -127,23 +127,6 @@ class FirefoxControllerTest extends WallabagTestCase $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for 20minutes.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for 20minutes.fr is ok'); $this->assertCount(3, $content->getTags()); - - $content = $client->getContainer() - ->get(EntityManagerInterface::class) - ->getRepository(Entry::class) - ->findByUrlAndUserId( - 'https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html', - $this->getLoggedInUserId() - ); - - $this->assertInstanceOf(Entry::class, $content); - $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.lemonde.fr is ok'); - $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.lemonde.fr is ok'); - $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.lemonde.fr is ok'); - - $createdAt = $content->getCreatedAt(); - $this->assertSame('2013', $createdAt->format('Y')); - $this->assertSame('12', $createdAt->format('m')); } public function testImportWallabagWithEmptyFile() diff --git a/tests/Controller/Import/PocketHtmlControllerTest.php b/tests/Controller/Import/PocketHtmlControllerTest.php index b4b7172c7..ed5e86d96 100644 --- a/tests/Controller/Import/PocketHtmlControllerTest.php +++ b/tests/Controller/Import/PocketHtmlControllerTest.php @@ -127,19 +127,6 @@ class PocketHtmlControllerTest extends WallabagTestCase $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for 20minutes.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for 20minutes.fr is ok'); $this->assertCount(3, $content->getTags()); - - $content = $client->getContainer() - ->get(EntityManagerInterface::class) - ->getRepository(Entry::class) - ->findByUrlAndUserId( - 'https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html', - $this->getLoggedInUserId() - ); - - $this->assertInstanceOf(Entry::class, $content); - $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.lemonde.fr is ok'); - $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.lemonde.fr is ok'); - $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.lemonde.fr is ok'); } public function testImportWallabagWithEmptyFile() diff --git a/tests/Controller/Import/ShaarliControllerTest.php b/tests/Controller/Import/ShaarliControllerTest.php index 3898040eb..2be30f9f8 100644 --- a/tests/Controller/Import/ShaarliControllerTest.php +++ b/tests/Controller/Import/ShaarliControllerTest.php @@ -127,19 +127,6 @@ class ShaarliControllerTest extends WallabagTestCase $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for 20minutes.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for 20minutes.fr is ok'); $this->assertCount(2, $content->getTags()); - - $content = $client->getContainer() - ->get(EntityManagerInterface::class) - ->getRepository(Entry::class) - ->findByUrlAndUserId( - 'https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html', - $this->getLoggedInUserId() - ); - - $this->assertInstanceOf(Entry::class, $content); - $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.lemonde.fr is ok'); - $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.lemonde.fr is ok'); - $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.lemonde.fr is ok'); } public function testImportWallabagWithEmptyFile() diff --git a/tests/fixtures/Import/firefox-bookmarks.json b/tests/fixtures/Import/firefox-bookmarks.json index 2491ea978..601572fee 100644 --- a/tests/fixtures/Import/firefox-bookmarks.json +++ b/tests/fixtures/Import/firefox-bookmarks.json @@ -36,16 +36,6 @@ "id": 4, "type": "text/x-moz-place", "uri": "https://www.20minutes.fr/sport/4002755-20220928-tarn-lapins-ravagent-terrain-match-rugby-doit-etre-annule" - }, - { - "guid": "E385l9vZ_LVn", - "title": "Le journaliste et cinéaste Claude Lanzmann est mort", - "index": 1, - "dateAdded": 1388166091544000, - "lastModified": 1388166091545000, - "id": 5, - "type": "text/x-moz-place", - "uri": "https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html" } ] }, diff --git a/tests/fixtures/Import/ril_export.html b/tests/fixtures/Import/ril_export.html index 310c092dc..0ca93ed6b 100644 --- a/tests/fixtures/Import/ril_export.html +++ b/tests/fixtures/Import/ril_export.html @@ -9,7 +9,6 @@

Unread

diff --git a/tests/fixtures/Import/shaarli-bookmarks.html b/tests/fixtures/Import/shaarli-bookmarks.html index ad401ea74..bbc40b14a 100644 --- a/tests/fixtures/Import/shaarli-bookmarks.html +++ b/tests/fixtures/Import/shaarli-bookmarks.html @@ -8,6 +8,6 @@

The Legacy of Firefox OS. In the two years or so since Mozilla… | by Ben Francis | Medium
In the two years or so since Mozilla announced the end of Firefox OS as a Mozilla-run project, the B2G source code has found its way into a surprising number of commercial products. -
Template Filters — Eleventy +

From d5d6b6861ee01e80f499c98cdf6797521a229ad4 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 15 Jul 2024 10:32:01 +0200 Subject: [PATCH 2/2] Fix tests --- tests/fixtures/Import/firefox-bookmarks.json | 10 ++++++++++ tests/fixtures/Import/ril_export.html | 1 + tests/fixtures/Import/shaarli-bookmarks.html | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/Import/firefox-bookmarks.json b/tests/fixtures/Import/firefox-bookmarks.json index 601572fee..49fed169a 100644 --- a/tests/fixtures/Import/firefox-bookmarks.json +++ b/tests/fixtures/Import/firefox-bookmarks.json @@ -36,6 +36,16 @@ "id": 4, "type": "text/x-moz-place", "uri": "https://www.20minutes.fr/sport/4002755-20220928-tarn-lapins-ravagent-terrain-match-rugby-doit-etre-annule" + }, + { + "guid": "E385l9vZ_LVn", + "title": "JO Paris 2024 : Où courir dans la capitale maintenant que les quais sont fermés ?", + "index": 1, + "dateAdded": 1388166091544000, + "lastModified": 1388166091545000, + "id": 5, + "type": "text/x-moz-place", + "uri": "https://www.20minutes.fr/paris/4100740-20240715-jo-paris-2024-courir-capitale-maintenant-quais-fermes" } ] }, diff --git a/tests/fixtures/Import/ril_export.html b/tests/fixtures/Import/ril_export.html index 0ca93ed6b..3a25056e9 100644 --- a/tests/fixtures/Import/ril_export.html +++ b/tests/fixtures/Import/ril_export.html @@ -9,6 +9,7 @@

Unread

diff --git a/tests/fixtures/Import/shaarli-bookmarks.html b/tests/fixtures/Import/shaarli-bookmarks.html index bbc40b14a..dd707c939 100644 --- a/tests/fixtures/Import/shaarli-bookmarks.html +++ b/tests/fixtures/Import/shaarli-bookmarks.html @@ -8,6 +8,6 @@

The Legacy of Firefox OS. In the two years or so since Mozilla… | by Ben Francis | Medium
In the two years or so since Mozilla announced the end of Firefox OS as a Mozilla-run project, the B2G source code has found its way into a surprising number of commercial products. -
+
Template Filters — Eleventy