From 898890c3715fb486076df1c5e4e1c050592dd2b2 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 15 Jul 2024 13:11:18 +0200 Subject: [PATCH] Fix tests --- .../Controller/EntryControllerTest.php | 12 ++++++------ .../Controller/FirefoxControllerTest.php | 17 ----------------- .../fixtures/firefox-bookmarks.json | 4 ++-- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index db5555cda..35d6e8f90 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -17,9 +17,9 @@ use Wallabag\UserBundle\Entity\User; class EntryControllerTest extends WallabagCoreTestCase { - 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 WallabagCoreTestCase $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); } @@ -1218,7 +1218,7 @@ class EntryControllerTest extends WallabagCoreTestCase $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()); @@ -1499,7 +1499,7 @@ class EntryControllerTest extends WallabagCoreTestCase 'zh_CN', ], 'pt_BR' => [ - 'https://esportes.r7.com/lance/futebol/victor-hugo-e-matheus-franca-devem-desfalcar-flamengo-no-carioca-22112022', + 'https://esportes.r7.com/lance/futebol/victor-hugo-e-matheus-franca-devem-desfalcar-flamengo-no-carioca-22112022/', 'pt_BR', ], 'es-ES' => [ diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index 1c30d6b0a..f6dfff4c8 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php @@ -127,23 +127,6 @@ class FirefoxControllerTest extends WallabagCoreTestCase $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.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/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json b/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json index 2491ea978..49fed169a 100644 --- a/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json +++ b/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json @@ -39,13 +39,13 @@ }, { "guid": "E385l9vZ_LVn", - "title": "Le journaliste et cinéaste Claude Lanzmann est mort", + "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.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html" + "uri": "https://www.20minutes.fr/paris/4100740-20240715-jo-paris-2024-courir-capitale-maintenant-quais-fermes" } ] },