aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php20
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/readability.json167
2 files changed, 169 insertions, 18 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index 0981eedb..67917154 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -61,9 +61,9 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
61 ->disableOriginalConstructor() 61 ->disableOriginalConstructor()
62 ->getMock(); 62 ->getMock();
63 63
64 $entryRepo->expects($this->exactly(2)) 64 $entryRepo->expects($this->exactly(24))
65 ->method('findByUrlAndUserId') 65 ->method('findByUrlAndUserId')
66 ->will($this->onConsecutiveCalls(false, true)); 66 ->willReturn(false);
67 67
68 $this->em 68 $this->em
69 ->expects($this->any()) 69 ->expects($this->any())
@@ -75,14 +75,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
75 ->getMock(); 75 ->getMock();
76 76
77 $this->contentProxy 77 $this->contentProxy
78 ->expects($this->exactly(1)) 78 ->expects($this->exactly(24))
79 ->method('updateEntry') 79 ->method('updateEntry')
80 ->willReturn($entry); 80 ->willReturn($entry);
81 81
82 $res = $readabilityImport->import(); 82 $res = $readabilityImport->import();
83 83
84 $this->assertTrue($res); 84 $this->assertTrue($res);
85 $this->assertEquals(['skipped' => 1, 'imported' => 1], $readabilityImport->getSummary()); 85 $this->assertEquals(['skipped' => 0, 'imported' => 24], $readabilityImport->getSummary());
86 } 86 }
87 87
88 public function testImportAndMarkAllAsRead() 88 public function testImportAndMarkAllAsRead()
@@ -96,7 +96,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
96 96
97 $entryRepo->expects($this->exactly(2)) 97 $entryRepo->expects($this->exactly(2))
98 ->method('findByUrlAndUserId') 98 ->method('findByUrlAndUserId')
99 ->will($this->onConsecutiveCalls(false, false)); 99 ->will($this->onConsecutiveCalls(false, true));
100 100
101 $this->em 101 $this->em
102 ->expects($this->any()) 102 ->expects($this->any())
@@ -104,7 +104,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
104 ->willReturn($entryRepo); 104 ->willReturn($entryRepo);
105 105
106 $this->contentProxy 106 $this->contentProxy
107 ->expects($this->exactly(2)) 107 ->expects($this->exactly(1))
108 ->method('updateEntry') 108 ->method('updateEntry')
109 ->willReturn(new Entry($this->user)); 109 ->willReturn(new Entry($this->user));
110 110
@@ -120,7 +120,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
120 120
121 $this->assertTrue($res); 121 $this->assertTrue($res);
122 122
123 $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); 123 $this->assertEquals(['skipped' => 1, 'imported' => 1], $readabilityImport->getSummary());
124 } 124 }
125 125
126 public function testImportWithRabbit() 126 public function testImportWithRabbit()
@@ -152,7 +152,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
152 ->getMock(); 152 ->getMock();
153 153
154 $producer 154 $producer
155 ->expects($this->exactly(2)) 155 ->expects($this->exactly(24))
156 ->method('publish'); 156 ->method('publish');
157 157
158 $readabilityImport->setProducer($producer); 158 $readabilityImport->setProducer($producer);
@@ -160,7 +160,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
160 $res = $readabilityImport->setMarkAsRead(true)->import(); 160 $res = $readabilityImport->setMarkAsRead(true)->import();
161 161
162 $this->assertTrue($res); 162 $this->assertTrue($res);
163 $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); 163 $this->assertEquals(['skipped' => 0, 'imported' => 24], $readabilityImport->getSummary());
164 } 164 }
165 165
166 public function testImportWithRedis() 166 public function testImportWithRedis()
@@ -198,7 +198,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
198 $res = $readabilityImport->setMarkAsRead(true)->import(); 198 $res = $readabilityImport->setMarkAsRead(true)->import();
199 199
200 $this->assertTrue($res); 200 $this->assertTrue($res);
201 $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); 201 $this->assertEquals(['skipped' => 0, 'imported' => 24], $readabilityImport->getSummary());
202 202
203 $this->assertNotEmpty($redisMock->lpop('readability')); 203 $this->assertNotEmpty($redisMock->lpop('readability'));
204 } 204 }
diff --git a/tests/Wallabag/ImportBundle/fixtures/readability.json b/tests/Wallabag/ImportBundle/fixtures/readability.json
index 34379905..32f6fa53 100644
--- a/tests/Wallabag/ImportBundle/fixtures/readability.json
+++ b/tests/Wallabag/ImportBundle/fixtures/readability.json
@@ -11,14 +11,165 @@
11 "archive": false 11 "archive": false
12 }, 12 },
13 { 13 {
14 "article__excerpt": "TL;DR: Re-use your DOM elements and remove the ones that are far away from the viewport. Use placeholders to account for delayed data. Here’s a demo and the code for the infinite…", 14 "article__title": "Réfugiés: l'UE va créer 100 000 places d'accueil dans les Balkans",
15 "favorite": false, 15 "article__url": "http://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867",
16 "date_archived": "2016-08-26T12:21:54", 16 "archive": false,
17 "article__url": "https://developers.google.com/web/updates/2016/07/infinite-scroller?imm_mid=0e6839&cmp=em-webops-na-na-newsltr_20160805", 17 "date_added": "2016-09-08T11:55:58+0200",
18 "date_added": "2016-08-06T05:35:26", 18 "favorite": false
19 "date_favorited": null, 19 },
20 "article__title": "Complexities of an infinite scroller | Web Updates", 20 {
21 "archive": true 21 "article__title": "No title found",
22 "article__url": "http://news.nationalgeographic.com/2016/02/160211-albatrosses-mothers-babies-animals-science/&sf20739758=1",
23 "archive": false,
24 "date_added": "2016-09-08T11:55:58+0200",
25 "favorite": true
26 },
27 {
28 "archive": 0,
29 "date_added": "2016-09-08T11:55:58+0200",
30 "favorite": 0,
31 "article__title": "Échecs",
32 "article__url": "https://fr.wikipedia.org/wiki/Échecs"
33 },
34 {
35 "archive": 0,
36 "date_added": "2016-09-08T11:55:58+0200",
37 "favorite": 0,
38 "article__title": "90% des dossiers médicaux des Coréens du sud vendus à des entreprises privées - ZATAZ",
39 "article__url": "http://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/"
40 },
41 {
42 "archive": 0,
43 "date_added": "2016-09-08T11:55:58+0200",
44 "favorite": 0,
45 "article__title": "Mass Surveillance As Art",
46 "article__url": "https://www.nationaljournal.com/s/73311/mass-surveillance-art"
47 },
48 {
49 "archive": 0,
50 "date_added": "2016-09-08T11:55:58+0200",
51 "favorite": 0,
52 "article__title": "What David Cameron did to the pig, his party is now doing to the country",
53 "article__url": "http://www.newstatesman.com/2015/09/what-david-cameron-did-pig-his-party-now-doing-country"
54 },
55 {
56 "archive": 1,
57 "date_added": "2016-09-08T11:55:58+0200",
58 "favorite": 0,
59 "article__title": "CLICK HERE to support 2016 CES Winner, Revolutionary Auto-Tracking Robot",
60 "article__url": "https://www.indiegogo.com/projects/2016-ces-winner-revolutionary-auto-tracking-robot"
61 },
62 {
63 "archive": 0,
64 "date_added": "2016-09-08T11:55:58+0200",
65 "favorite": 1,
66 "article__title": "No title found",
67 "article__url": "http://carnetdevol.shost.ca/wordpress/aide-memoire-sur-les-commandes-associees-a-systemd/"
68 },
69 {
70 "archive": 1,
71 "date_added": "2016-09-08T11:55:58+0200",
72 "favorite": 0,
73 "article__title": "Présentation d'Arduino - Tuto Arduino - Le blog d'Eskimon",
74 "article__url": "http://eskimon.fr/73-arduino-101-presentation"
75 },
76 {
77 "archive": 1,
78 "date_added": "2016-09-08T11:55:58+0200",
79 "favorite": 0,
80 "article__title": "Lenovo ThinkPad X1 Carbon Ultrabook Review",
81 "article__url": "http://www.notebookcheck.net/Lenovo-ThinkPad-X1-Carbon-Ultrabook-Review.138033.0.html"
82 },
83 {
84 "archive": 0,
85 "date_added": "2016-09-08T11:55:58+0200",
86 "favorite": 0,
87 "article__title": "Visitons le Château de Landsberg !",
88 "article__url": "http://autour-du-mont-sainte-odile.overblog.com/2016/01/visitons-le-chateau-de-landsberg.html"
89 },
90 {
91 "archive": 1,
92 "date_added": "2016-09-08T11:55:58+0200",
93 "favorite": 0,
94 "article__title": "Contrer les stéréotypes par les livres : “C'est dès l'enfance qu'ils se construisent”",
95 "article__url": "https://www.actualitte.com/article/monde-edition/contrer-les-stereotypes-par-les-livres-c-est-des-l-enfance-qu-ils-se-construisent/64058"
96 },
97 {
98 "archive": 1,
99 "date_added": "2016-09-08T11:55:58+0200",
100 "favorite": 0,
101 "article__title": "[ROM][6.0.1][Layers][N5] TipsyOS official builds {UBER TCs}",
102 "article__url": "http://forum.xda-developers.com/google-nexus-5/development/rom-tipsyos-official-builds-uber-tcs-t3325989"
103 },
104 {
105 "archive": 0,
106 "date_added": "2016-09-08T11:55:58+0200",
107 "favorite": 0,
108 "article__title": "Top 15 Podcasts All Web Developers Should Follow - Envato Tuts+ Code Article",
109 "article__url": "http://code.tutsplus.com/articles/top-15-podcasts-all-web-developers-should-follow--net-14461"
110 },
111 {
112 "archive": 1,
113 "date_added": "2016-09-08T11:55:58+0200",
114 "favorite": 0,
115 "article__title": "University of Mississippi",
116 "article__url": "http://olemiss.edu"
117 },
118 {
119 "archive": 1,
120 "date_added": "2016-09-08T11:55:58+0200",
121 "favorite": 0,
122 "article__title": "FinnChristiansen.de Jetzt Dank Let’s Encrypt Per HTTPS Erreichbar",
123 "article__url": "https://www.finnchristiansen.de/2015/12/06/finnchristiansen-de-jetzt-dank-lets-encrypt-per-https-erreichbar/"
124 },
125 {
126 "archive": 1,
127 "date_added": "2016-09-08T11:55:58+0200",
128 "favorite": 0,
129 "article__title": "Le développeur et l'ingénierie logicielle",
130 "article__url": "http://wemucs.com/le-developpeur-et-lingenierie-logicielle/"
131 },
132 {
133 "archive": 1,
134 "date_added": "2016-09-08T11:55:58+0200",
135 "favorite": 0,
136 "article__title": "The Role of Methylation in Gene Expression",
137 "article__url": "http://www.nature.com/scitable/topicpage/the-role-of-methylation-in-gene-expression-1070"
138 },
139 {
140 "archive": 1,
141 "date_added": "2016-09-08T11:55:58+0200",
142 "favorite": 0,
143 "article__title": "E-Mail-Adresse kostenlos, FreeMail, De-Mail & Nachrichten",
144 "article__url": "http://web.de"
145 },
146 {
147 "archive": 1,
148 "date_added": "2016-09-08T11:55:58+0200",
149 "favorite": 0,
150 "article__title": "OpenSSH Server on Arch Linux | DominicM test",
151 "article__url": "http://dominicm.com/openssh-server-arch-linux/"
152 },
153 {
154 "archive": 1,
155 "date_added": "2016-09-08T11:55:58+0200",
156 "favorite": 0,
157 "article__title": "Site Moved | Site Help",
158 "article__url": "http://g1.com/help/sitemoved.asp"
159 },
160 {
161 "archive": 1,
162 "date_added": "2016-09-08T11:55:58+0200",
163 "favorite": 0,
164 "article__title": "#Maroc : le stylo anti-pédophiles EAGLE d’AMESYS est moins bien configuré que les faux-lowers Twitter du roi Mohammed VI",
165 "article__url": "https://reflets.info/maroc-le-stylo-anti-pedophiles-eagle-damesys-est-moins-bien-configure-que-les-faux-lowers-twitter-du-roi-mohammed-vi/"
166 },
167 {
168 "archive": 1,
169 "date_added": "2016-09-08T11:55:58+0200",
170 "favorite": 0,
171 "article__title": "Simple Cloud Infrastructure for Developers",
172 "article__url": "https://www.digitalocean.com/"
22 } 173 }
23 ], 174 ],
24 "recommendations": [] 175 "recommendations": []