aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-01-06 06:34:57 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-01-07 21:00:04 +0100
commitb88cf91fc8371194df78e690983c61ea94f266cd (patch)
treeea9d934eb7a593de8cd69ea28e014a44702b23c7 /src/Wallabag/ImportBundle
parentd1af8ad4dbf7f3ce5170655c2fa8403406283039 (diff)
downloadwallabag-b88cf91fc8371194df78e690983c61ea94f266cd.tar.gz
wallabag-b88cf91fc8371194df78e690983c61ea94f266cd.tar.zst
wallabag-b88cf91fc8371194df78e690983c61ea94f266cd.zip
updated tests
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php6
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php7
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/services.yml2
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig2
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig2
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig2
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php2
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php2
8 files changed, 9 insertions, 16 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 9b82720a..cdcec1e2 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -11,7 +11,6 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
11use Wallabag\CoreBundle\Entity\Entry; 11use Wallabag\CoreBundle\Entity\Entry;
12use Wallabag\CoreBundle\Entity\Tag; 12use Wallabag\CoreBundle\Entity\Tag;
13use Wallabag\CoreBundle\Helper\ContentProxy; 13use Wallabag\CoreBundle\Helper\ContentProxy;
14use Symfony\Component\Translation\TranslatorInterface;
15 14
16class PocketImport implements ImportInterface 15class PocketImport implements ImportInterface
17{ 16{
@@ -26,14 +25,13 @@ class PocketImport implements ImportInterface
26 protected $accessToken; 25 protected $accessToken;
27 private $translator; 26 private $translator;
28 27
29 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey, TranslatorInterface $translator) 28 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey)
30 { 29 {
31 $this->user = $tokenStorage->getToken()->getUser(); 30 $this->user = $tokenStorage->getToken()->getUser();
32 $this->em = $em; 31 $this->em = $em;
33 $this->contentProxy = $contentProxy; 32 $this->contentProxy = $contentProxy;
34 $this->consumerKey = $consumerKey; 33 $this->consumerKey = $consumerKey;
35 $this->logger = new NullLogger(); 34 $this->logger = new NullLogger();
36 $this->translator = $translator;
37 } 35 }
38 36
39 public function setLogger(LoggerInterface $logger) 37 public function setLogger(LoggerInterface $logger)
@@ -62,7 +60,7 @@ class PocketImport implements ImportInterface
62 */ 60 */
63 public function getDescription() 61 public function getDescription()
64 { 62 {
65 return $this->translator->trans("This importer will import all your <a href=\"https://getpocket.com\">Pocket</a> data. Pocket doesn't allow us to retrieve content from their service, so the readable content of each article will be re-fetched by wallabag."); 63 return 'This importer will import all your Pocket data. Pocket doesn\'t allow us to retrieve content from their service, so the readable content of each article will be re-fetched by wallabag.';
66 } 64 }
67 65
68 /** 66 /**
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
index 68f0574f..393089d6 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
@@ -5,7 +5,6 @@ namespace Wallabag\ImportBundle\Import;
5use Psr\Log\LoggerInterface; 5use Psr\Log\LoggerInterface;
6use Psr\Log\NullLogger; 6use Psr\Log\NullLogger;
7use Doctrine\ORM\EntityManager; 7use Doctrine\ORM\EntityManager;
8use Symfony\Component\Translation\TranslatorInterface;
9use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\UserBundle\Entity\User; 9use Wallabag\UserBundle\Entity\User;
11use Wallabag\CoreBundle\Tools\Utils; 10use Wallabag\CoreBundle\Tools\Utils;
@@ -18,13 +17,11 @@ class WallabagV1Import implements ImportInterface
18 private $skippedEntries = 0; 17 private $skippedEntries = 0;
19 private $importedEntries = 0; 18 private $importedEntries = 0;
20 private $filepath; 19 private $filepath;
21 private $translator;
22 20
23 public function __construct(EntityManager $em, TranslatorInterface $translator) 21 public function __construct(EntityManager $em)
24 { 22 {
25 $this->em = $em; 23 $this->em = $em;
26 $this->logger = new NullLogger(); 24 $this->logger = new NullLogger();
27 $this->translator = $translator;
28 } 25 }
29 26
30 public function setLogger(LoggerInterface $logger) 27 public function setLogger(LoggerInterface $logger)
@@ -66,7 +63,7 @@ class WallabagV1Import implements ImportInterface
66 */ 63 */
67 public function getDescription() 64 public function getDescription()
68 { 65 {
69 return $this->translator->trans('This importer will import all your wallabag v1 articles. On your config page, click on "JSON export" in the "Export your wallabag data" section. You will have a "wallabag-export-1-xxxx-xx-xx.json" file.'); 66 return 'This importer will import all your wallabag v1 articles. On your config page, click on "JSON export" in the "Export your wallabag data" section. You will have a "wallabag-export-1-xxxx-xx-xx.json" file.';
70 } 67 }
71 68
72 /** 69 /**
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml
index 55348ce7..e4dde100 100644
--- a/src/Wallabag/ImportBundle/Resources/config/services.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/services.yml
@@ -18,7 +18,6 @@ services:
18 - "@doctrine.orm.entity_manager" 18 - "@doctrine.orm.entity_manager"
19 - "@wallabag_core.content_proxy" 19 - "@wallabag_core.content_proxy"
20 - %pocket_consumer_key% 20 - %pocket_consumer_key%
21 - "@translator"
22 calls: 21 calls:
23 - [ setClient, [ "@wallabag_import.pocket.client" ] ] 22 - [ setClient, [ "@wallabag_import.pocket.client" ] ]
24 - [ setLogger, [ "@logger" ]] 23 - [ setLogger, [ "@logger" ]]
@@ -29,7 +28,6 @@ services:
29 class: Wallabag\ImportBundle\Import\WallabagV1Import 28 class: Wallabag\ImportBundle\Import\WallabagV1Import
30 arguments: 29 arguments:
31 - "@doctrine.orm.entity_manager" 30 - "@doctrine.orm.entity_manager"
32 - "@translator"
33 calls: 31 calls:
34 - [ setLogger, [ "@logger" ]] 32 - [ setLogger, [ "@logger" ]]
35 tags: 33 tags:
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig
index 1f0addca..303e6cbf 100644
--- a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig
+++ b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig
@@ -10,7 +10,7 @@
10 {% for import in imports %} 10 {% for import in imports %}
11 <li> 11 <li>
12 <h5>{{ import.name }}</h5> 12 <h5>{{ import.name }}</h5>
13 <blockquote>{{ import.description|raw }}</blockquote> 13 <blockquote>{{ import.description|trans }}</blockquote>
14 <p><a class="waves-effect waves-light btn" href="{{ path(import.url) }}">{% trans %}Import contents{% endtrans %}</a></p> 14 <p><a class="waves-effect waves-light btn" href="{{ path(import.url) }}">{% trans %}Import contents{% endtrans %}</a></p>
15 </li> 15 </li>
16 {% endfor %} 16 {% endfor %}
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
index 58053780..643ad775 100644
--- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
+++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
@@ -5,7 +5,7 @@
5<div class="row"> 5<div class="row">
6 <div class="col s12"> 6 <div class="col s12">
7 <div class="card-panel settings"> 7 <div class="card-panel settings">
8 <blockquote>{{ import.description|raw }}</blockquote> 8 <blockquote>{{ import.description|trans }}</blockquote>
9 <p>{% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %}</p> 9 <p>{% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %}</p>
10 <form method="post" action="{{ path('import_pocket_auth') }}"> 10 <form method="post" action="{{ path('import_pocket_auth') }}">
11 <button class="btn waves-effect waves-light" type="submit" name="action"> 11 <button class="btn waves-effect waves-light" type="submit" name="action">
diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig
index afc57226..1359f2e4 100644
--- a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig
+++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig
@@ -6,7 +6,7 @@
6 <div class="col s12"> 6 <div class="col s12">
7 <div class="card-panel settings"> 7 <div class="card-panel settings">
8 <div class="row"> 8 <div class="row">
9 <blockquote>{{ import.description|raw }}</blockquote> 9 <blockquote>{{ import.description|trans }}</blockquote>
10 <p>{% trans %}Please select your wallabag export and click on the below button to upload and import it.{% endtrans %}</p> 10 <p>{% trans %}Please select your wallabag export and click on the below button to upload and import it.{% endtrans %}</p>
11 <div class="col s12"> 11 <div class="col s12">
12 {{ form_start(form, {'method': 'POST'}) }} 12 {{ form_start(form, {'method': 'POST'}) }}
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
index 1fc2dfa6..043b2114 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
@@ -75,7 +75,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
75 75
76 $this->assertEquals('Pocket', $pocketImport->getName()); 76 $this->assertEquals('Pocket', $pocketImport->getName());
77 $this->assertNotEmpty($pocketImport->getUrl()); 77 $this->assertNotEmpty($pocketImport->getUrl());
78 $this->assertContains('This importer will import all your <a href="https://getpocket.com">Pocket</a> data.', $pocketImport->getDescription()); 78 $this->assertContains('This importer will import all your Pocket data.', $pocketImport->getDescription());
79 } 79 }
80 80
81 public function testOAuthRequest() 81 public function testOAuthRequest()
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
index 8a8eb3fa..d5b41777 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
@@ -38,7 +38,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
38 { 38 {
39 $wallabagV1Import = $this->getWallabagV1Import(); 39 $wallabagV1Import = $this->getWallabagV1Import();
40 40
41 $this->assertEquals('Wallabag v1', $wallabagV1Import->getName()); 41 $this->assertEquals('wallabag v1', $wallabagV1Import->getName());
42 $this->assertNotEmpty($wallabagV1Import->getUrl()); 42 $this->assertNotEmpty($wallabagV1Import->getUrl());
43 $this->assertContains('This importer will import all your wallabag v1 articles.', $wallabagV1Import->getDescription()); 43 $this->assertContains('This importer will import all your wallabag v1 articles.', $wallabagV1Import->getDescription());
44 } 44 }