Merge pull request #1651 from wallabag/v2-fix-wllbgv2-import

Test if some keys are missing in v2 import
This commit is contained in:
Jeremy Benoist 2016-02-05 15:22:51 +01:00
commit ae5b37ef2e
3 changed files with 34 additions and 4 deletions

View file

@ -56,9 +56,15 @@ class WallabagV2Import extends WallabagV1Import implements ImportInterface
$entry->setContent($importedEntry['content']);
$entry->setReadingTime($importedEntry['reading_time']);
$entry->setDomainName($importedEntry['domain_name']);
if (isset($importedEntry['mimetype'])) {
$entry->setMimetype($importedEntry['mimetype']);
}
if (isset($importedEntry['language'])) {
$entry->setLanguage($importedEntry['language']);
}
if (isset($importedEntry['preview_picture'])) {
$entry->setPreviewPicture($importedEntry['preview_picture']);
}
$this->em->persist($entry);
++$this->importedEntries;

View file

@ -41,6 +41,30 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
$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()

File diff suppressed because one or more lines are too long