From 12d93e6896f2d99b6329b7979ee7b6d11e457c3a Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 25 Sep 2016 22:24:07 +0200 Subject: Update Firefox file With real data, the previous looks more than a Chrome converted file. Also, fix date conversion (hope so). --- .../Controller/FirefoxControllerTest.php | 4 +- .../ImportBundle/Import/FirefoxImportTest.php | 10 +- .../ImportBundle/fixtures/firefox-bookmarks.json | 119 +++++++++++---------- 3 files changed, 67 insertions(+), 66 deletions(-) (limited to 'tests') diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index 10fbc225..dea5b79c 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php @@ -135,8 +135,8 @@ class FirefoxControllerTest extends WallabagCoreTestCase $this->assertEmpty($content->getLanguage()); $createdAt = $content->getCreatedAt(); - $this->assertEquals('2011', $createdAt->format('Y')); - $this->assertEquals('07', $createdAt->format('m')); + $this->assertEquals('2013', $createdAt->format('Y')); + $this->assertEquals('12', $createdAt->format('m')); } public function testImportWallabagWithEmptyFile() diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php index e8f0f3c7..007dda6a 100644 --- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php @@ -61,7 +61,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $entryRepo->expects($this->exactly(4)) + $entryRepo->expects($this->exactly(2)) ->method('findByUrlAndUserId') ->willReturn(false); @@ -75,14 +75,14 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->contentProxy - ->expects($this->exactly(4)) + ->expects($this->exactly(2)) ->method('updateEntry') ->willReturn($entry); $res = $firefoxImport->import(); $this->assertTrue($res); - $this->assertEquals(['skipped' => 0, 'imported' => 4, 'queued' => 0], $firefoxImport->getSummary()); + $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $firefoxImport->getSummary()); } public function testImportAndMarkAllAsRead() @@ -94,7 +94,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $entryRepo->expects($this->exactly(4)) + $entryRepo->expects($this->exactly(2)) ->method('findByUrlAndUserId') ->will($this->onConsecutiveCalls(false, true)); @@ -120,7 +120,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase $this->assertTrue($res); - $this->assertEquals(['skipped' => 3, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary()); + $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary()); } public function testImportWithRabbit() diff --git a/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json b/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json index 8b78b8a4..ee06a16c 100644 --- a/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json +++ b/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json @@ -1,61 +1,62 @@ { - "checksum": "ef1e30cddf64cb94c63d7835640165be", - "roots": { - "bookmark_bar": { - "children": [ { - "date_added": "13112787540531997", - "id": "7", - "name": "Terrorisme: les sombres prédictions du directeur de la DGSI", - "type": "url", - "url": "http://www.lefigaro.fr/actualite-france/2016/07/12/01016-20160712ARTFIG00016-terrorisme-les-sombres-perspectives-de-patrick-calvar-directeur-de-la-dgsi.php" - } ], - "date_added": "13112787380480144", - "date_modified": "13112787542724942", - "id": "1", - "name": "Bookmarks bar", - "type": "folder" - }, - "other": { - "children": [ { - "date_added": "13112787503900822", - "id": "6", - "name": "Parser for Exported Bookmarks HTML file of Google Chrome and Mozilla in Java - Stack Overflow", - "type": "url", - "url": "http://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java" - }, { - "children": [ { - "date_added": "13112787564443378", - "id": "9", - "name": "Orange offre un meilleur réseau mobile que Bouygues et SFR, Free derrière - L'Express L'Expansion", - "type": "url", - "url": "http://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html" - } ], - "date_added": "13112787556763735", - "date_modified": "13112794390493325", - "id": "8", - "name": "test", - "type": "folder" - }, { - "date_added": "13112794390493325", - "id": "12", - "name": "JSON Formatter & Validator", - "type": "url", - "url": "https://jsonformatter.curiousconcept.com/" - } ], - "date_added": "13112787380480151", - "date_modified": "13112794393509988", - "id": "2", - "name": "Other bookmarks", - "type": "folder" - }, - "synced": { - "children": [ ], - "date_added": "13112787380480155", - "date_modified": "0", - "id": "3", - "name": "Mobile bookmarks", - "type": "folder" - } - }, - "version": 1 + "guid": "root________", + "title": "", + "index": 0, + "dateAdded": 1388166091504000, + "lastModified": 1472897622350000, + "id": 1, + "type": "text/x-moz-place-container", + "root": "placesRoot", + "children": [ + { + "guid": "toolbar_____", + "title": "Barre personnelle", + "index": 1, + "dateAdded": 1388166091504000, + "lastModified": 1472897622263000, + "id": 3, + "annos": [ + { + "name": "bookmarkProperties/description", + "flags": 0, + "expires": 4, + "value": "Ajoutez des marque-pages dans ce dossier pour les voir apparaître sur votre barre personnelle" + } + ], + "type": "text/x-moz-place-container", + "root": "toolbarFolder", + "children": [ + { + "guid": "tard77lzbC5H", + "title": "Orange offre un meilleur réseau mobile que Bouygues et SFR, Free derrière - L'Express L'Expansion", + "index": 1, + "dateAdded": 1388166091644000, + "lastModified": 1388166091644000, + "id": 4, + "type": "text/x-moz-place", + "uri": "http://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html" + }, + { + "guid": "E385l9vZ_LVn", + "title": "Parser for Exported Bookmarks HTML file of Google Chrome and Mozilla in Java", + "index": 1, + "dateAdded": 1388166091544000, + "lastModified": 1388166091545000, + "id": 5, + "type": "text/x-moz-place", + "uri": "http://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java" + } + ] + }, + { + "guid": "unfiled_____", + "title": "Autres marque-pages", + "index": 3, + "dateAdded": 1388166091504000, + "lastModified": 1388166091542000, + "id": 6, + "type": "text/x-moz-place-container", + "root": "unfiledBookmarksFolder" + } + ] } -- cgit v1.2.3