mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-02 16:38:38 +00:00
PocketCsvImport: rework test to ensure we import all entries
This also adds a test for #8217 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
27d66d9e1d
commit
c4240c866b
2 changed files with 26 additions and 11 deletions
|
@ -114,19 +114,32 @@ class PocketCsvControllerTest extends WallabagCoreTestCase
|
||||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||||
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
|
||||||
|
|
||||||
$content = $client->getContainer()
|
$entries = $client->getContainer()
|
||||||
->get(EntityManagerInterface::class)
|
->get(EntityManagerInterface::class)
|
||||||
->getRepository(Entry::class)
|
->getRepository(Entry::class)
|
||||||
->findByUrlAndUserId(
|
->findBy(['user' => $this->getLoggedInUserId()]);
|
||||||
'https://jp-lambert.me/est-ce-que-jai-besoin-d-un-scrum-master-604f5a471c73',
|
|
||||||
$this->getLoggedInUserId()
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertInstanceOf(Entry::class, $content);
|
$expectedEntries = [
|
||||||
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for jp-lambert.me is ok');
|
'http://youmightnotneedjquery.com/,1600322788',
|
||||||
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for jp-lambert.me is ok');
|
'https://jp-lambert.me/est-ce-que-jai-besoin-d-un-scrum-master-604f5a471c73',
|
||||||
$this->assertNotEmpty($content->getLanguage(), 'Language for jp-lambert.me is ok');
|
'https://www.monde-diplomatique.fr/2020/09/HALIMI/62165',
|
||||||
$this->assertCount(1, $content->getTags());
|
'https://www.reddit.com/r/DataHoarder/comments/ioupbk/archivebox_question_how_do_i_import_links_from_a/',
|
||||||
|
'https://www.numerama.com/politique/646826-tu-vas-pleurer-les-premieres-fois-que-se-passe-t-il-au-sein-du-studio-dubisoft-derriere-trackmania.html#utm_medium=distibuted&utm_source=rss&utm_campaign=646826',
|
||||||
|
'https://www.nouvelobs.com/rue89/20200911.OBS33165/comment-konbini-s-est-fait-pieger-par-un-pere-masculiniste.html',
|
||||||
|
'https://reporterre.net/Des-abeilles-pour-resoudre-les-conflits-entre-les-humains-et-les-elephants',
|
||||||
|
];
|
||||||
|
|
||||||
|
$matchedEntries = array_map(function ($expectedUrl) use ($entries) {
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
if ($entry->getUrl() === $expectedUrl) {
|
||||||
|
return $entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}, $expectedEntries);
|
||||||
|
|
||||||
|
$this->assertCount(\count($expectedEntries), $matchedEntries, 'Should have 7 entries imported from pocket.csv');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testImportWallabagWithEmptyFile()
|
public function testImportWallabagWithEmptyFile()
|
||||||
|
|
|
@ -5,4 +5,6 @@ Est-ce que j’ai besoin d’un Scrum Master ? | by Jean-Pierre Lambert | Jean-,
|
||||||
ArchiveBox question: How do I import links from a RSS feed?,https://www.reddit.com/r/DataHoarder/comments/ioupbk/archivebox_question_how_do_i_import_links_from_a/,1600961496,,archive
|
ArchiveBox question: How do I import links from a RSS feed?,https://www.reddit.com/r/DataHoarder/comments/ioupbk/archivebox_question_how_do_i_import_links_from_a/,1600961496,,archive
|
||||||
« Tu vas pleurer les premières fois » : que se passe-t-il au sein du studio,https://www.numerama.com/politique/646826-tu-vas-pleurer-les-premieres-fois-que-se-passe-t-il-au-sein-du-studio-dubisoft-derriere-trackmania.html#utm_medium=distibuted&utm_source=rss&utm_campaign=646826,1599809025,,unread
|
« Tu vas pleurer les premières fois » : que se passe-t-il au sein du studio,https://www.numerama.com/politique/646826-tu-vas-pleurer-les-premieres-fois-que-se-passe-t-il-au-sein-du-studio-dubisoft-derriere-trackmania.html#utm_medium=distibuted&utm_source=rss&utm_campaign=646826,1599809025,,unread
|
||||||
Comment Konbini s’est fait piéger par un « père masculiniste »,https://www.nouvelobs.com/rue89/20200911.OBS33165/comment-konbini-s-est-fait-pieger-par-un-pere-masculiniste.html,1599819251,,archive
|
Comment Konbini s’est fait piéger par un « père masculiniste »,https://www.nouvelobs.com/rue89/20200911.OBS33165/comment-konbini-s-est-fait-pieger-par-un-pere-masculiniste.html,1599819251,,archive
|
||||||
Des abeilles pour résoudre les « conflits » entre les humains et les élépha,https://reporterre.net/Des-abeilles-pour-resoudre-les-conflits-entre-les-humains-et-les-elephants,1599890673,,unread
|
"Des abeilles pour résoudre les « conflits » entre les humains
|
||||||
|
|
||||||
|
et les élépha",https://reporterre.net/Des-abeilles-pour-resoudre-les-conflits-entre-les-humains-et-les-elephants,1599890673,,unread
|
|
Loading…
Add table
Add a link
Reference in a new issue