mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-23 17:41:01 +00:00
Merge pull request #1651 from wallabag/v2-fix-wllbgv2-import
Test if some keys are missing in v2 import
This commit is contained in:
commit
ae5b37ef2e
3 changed files with 34 additions and 4 deletions
|
@ -56,9 +56,15 @@ class WallabagV2Import extends WallabagV1Import implements ImportInterface
|
||||||
$entry->setContent($importedEntry['content']);
|
$entry->setContent($importedEntry['content']);
|
||||||
$entry->setReadingTime($importedEntry['reading_time']);
|
$entry->setReadingTime($importedEntry['reading_time']);
|
||||||
$entry->setDomainName($importedEntry['domain_name']);
|
$entry->setDomainName($importedEntry['domain_name']);
|
||||||
$entry->setMimetype($importedEntry['mimetype']);
|
if (isset($importedEntry['mimetype'])) {
|
||||||
$entry->setLanguage($importedEntry['language']);
|
$entry->setMimetype($importedEntry['mimetype']);
|
||||||
$entry->setPreviewPicture($importedEntry['preview_picture']);
|
}
|
||||||
|
if (isset($importedEntry['language'])) {
|
||||||
|
$entry->setLanguage($importedEntry['language']);
|
||||||
|
}
|
||||||
|
if (isset($importedEntry['preview_picture'])) {
|
||||||
|
$entry->setPreviewPicture($importedEntry['preview_picture']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->em->persist($entry);
|
$this->em->persist($entry);
|
||||||
++$this->importedEntries;
|
++$this->importedEntries;
|
||||||
|
|
|
@ -41,6 +41,30 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
|
||||||
|
|
||||||
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
|
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
|
||||||
$this->assertContains('Import summary', $alert[0]);
|
$this->assertContains('Import summary', $alert[0]);
|
||||||
|
|
||||||
|
$content = $client->getContainer()
|
||||||
|
->get('doctrine.orm.entity_manager')
|
||||||
|
->getRepository('WallabagCoreBundle:Entry')
|
||||||
|
->findByUrlAndUserId(
|
||||||
|
'http://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867',
|
||||||
|
$this->getLoggedInUserId()
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEmpty($content->getMimetype());
|
||||||
|
$this->assertEmpty($content->getPreviewPicture());
|
||||||
|
$this->assertEmpty($content->getLanguage());
|
||||||
|
|
||||||
|
$content = $client->getContainer()
|
||||||
|
->get('doctrine.orm.entity_manager')
|
||||||
|
->getRepository('WallabagCoreBundle:Entry')
|
||||||
|
->findByUrlAndUserId(
|
||||||
|
'https://www.mediapart.fr/',
|
||||||
|
$this->getLoggedInUserId()
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($content->getMimetype());
|
||||||
|
$this->assertNotEmpty($content->getPreviewPicture());
|
||||||
|
$this->assertNotEmpty($content->getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testImportWallabagWithEmptyFile()
|
public function testImportWallabagWithEmptyFile()
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue