Fix tests

This commit is contained in:
Jeremy Benoist 2024-07-15 13:11:18 +02:00
parent 580c5fe810
commit 898890c371
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
3 changed files with 8 additions and 25 deletions

View file

@ -17,9 +17,9 @@ use Wallabag\UserBundle\Entity\User;
class EntryControllerTest extends WallabagCoreTestCase 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 $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"]'; private $entryDataTestAttribute = '[data-test="entry"]';
/** /**
@ -175,9 +175,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertInstanceOf(Entry::class, $content); $this->assertInstanceOf(Entry::class, $content);
$this->assertSame($this->url, $content->getUrl()); $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->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); $client->getContainer()->get(Config::class)->set('store_article_headers', 0);
} }
@ -1218,7 +1218,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertInstanceOf(Entry::class, $entry); $this->assertInstanceOf(Entry::class, $entry);
$this->assertSame($url, $entry->getUrl()); $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 // 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()); $this->assertStringContainsString(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent());
@ -1499,7 +1499,7 @@ class EntryControllerTest extends WallabagCoreTestCase
'zh_CN', 'zh_CN',
], ],
'pt_BR' => [ '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', 'pt_BR',
], ],
'es-ES' => [ 'es-ES' => [

View file

@ -127,23 +127,6 @@ class FirefoxControllerTest extends WallabagCoreTestCase
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); $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->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
$this->assertCount(3, $content->getTags()); $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() public function testImportWallabagWithEmptyFile()

View file

@ -39,13 +39,13 @@
}, },
{ {
"guid": "E385l9vZ_LVn", "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, "index": 1,
"dateAdded": 1388166091544000, "dateAdded": 1388166091544000,
"lastModified": 1388166091545000, "lastModified": 1388166091545000,
"id": 5, "id": 5,
"type": "text/x-moz-place", "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"
} }
] ]
}, },