aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-09 20:45:30 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-11 21:58:56 +0200
commit7f7531171f6e49110b5842f869e37c766a682473 (patch)
tree8709a30b2d4b1dca8515db22607b998cc943550c
parent13470c3596d0b1490bbf18b39128a05bbb3c7f3e (diff)
downloadwallabag-7f7531171f6e49110b5842f869e37c766a682473.tar.gz
wallabag-7f7531171f6e49110b5842f869e37c766a682473.tar.zst
wallabag-7f7531171f6e49110b5842f869e37c766a682473.zip
Retrieve created date from Pocket
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php4
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php27
2 files changed, 31 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index d76a3a08..fe39d33f 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -254,6 +254,10 @@ class PocketImport extends AbstractImport
254 ); 254 );
255 } 255 }
256 256
257 if (!empty($importedEntry['time_added'])) {
258 $entry->setCreatedAt((new \DateTime())->setTimestamp($importedEntry['time_added']));
259 }
260
257 $this->em->persist($entry); 261 $this->em->persist($entry);
258 ++$this->importedEntries; 262 ++$this->importedEntries;
259 263
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index 5ad3e435..1750e3a1 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -165,10 +165,16 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
165 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 165 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
166 "favorite": "1", 166 "favorite": "1",
167 "status": "1", 167 "status": "1",
168 "time_added": "1473020899",
169 "time_updated": "1473020899",
170 "time_read": "0",
171 "time_favorited": "0",
172 "sort_id": 0,
168 "resolved_title": "The Massive Ryder Cup Preview", 173 "resolved_title": "The Massive Ryder Cup Preview",
169 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", 174 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
170 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 175 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
171 "is_article": "1", 176 "is_article": "1",
177 "is_index": "0",
172 "has_video": "1", 178 "has_video": "1",
173 "has_image": "1", 179 "has_image": "1",
174 "word_count": "3197", 180 "word_count": "3197",
@@ -212,10 +218,16 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
212 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 218 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
213 "favorite": "1", 219 "favorite": "1",
214 "status": "1", 220 "status": "1",
221 "time_added": "1473020899",
222 "time_updated": "1473020899",
223 "time_read": "0",
224 "time_favorited": "0",
225 "sort_id": 1,
215 "resolved_title": "The Massive Ryder Cup Preview", 226 "resolved_title": "The Massive Ryder Cup Preview",
216 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", 227 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
217 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 228 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
218 "is_article": "1", 229 "is_article": "1",
230 "is_index": "0",
219 "has_video": "0", 231 "has_video": "0",
220 "has_image": "0", 232 "has_image": "0",
221 "word_count": "3197" 233 "word_count": "3197"
@@ -278,6 +290,11 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
278 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 290 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
279 "favorite": "1", 291 "favorite": "1",
280 "status": "1", 292 "status": "1",
293 "time_added": "1473020899",
294 "time_updated": "1473020899",
295 "time_read": "0",
296 "time_favorited": "0",
297 "sort_id": 0,
281 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 298 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
282 "is_article": "1", 299 "is_article": "1",
283 "has_video": "1", 300 "has_video": "1",
@@ -291,6 +308,11 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
291 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 308 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
292 "favorite": "1", 309 "favorite": "1",
293 "status": "0", 310 "status": "0",
311 "time_added": "1473020899",
312 "time_updated": "1473020899",
313 "time_read": "0",
314 "time_favorited": "0",
315 "sort_id": 1,
294 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 316 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",
295 "is_article": "1", 317 "is_article": "1",
296 "has_video": "0", 318 "has_video": "0",
@@ -358,6 +380,11 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
358 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", 380 "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland",
359 "favorite": "1", 381 "favorite": "1",
360 "status": "1", 382 "status": "1",
383 "time_added": "1473020899",
384 "time_updated": "1473020899",
385 "time_read": "0",
386 "time_favorited": "0",
387 "sort_id": 0,
361 "resolved_title": "The Massive Ryder Cup Preview", 388 "resolved_title": "The Massive Ryder Cup Preview",
362 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", 389 "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview",
363 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", 390 "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.",