diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-21 12:47:57 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-21 12:47:57 +0100 |
commit | 439b36323e37f669b056cc5228c44bb91196256c (patch) | |
tree | ecd84477adf3e12819b26aff2a6d2e644e45ea72 /src/Wallabag/ImportBundle | |
parent | bd46de6b25f982e1a0d3f975971fe8014db13833 (diff) | |
parent | 4083887afe4dd3f568b2dfea3392506b554c79b8 (diff) | |
download | wallabag-439b36323e37f669b056cc5228c44bb91196256c.tar.gz wallabag-439b36323e37f669b056cc5228c44bb91196256c.tar.zst wallabag-439b36323e37f669b056cc5228c44bb91196256c.zip |
Merge pull request #1774 from wallabag/v2-key-translation
Switch to keys in translated files
Diffstat (limited to 'src/Wallabag/ImportBundle')
17 files changed, 80 insertions, 58 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php index c88e115e..1d804219 100644 --- a/src/Wallabag/ImportBundle/Controller/PocketController.php +++ b/src/Wallabag/ImportBundle/Controller/PocketController.php | |||
@@ -17,8 +17,8 @@ class PocketController extends Controller | |||
17 | { | 17 | { |
18 | $pocket = $this->get('wallabag_import.pocket.import'); | 18 | $pocket = $this->get('wallabag_import.pocket.import'); |
19 | $form = $this->createFormBuilder($pocket) | 19 | $form = $this->createFormBuilder($pocket) |
20 | ->add('read', CheckboxType::class, array( | 20 | ->add('mark_as_read', CheckboxType::class, array( |
21 | 'label' => 'Mark all as read', | 21 | 'label' => 'import.form.mark_as_read_label', |
22 | 'required' => false, | 22 | 'required' => false, |
23 | )) | 23 | )) |
24 | ->getForm(); | 24 | ->getForm(); |
@@ -39,7 +39,7 @@ class PocketController extends Controller | |||
39 | ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); | 39 | ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); |
40 | 40 | ||
41 | $this->get('session')->set('import.pocket.code', $requestToken); | 41 | $this->get('session')->set('import.pocket.code', $requestToken); |
42 | $this->get('session')->set('read', $request->request->get('form')['read']); | 42 | $this->get('session')->set('mark_as_read', $request->request->get('form')['mark_as_read']); |
43 | 43 | ||
44 | return $this->redirect( | 44 | return $this->redirect( |
45 | 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), | 45 | 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), |
@@ -52,10 +52,11 @@ class PocketController extends Controller | |||
52 | */ | 52 | */ |
53 | public function callbackAction() | 53 | public function callbackAction() |
54 | { | 54 | { |
55 | $message = 'Import failed, please try again.'; | 55 | $message = 'flashes.import.notice.failed'; |
56 | $pocket = $this->get('wallabag_import.pocket.import'); | 56 | $pocket = $this->get('wallabag_import.pocket.import'); |
57 | $markAsRead = $this->get('session')->get('read'); | 57 | |
58 | $this->get('session')->remove('read'); | 58 | $markAsRead = $this->get('session')->get('mark_as_read'); |
59 | $this->get('session')->remove('mark_as_read'); | ||
59 | 60 | ||
60 | // something bad happend on pocket side | 61 | // something bad happend on pocket side |
61 | if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) { | 62 | if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) { |
@@ -69,7 +70,10 @@ class PocketController extends Controller | |||
69 | 70 | ||
70 | if (true === $pocket->setMarkAsRead($markAsRead)->import()) { | 71 | if (true === $pocket->setMarkAsRead($markAsRead)->import()) { |
71 | $summary = $pocket->getSummary(); | 72 | $summary = $pocket->getSummary(); |
72 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 73 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( |
74 | '%imported%' => $summary['imported'], | ||
75 | '%skipped%' => $summary['skipped'], | ||
76 | )); | ||
73 | } | 77 | } |
74 | 78 | ||
75 | $this->get('session')->getFlashBag()->add( | 79 | $this->get('session')->getFlashBag()->add( |
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php index 154a0769..1bc9696d 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php | |||
@@ -31,11 +31,14 @@ class WallabagV1Controller extends Controller | |||
31 | ->setMarkAsRead($markAsRead) | 31 | ->setMarkAsRead($markAsRead) |
32 | ->import(); | 32 | ->import(); |
33 | 33 | ||
34 | $message = 'Import failed, please try again.'; | 34 | $message = 'flashes.import.notice.failed'; |
35 | 35 | ||
36 | if (true === $res) { | 36 | if (true === $res) { |
37 | $summary = $wallabag->getSummary(); | 37 | $summary = $wallabag->getSummary(); |
38 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 38 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( |
39 | '%imported%' => $summary['imported'], | ||
40 | '%skipped%' => $summary['skipped'], | ||
41 | )); | ||
39 | 42 | ||
40 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); | 43 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); |
41 | } | 44 | } |
@@ -49,7 +52,7 @@ class WallabagV1Controller extends Controller | |||
49 | } else { | 52 | } else { |
50 | $this->get('session')->getFlashBag()->add( | 53 | $this->get('session')->getFlashBag()->add( |
51 | 'notice', | 54 | 'notice', |
52 | 'Error while processing import. Please verify your import file.' | 55 | 'flashes.import.notice.failed_on_file' |
53 | ); | 56 | ); |
54 | } | 57 | } |
55 | } | 58 | } |
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php index 6dcd204a..3e6428a0 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php | |||
@@ -31,11 +31,14 @@ class WallabagV2Controller extends Controller | |||
31 | ->setMarkAsRead($markAsRead) | 31 | ->setMarkAsRead($markAsRead) |
32 | ->import(); | 32 | ->import(); |
33 | 33 | ||
34 | $message = 'Import failed, please try again.'; | 34 | $message = 'flashes.import.notice.failed'; |
35 | 35 | ||
36 | if (true === $res) { | 36 | if (true === $res) { |
37 | $summary = $wallabag->getSummary(); | 37 | $summary = $wallabag->getSummary(); |
38 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 38 | $message = $this->get('translator')->trans('flashes.import.notice.summary', array( |
39 | '%imported%' => $summary['imported'], | ||
40 | '%skipped%' => $summary['skipped'], | ||
41 | )); | ||
39 | 42 | ||
40 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); | 43 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); |
41 | } | 44 | } |
@@ -49,7 +52,7 @@ class WallabagV2Controller extends Controller | |||
49 | } else { | 52 | } else { |
50 | $this->get('session')->getFlashBag()->add( | 53 | $this->get('session')->getFlashBag()->add( |
51 | 'notice', | 54 | 'notice', |
52 | 'Error while processing import. Please verify your import file.' | 55 | 'flashes.import.notice.failed_on_file' |
53 | ); | 56 | ); |
54 | } | 57 | } |
55 | } | 58 | } |
diff --git a/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php b/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php index 38670379..e0a44c36 100644 --- a/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php +++ b/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php | |||
@@ -13,12 +13,16 @@ class UploadImportType extends AbstractType | |||
13 | public function buildForm(FormBuilderInterface $builder, array $options) | 13 | public function buildForm(FormBuilderInterface $builder, array $options) |
14 | { | 14 | { |
15 | $builder | 15 | $builder |
16 | ->add('file', FileType::class) | 16 | ->add('file', FileType::class, array( |
17 | 'label' => 'import.form.file_label', | ||
18 | )) | ||
17 | ->add('mark_as_read', CheckboxType::class, array( | 19 | ->add('mark_as_read', CheckboxType::class, array( |
18 | 'label' => 'Mark all as read', | 20 | 'label' => 'import.form.mark_as_read_label', |
19 | 'required' => false, | 21 | 'required' => false, |
20 | )) | 22 | )) |
21 | ->add('save', SubmitType::class) | 23 | ->add('save', SubmitType::class, array( |
24 | 'label' => 'import.form.save_label', | ||
25 | )) | ||
22 | ; | 26 | ; |
23 | } | 27 | } |
24 | 28 | ||
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 238ddbd1..4499ce69 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -60,7 +60,7 @@ class PocketImport implements ImportInterface | |||
60 | */ | 60 | */ |
61 | public function getDescription() | 61 | public function getDescription() |
62 | { | 62 | { |
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.'; | 63 | return 'import.pocket.description'; |
64 | } | 64 | } |
65 | 65 | ||
66 | /** | 66 | /** |
@@ -139,7 +139,7 @@ class PocketImport implements ImportInterface | |||
139 | /** | 139 | /** |
140 | * Get whether articles must be all marked as read. | 140 | * Get whether articles must be all marked as read. |
141 | */ | 141 | */ |
142 | public function getRead() | 142 | public function getMarkAsRead() |
143 | { | 143 | { |
144 | return $this->markAsRead; | 144 | return $this->markAsRead; |
145 | } | 145 | } |
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 1d773d3b..173a587f 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |||
@@ -67,7 +67,7 @@ class WallabagV1Import implements ImportInterface | |||
67 | */ | 67 | */ |
68 | public function getDescription() | 68 | public function getDescription() |
69 | { | 69 | { |
70 | 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 | return 'import.wallabag_v1.description'; |
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php index c4bac561..0a32864e 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php | |||
@@ -27,7 +27,7 @@ class WallabagV2Import extends WallabagV1Import implements ImportInterface | |||
27 | */ | 27 | */ |
28 | public function getDescription() | 28 | public function getDescription() |
29 | { | 29 | { |
30 | return 'This importer will import all your wallabag v2 articles. Go to All articles, then, on the export sidebar, click on "JSON". You will have a "All articles.json" file.'; | 30 | return 'import.wallabag_v2.description'; |
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig index 8c300624..aebbfa20 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig | |||
@@ -1,17 +1,18 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | {% block title %}{% trans %}Import{% endtrans %}{% endblock %} | 2 | |
3 | {% block title %}{{ 'import.page_title'|trans }}{% endblock %} | ||
3 | 4 | ||
4 | {% block content %} | 5 | {% block content %} |
5 | <div class="row"> | 6 | <div class="row"> |
6 | <div class="col s12"> | 7 | <div class="col s12"> |
7 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
8 | {% trans %}Welcome to wallabag importer. Please select your previous service that you want to migrate.{% endtrans %} | 9 | {{ 'import.page_description'|trans }} |
9 | <ul> | 10 | <ul> |
10 | {% for import in imports %} | 11 | {% for import in imports %} |
11 | <li> | 12 | <li> |
12 | <h5>{{ import.name }}</h5> | 13 | <h5>{{ import.name }}</h5> |
13 | <blockquote>{{ import.description|trans }}</blockquote> | 14 | <blockquote>{{ import.description|trans }}</blockquote> |
14 | <p><a class="waves-effect waves-light btn" href="{{ path(import.url) }}">{% trans %}Import contents{% endtrans %}</a></p> | 15 | <p><a class="waves-effect waves-light btn" href="{{ path(import.url) }}">{{ 'import.action.import_contents'|trans }}</a></p> |
15 | </li> | 16 | </li> |
16 | {% endfor %} | 17 | {% endfor %} |
17 | </ul> | 18 | </ul> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig index 3365fc6a..401dbd33 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig | |||
@@ -1,5 +1,6 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | {% block title %}{% trans %}Import > Pocket{% endtrans %}{% endblock %} | 2 | |
3 | {% block title %}{{ 'import.pocket.page_title'|trans }}{% endblock %} | ||
3 | 4 | ||
4 | {% block content %} | 5 | {% block content %} |
5 | <div class="row"> | 6 | <div class="row"> |
@@ -7,27 +8,29 @@ | |||
7 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
8 | {% if not has_consumer_key %} | 9 | {% if not has_consumer_key %} |
9 | <div class="card-panel red darken-1"> | 10 | <div class="card-panel red darken-1"> |
10 | {% trans %}Pocket import isn't configured.{% endtrans %} | 11 | {{ 'import.pocket.config_missing.description'|trans }} |
12 | |||
11 | {% if is_granted('ROLE_SUPER_ADMIN') %} | 13 | {% if is_granted('ROLE_SUPER_ADMIN') %} |
12 | {% trans with {'%keyurls%': '<a href="' ~ path('craue_config_settings_modify') ~ '#set-import">', '%keyurle%':'</a>'} %}You need to define %keyurls% a pocket_consumer_key %keyurle%.{% endtrans %} | 14 | {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('craue_config_settings_modify') ~ '#set-import">', '%keyurle%':'</a>'})|raw }} |
13 | {% else %} | 15 | {% else %} |
14 | {% trans %}Your server admin needs to define an API Key for Pocket.{% endtrans %} | 16 | {{ 'import.pocket.config_missing.user_message'|trans }} |
15 | {% endif %} | 17 | {% endif %} |
16 | </div> | 18 | </div> |
17 | {% endif %} | 19 | {% endif %} |
18 | 20 | ||
19 | <blockquote>{{ import.description|trans }}</blockquote> | 21 | <blockquote>{{ import.description|trans }}</blockquote> |
20 | <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> | 22 | <p>{{ 'import.pocket.authorize_message'|trans }}</p> |
23 | |||
21 | <form method="post" action="{{ path('import_pocket_auth') }}"> | 24 | <form method="post" action="{{ path('import_pocket_auth') }}"> |
22 | <div class="row"> | 25 | <div class="row"> |
23 | <div class="input-field col s6 with-checkbox"> | 26 | <div class="input-field col s6 with-checkbox"> |
24 | <h6>{% trans %}Mark all as read ?{% endtrans %}</h6> | 27 | <h6>{{ 'import.form.mark_as_read_title'|trans }}</h6> |
25 | {{ form_widget(form.read) }} | 28 | {{ form_widget(form.mark_as_read) }} |
26 | <label for="form_read">{% trans %}Mark all imported entries as read{% endtrans %}</label> | 29 | {{ form_label(form.mark_as_read) }} |
30 | </div> | ||
27 | </div> | 31 | </div> |
28 | </div> | ||
29 | <button class="btn waves-effect waves-light" type="submit" name="action"> | 32 | <button class="btn waves-effect waves-light" type="submit" name="action"> |
30 | {% trans %}Connect to Pocket and import data{% endtrans %} | 33 | {{ 'import.pocket.connect_to_pocket'|trans }} |
31 | </button> | 34 | </button> |
32 | </form> | 35 | </form> |
33 | </div> | 36 | </div> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig index a418ed1c..13e24c8c 100644 --- a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig | |||
@@ -1,5 +1,6 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | {% block title %}{% trans %}Import > Wallabag v1{% endtrans %}{% endblock %} | 2 | |
3 | {% block title %}{{ 'import.wallabag_v1.page_title'|trans }}{% endblock %} | ||
3 | 4 | ||
4 | {% block content %} | 5 | {% block content %} |
5 | <div class="row"> | 6 | <div class="row"> |
@@ -7,7 +8,8 @@ | |||
7 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
8 | <div class="row"> | 9 | <div class="row"> |
9 | <blockquote>{{ import.description|trans }}</blockquote> | 10 | <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> | 11 | <p>{{ 'import.wallabag_v1.how_to'|trans }}</p> |
12 | |||
11 | <div class="col s12"> | 13 | <div class="col s12"> |
12 | {{ form_start(form, {'method': 'POST'}) }} | 14 | {{ form_start(form, {'method': 'POST'}) }} |
13 | {{ form_errors(form) }} | 15 | {{ form_errors(form) }} |
@@ -15,7 +17,7 @@ | |||
15 | <div class="file-field input-field col s12"> | 17 | <div class="file-field input-field col s12"> |
16 | {{ form_errors(form.file) }} | 18 | {{ form_errors(form.file) }} |
17 | <div class="btn"> | 19 | <div class="btn"> |
18 | <span>{% trans %}File{% endtrans %}</span> | 20 | <span>{{ form.file.vars.label|trans }}</span> |
19 | {{ form_widget(form.file) }} | 21 | {{ form_widget(form.file) }} |
20 | </div> | 22 | </div> |
21 | <div class="file-path-wrapper"> | 23 | <div class="file-path-wrapper"> |
@@ -23,15 +25,15 @@ | |||
23 | </div> | 25 | </div> |
24 | </div> | 26 | </div> |
25 | <div class="input-field col s6 with-checkbox"> | 27 | <div class="input-field col s6 with-checkbox"> |
26 | <h6>{% trans %}Mark all as read ?{% endtrans %}</h6> | 28 | <h6>{{ 'import.form.mark_as_read_title'|trans }}</h6> |
27 | {{ form_widget(form.mark_as_read) }} | 29 | {{ form_widget(form.mark_as_read) }} |
28 | <label for="upload_import_file_mark_as_read">{% trans %}Mark all imported entries as read{% endtrans %}</label> | 30 | {{ form_label(form.mark_as_read) }} |
29 | </div> | 31 | </div> |
30 | </div> | 32 | </div> |
31 | <div class="hidden">{{ form_rest(form) }}</div> | 33 | |
32 | <button class="btn waves-effect waves-light" type="submit" name="action"> | 34 | {{ form_widget(form.save, { 'attr': {'class': 'btn waves-effect waves-light'} }) }} |
33 | {% trans %}Upload file{% endtrans %} | 35 | |
34 | </button> | 36 | {{ form_rest(form) }} |
35 | </form> | 37 | </form> |
36 | </div> | 38 | </div> |
37 | </div> | 39 | </div> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig index 78fe67e4..c2905fc6 100644 --- a/src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig | |||
@@ -1,2 +1,3 @@ | |||
1 | {% extends "WallabagImportBundle:WallabagV1:index.html.twig" %} | 1 | {% extends "WallabagImportBundle:WallabagV1:index.html.twig" %} |
2 | {% block title %}{% trans %}Import > Wallabag v2{% endtrans %}{% endblock %} | 2 | |
3 | {% block title %}{{ 'import.wallabag_v2.page_title'|trans }}{% endblock %} | ||
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php index c2acd68c..174641fd 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php | |||
@@ -37,6 +37,6 @@ class PocketControllerTest extends WallabagCoreTestCase | |||
37 | 37 | ||
38 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 38 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
39 | $this->assertContains('import/pocket', $client->getResponse()->headers->get('location')); | 39 | $this->assertContains('import/pocket', $client->getResponse()->headers->get('location')); |
40 | $this->assertEquals('Import failed, please try again.', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); | 40 | $this->assertEquals('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php index 7f97b0f5..8d353a71 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | |||
@@ -54,8 +54,8 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
54 | 54 | ||
55 | $this->assertTrue($content->getTags()->contains($tag)); | 55 | $this->assertTrue($content->getTags()->contains($tag)); |
56 | 56 | ||
57 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 57 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
58 | $this->assertContains('Import summary', $alert[0]); | 58 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
59 | } | 59 | } |
60 | 60 | ||
61 | public function testImportWallabagWithFileAndMarkAllAsRead() | 61 | public function testImportWallabagWithFileAndMarkAllAsRead() |
@@ -99,7 +99,8 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
99 | 99 | ||
100 | $this->assertTrue($content2->isArchived()); | 100 | $this->assertTrue($content2->isArchived()); |
101 | 101 | ||
102 | $this->assertContains('Import summary', $client->getResponse()->getContent()); | 102 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
103 | $this->assertContains('flashes.import.notice.summary', $body[0]); | ||
103 | } | 104 | } |
104 | 105 | ||
105 | public function testImportWallabagWithEmptyFile() | 106 | public function testImportWallabagWithEmptyFile() |
@@ -122,7 +123,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
122 | 123 | ||
123 | $crawler = $client->followRedirect(); | 124 | $crawler = $client->followRedirect(); |
124 | 125 | ||
125 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 126 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
126 | $this->assertContains('Import failed, please try again', $alert[0]); | 127 | $this->assertContains('flashes.import.notice.failed', $body[0]); |
127 | } | 128 | } |
128 | } | 129 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php index 617c0517..bcbd6305 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php | |||
@@ -39,8 +39,8 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
39 | 39 | ||
40 | $crawler = $client->followRedirect(); | 40 | $crawler = $client->followRedirect(); |
41 | 41 | ||
42 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 42 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
43 | $this->assertContains('Import summary', $alert[0]); | 43 | $this->assertContains('flashes.import.notice.summary', $body[0]); |
44 | 44 | ||
45 | $content = $client->getContainer() | 45 | $content = $client->getContainer() |
46 | ->get('doctrine.orm.entity_manager') | 46 | ->get('doctrine.orm.entity_manager') |
@@ -87,7 +87,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase | |||
87 | 87 | ||
88 | $crawler = $client->followRedirect(); | 88 | $crawler = $client->followRedirect(); |
89 | 89 | ||
90 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 90 | $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); |
91 | $this->assertContains('Import failed, please try again', $alert[0]); | 91 | $this->assertContains('flashes.import.notice.failed', $body[0]); |
92 | } | 92 | } |
93 | } | 93 | } |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php index 450cdc95..43b60ec3 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php | |||
@@ -85,7 +85,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
85 | 85 | ||
86 | $this->assertEquals('Pocket', $pocketImport->getName()); | 86 | $this->assertEquals('Pocket', $pocketImport->getName()); |
87 | $this->assertNotEmpty($pocketImport->getUrl()); | 87 | $this->assertNotEmpty($pocketImport->getUrl()); |
88 | $this->assertContains('This importer will import all your Pocket data.', $pocketImport->getDescription()); | 88 | $this->assertEquals('import.pocket.description', $pocketImport->getDescription()); |
89 | } | 89 | } |
90 | 90 | ||
91 | public function testOAuthRequest() | 91 | public function testOAuthRequest() |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php index 8ab7e830..496cf2d3 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php | |||
@@ -45,7 +45,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
45 | 45 | ||
46 | $this->assertEquals('wallabag v1', $wallabagV1Import->getName()); | 46 | $this->assertEquals('wallabag v1', $wallabagV1Import->getName()); |
47 | $this->assertNotEmpty($wallabagV1Import->getUrl()); | 47 | $this->assertNotEmpty($wallabagV1Import->getUrl()); |
48 | $this->assertContains('This importer will import all your wallabag v1 articles.', $wallabagV1Import->getDescription()); | 48 | $this->assertEquals('import.wallabag_v1.description', $wallabagV1Import->getDescription()); |
49 | } | 49 | } |
50 | 50 | ||
51 | public function testImport() | 51 | public function testImport() |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php index 2b642d27..341b1076 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | |||
@@ -45,7 +45,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
45 | 45 | ||
46 | $this->assertEquals('wallabag v2', $wallabagV2Import->getName()); | 46 | $this->assertEquals('wallabag v2', $wallabagV2Import->getName()); |
47 | $this->assertNotEmpty($wallabagV2Import->getUrl()); | 47 | $this->assertNotEmpty($wallabagV2Import->getUrl()); |
48 | $this->assertContains('This importer will import all your wallabag v2 articles.', $wallabagV2Import->getDescription()); | 48 | $this->assertEquals('import.wallabag_v2.description', $wallabagV2Import->getDescription()); |
49 | } | 49 | } |
50 | 50 | ||
51 | public function testImport() | 51 | public function testImport() |