From b88cf91fc8371194df78e690983c61ea94f266cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 6 Jan 2016 06:34:57 +0100 Subject: [PATCH] updated tests --- .../CoreBundle/Resources/translations/messages.fr.yml | 2 +- src/Wallabag/ImportBundle/Import/PocketImport.php | 6 ++---- src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 7 ++----- src/Wallabag/ImportBundle/Resources/config/services.yml | 2 -- .../ImportBundle/Resources/views/Import/index.html.twig | 2 +- .../ImportBundle/Resources/views/Pocket/index.html.twig | 2 +- .../Resources/views/WallabagV1/index.html.twig | 2 +- .../ImportBundle/Tests/Import/PocketImportTest.php | 2 +- .../ImportBundle/Tests/Import/WallabagV1ImportTest.php | 2 +- 9 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 3140091ca..067465842 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -132,7 +132,7 @@ Edit title: "Modifier le titre" # Import Welcome on wallabag importer. Please select your previous service that you want to migrate.: "Bienvenue dans l'outil de migration de wallabag. Choisissez ci-dessous le service depuis lequel vous souhaitez migrer." -"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.": "Cet outil va importer toutes vos données de Pocket. Pocket ne nous autorise pas à récupérer le contenu depuis leur service, donc wallabag doit reparcourir chaque article pour récupérer son contenu." +"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.": "Cet outil va importer toutes vos données de Pocket. Pocket ne nous autorise pas à récupérer le contenu depuis leur service, donc wallabag doit reparcourir chaque article pour récupérer son contenu." "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.": "Cet outil va importer toutes vos données de wallabag v1. Sur votre page de configuration de wallabag v1, cliquez sur \"Export JSON\" dans la section \"Exporter vos données de wallabag\". Vous allez récupérer un fichier \"wallabag-export-1-xxxx-xx-xx.json\"." "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.": "Vous pouvez importer vos données depuis votre compte Pocket. Vous n'avez qu'à cliquer sur le bouton ci-dessous et à autoriser wallabag à se connecter à getpocket.com." Connect to Pocket and import data: Se connecter à Pocket et importer les données. diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 9b82720a9..cdcec1e28 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 use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Helper\ContentProxy; -use Symfony\Component\Translation\TranslatorInterface; class PocketImport implements ImportInterface { @@ -26,14 +25,13 @@ class PocketImport implements ImportInterface protected $accessToken; private $translator; - public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey, TranslatorInterface $translator) + public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey) { $this->user = $tokenStorage->getToken()->getUser(); $this->em = $em; $this->contentProxy = $contentProxy; $this->consumerKey = $consumerKey; $this->logger = new NullLogger(); - $this->translator = $translator; } public function setLogger(LoggerInterface $logger) @@ -62,7 +60,7 @@ class PocketImport implements ImportInterface */ public function getDescription() { - return $this->translator->trans("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."); + 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.'; } /** diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 68f0574fb..393089d63 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php @@ -5,7 +5,6 @@ namespace Wallabag\ImportBundle\Import; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Doctrine\ORM\EntityManager; -use Symfony\Component\Translation\TranslatorInterface; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Tools\Utils; @@ -18,13 +17,11 @@ class WallabagV1Import implements ImportInterface private $skippedEntries = 0; private $importedEntries = 0; private $filepath; - private $translator; - public function __construct(EntityManager $em, TranslatorInterface $translator) + public function __construct(EntityManager $em) { $this->em = $em; $this->logger = new NullLogger(); - $this->translator = $translator; } public function setLogger(LoggerInterface $logger) @@ -66,7 +63,7 @@ class WallabagV1Import implements ImportInterface */ public function getDescription() { - 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.'); + 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.'; } /** diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index 55348ce7b..e4dde1003 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml @@ -18,7 +18,6 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" - %pocket_consumer_key% - - "@translator" calls: - [ setClient, [ "@wallabag_import.pocket.client" ] ] - [ setLogger, [ "@logger" ]] @@ -29,7 +28,6 @@ services: class: Wallabag\ImportBundle\Import\WallabagV1Import arguments: - "@doctrine.orm.entity_manager" - - "@translator" calls: - [ setLogger, [ "@logger" ]] tags: diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig index 1f0addca9..303e6cbfb 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 @@ {% for import in imports %}
  • {{ import.name }}
    -
    {{ import.description|raw }}
    +
    {{ import.description|trans }}

    {% trans %}Import contents{% endtrans %}

  • {% endfor %} diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig index 58053780c..643ad7754 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 @@
    -
    {{ import.description|raw }}
    +
    {{ import.description|trans }}

    {% 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 %}