$this->assertEquals(1, $crawler->filter('input[type=file]')->count());
}
- public function testImportWallabagWithFile()
+ public function testImportWallabagWithFirefoxFile()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/import/browser');
$form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
- $file = new UploadedFile(__DIR__.'/../fixtures/bookmarks.json', 'Bookmarks');
+ $file = new UploadedFile(__DIR__.'/../fixtures/firefox-bookmarks.json', 'Bookmarks');
$data = [
'upload_import_file[file]' => $file,
$this->assertEmpty($content->getLanguage());
}
+ public function testImportWallabagWithChromeFile()
+ {
+ $this->logInAs('admin');
+ $client = $this->getClient();
+
+ $crawler = $client->request('GET', '/import/browser');
+ $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
+
+ $file = new UploadedFile(__DIR__.'/../fixtures/chrome-bookmarks', 'Bookmarks');
+
+ $data = [
+ 'upload_import_file[file]' => $file,
+ ];
+
+ $client->submit($form, $data);
+
+ $this->assertEquals(302, $client->getResponse()->getStatusCode());
+
+ $crawler = $client->followRedirect();
+
+ $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
+ $this->assertContains('flashes.import.notice.summary', $body[0]);
+
+ $content = $client->getContainer()
+ ->get('doctrine.orm.entity_manager')
+ ->getRepository('WallabagCoreBundle:Entry')
+ ->findByUrlAndUserId(
+ 'http://www.usinenouvelle.com/article/la-multiplication-des-chefs-de-projet-est-une-catastrophe-manageriale-majeure-affirme-le-sociologue-francois-dupuy.N307730',
+ $this->getLoggedInUserId()
+ );
+
+ $this->assertNotEmpty($content->getMimetype());
+ $this->assertNotEmpty($content->getPreviewPicture());
+ $this->assertNotEmpty($content->getLanguage());
+ $this->assertEquals(0, count($content->getTags()));
+ }
+
public function testImportWallabagWithEmptyFile()
{
$this->logInAs('admin');
--- /dev/null
+{
+ "checksum": "f3aa0e9c0edad632a246f7e98ec64918",
+ "roots": {
+ "bookmark_bar": {
+ "children": [ {
+ "date_added": "13118850929335823",
+ "id": "6",
+ "name": "\"La multiplication des chefs de projet est une catastrophe managériale majeure\", affirme le sociologue François Dupuy - Ressources humaines",
+ "type": "url",
+ "url": "http://www.usinenouvelle.com/article/la-multiplication-des-chefs-de-projet-est-une-catastrophe-manageriale-majeure-affirme-le-sociologue-francois-dupuy.N307730"
+ } ],
+ "date_added": "13118829474385693",
+ "date_modified": "13118850929335823",
+ "id": "1",
+ "name": "Barre de favoris",
+ "type": "folder"
+ },
+ "other": {
+ "children": [ ],
+ "date_added": "13118829474385701",
+ "date_modified": "0",
+ "id": "2",
+ "name": "Autres favoris",
+ "type": "folder"
+ },
+ "synced": {
+ "children": [ ],
+ "date_added": "13118829474385702",
+ "date_modified": "0",
+ "id": "3",
+ "name": "Favoris sur mobile",
+ "type": "folder"
+ }
+ },
+ "version": 1
+}