Merge pull request #7577 from wallabag/fix/tests

Fix tests
This commit is contained in:
Jérémy Benoist 2024-07-15 10:52:32 +02:00 committed by GitHub
commit 89252f39c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 23 additions and 66 deletions

12
composer.lock generated
View file

@ -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",

View file

@ -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',
]);

View file

@ -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());

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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"
}
]
},

View file

@ -9,7 +9,7 @@
<h1>Unread</h1>
<ul>
<li><a href="https://www.20minutes.fr/sport/4002755-20220928-tarn-lapins-ravagent-terrain-match-rugby-doit-etre-annule" time_added="1688628695" tags="ifttt,new_entry_simple">Tarn : Des lapins ravagent le terrain, le match de rugby doit être annulé</a></li>
<li><a href="https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html" time_added="1688627412" tags="ifttt,new_entry_simple">Le journaliste et cinéaste Claude Lanzmann est mort</a></li>
<li><a href="https://www.20minutes.fr/paris/4100740-20240715-jo-paris-2024-courir-capitale-maintenant-quais-fermes" time_added="1688627412" tags="ifttt,new_entry_simple">JO Paris 2024 : Où courir dans la capitale maintenant que les quais sont fermés ?</a></li>
</ul>

View file

@ -8,6 +8,6 @@
<DL><p>
<DT><A HREF="https://www.20minutes.fr/sport/4002755-20220928-tarn-lapins-ravagent-terrain-match-rugby-doit-etre-annule" ADD_DATE="1686813518" LAST_MODIFIED="1686813519" PRIVATE="0" TAGS="firefoxos">The Legacy of Firefox OS. In the two years or so since Mozilla… | by Ben Francis | Medium</A>
<DD>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.
<DT><A HREF="https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html" ADD_DATE="1683376565" LAST_MODIFIED="1683376571" PRIVATE="0" TAGS="eleventy,this,javascript,filter,data">Template Filters — Eleventy</A>
<DT><A HREF="https://www.20minutes.fr/paris/4100740-20240715-jo-paris-2024-courir-capitale-maintenant-quais-fermes" ADD_DATE="1683376565" LAST_MODIFIED="1683376571" PRIVATE="0" TAGS="eleventy,this,javascript,filter,data">Template Filters — Eleventy</A>
</DL><p>
<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script>