aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php10
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json119
3 files changed, 67 insertions, 66 deletions
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
135 $this->assertEmpty($content->getLanguage()); 135 $this->assertEmpty($content->getLanguage());
136 136
137 $createdAt = $content->getCreatedAt(); 137 $createdAt = $content->getCreatedAt();
138 $this->assertEquals('2011', $createdAt->format('Y')); 138 $this->assertEquals('2013', $createdAt->format('Y'));
139 $this->assertEquals('07', $createdAt->format('m')); 139 $this->assertEquals('12', $createdAt->format('m'));
140 } 140 }
141 141
142 public function testImportWallabagWithEmptyFile() 142 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
61 ->disableOriginalConstructor() 61 ->disableOriginalConstructor()
62 ->getMock(); 62 ->getMock();
63 63
64 $entryRepo->expects($this->exactly(4)) 64 $entryRepo->expects($this->exactly(2))
65 ->method('findByUrlAndUserId') 65 ->method('findByUrlAndUserId')
66 ->willReturn(false); 66 ->willReturn(false);
67 67
@@ -75,14 +75,14 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
75 ->getMock(); 75 ->getMock();
76 76
77 $this->contentProxy 77 $this->contentProxy
78 ->expects($this->exactly(4)) 78 ->expects($this->exactly(2))
79 ->method('updateEntry') 79 ->method('updateEntry')
80 ->willReturn($entry); 80 ->willReturn($entry);
81 81
82 $res = $firefoxImport->import(); 82 $res = $firefoxImport->import();
83 83
84 $this->assertTrue($res); 84 $this->assertTrue($res);
85 $this->assertEquals(['skipped' => 0, 'imported' => 4, 'queued' => 0], $firefoxImport->getSummary()); 85 $this->assertEquals(['skipped' => 0, 'imported' => 2, 'queued' => 0], $firefoxImport->getSummary());
86 } 86 }
87 87
88 public function testImportAndMarkAllAsRead() 88 public function testImportAndMarkAllAsRead()
@@ -94,7 +94,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
94 ->disableOriginalConstructor() 94 ->disableOriginalConstructor()
95 ->getMock(); 95 ->getMock();
96 96
97 $entryRepo->expects($this->exactly(4)) 97 $entryRepo->expects($this->exactly(2))
98 ->method('findByUrlAndUserId') 98 ->method('findByUrlAndUserId')
99 ->will($this->onConsecutiveCalls(false, true)); 99 ->will($this->onConsecutiveCalls(false, true));
100 100
@@ -120,7 +120,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase
120 120
121 $this->assertTrue($res); 121 $this->assertTrue($res);
122 122
123 $this->assertEquals(['skipped' => 3, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary()); 123 $this->assertEquals(['skipped' => 1, 'imported' => 1, 'queued' => 0], $firefoxImport->getSummary());
124 } 124 }
125 125
126 public function testImportWithRabbit() 126 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 @@
1{ 1{
2 "checksum": "ef1e30cddf64cb94c63d7835640165be", 2 "guid": "root________",
3 "roots": { 3 "title": "",
4 "bookmark_bar": { 4 "index": 0,
5 "children": [ { 5 "dateAdded": 1388166091504000,
6 "date_added": "13112787540531997", 6 "lastModified": 1472897622350000,
7 "id": "7", 7 "id": 1,
8 "name": "Terrorisme: les sombres prédictions du directeur de la DGSI", 8 "type": "text/x-moz-place-container",
9 "type": "url", 9 "root": "placesRoot",
10 "url": "http://www.lefigaro.fr/actualite-france/2016/07/12/01016-20160712ARTFIG00016-terrorisme-les-sombres-perspectives-de-patrick-calvar-directeur-de-la-dgsi.php" 10 "children": [
11 } ], 11 {
12 "date_added": "13112787380480144", 12 "guid": "toolbar_____",
13 "date_modified": "13112787542724942", 13 "title": "Barre personnelle",
14 "id": "1", 14 "index": 1,
15 "name": "Bookmarks bar", 15 "dateAdded": 1388166091504000,
16 "type": "folder" 16 "lastModified": 1472897622263000,
17 }, 17 "id": 3,
18 "other": { 18 "annos": [
19 "children": [ { 19 {
20 "date_added": "13112787503900822", 20 "name": "bookmarkProperties/description",
21 "id": "6", 21 "flags": 0,
22 "name": "Parser for Exported Bookmarks HTML file of Google Chrome and Mozilla in Java - Stack Overflow", 22 "expires": 4,
23 "type": "url", 23 "value": "Ajoutez des marque-pages dans ce dossier pour les voir apparaître sur votre barre personnelle"
24 "url": "http://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java" 24 }
25 }, { 25 ],
26 "children": [ { 26 "type": "text/x-moz-place-container",
27 "date_added": "13112787564443378", 27 "root": "toolbarFolder",
28 "id": "9", 28 "children": [
29 "name": "Orange offre un meilleur réseau mobile que Bouygues et SFR, Free derrière - L'Express L'Expansion", 29 {
30 "type": "url", 30 "guid": "tard77lzbC5H",
31 "url": "http://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html" 31 "title": "Orange offre un meilleur réseau mobile que Bouygues et SFR, Free derrière - L'Express L'Expansion",
32 } ], 32 "index": 1,
33 "date_added": "13112787556763735", 33 "dateAdded": 1388166091644000,
34 "date_modified": "13112794390493325", 34 "lastModified": 1388166091644000,
35 "id": "8", 35 "id": 4,
36 "name": "test", 36 "type": "text/x-moz-place",
37 "type": "folder" 37 "uri": "http://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html"
38 }, { 38 },
39 "date_added": "13112794390493325", 39 {
40 "id": "12", 40 "guid": "E385l9vZ_LVn",
41 "name": "JSON Formatter & Validator", 41 "title": "Parser for Exported Bookmarks HTML file of Google Chrome and Mozilla in Java",
42 "type": "url", 42 "index": 1,
43 "url": "https://jsonformatter.curiousconcept.com/" 43 "dateAdded": 1388166091544000,
44 } ], 44 "lastModified": 1388166091545000,
45 "date_added": "13112787380480151", 45 "id": 5,
46 "date_modified": "13112794393509988", 46 "type": "text/x-moz-place",
47 "id": "2", 47 "uri": "http://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java"
48 "name": "Other bookmarks", 48 }
49 "type": "folder" 49 ]
50 }, 50 },
51 "synced": { 51 {
52 "children": [ ], 52 "guid": "unfiled_____",
53 "date_added": "13112787380480155", 53 "title": "Autres marque-pages",
54 "date_modified": "0", 54 "index": 3,
55 "id": "3", 55 "dateAdded": 1388166091504000,
56 "name": "Mobile bookmarks", 56 "lastModified": 1388166091542000,
57 "type": "folder" 57 "id": 6,
58 } 58 "type": "text/x-moz-place-container",
59 }, 59 "root": "unfiledBookmarksFolder"
60 "version": 1 60 }
61 ]
61} 62}