diff options
45 files changed, 617 insertions, 234 deletions
diff --git a/app/config/config.yml b/app/config/config.yml index 73bf0a0d..9792616e 100644 --- a/app/config/config.yml +++ b/app/config/config.yml | |||
@@ -59,7 +59,7 @@ wallabag_core: | |||
59 | action_mark_as_read: 1 | 59 | action_mark_as_read: 1 |
60 | list_mode: 0 | 60 | list_mode: 0 |
61 | fetching_error_message: | | 61 | fetching_error_message: | |
62 | wallabag can't retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>. | 62 | wallabag can't retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>. |
63 | api_limit_mass_actions: 10 | 63 | api_limit_mass_actions: 10 |
64 | 64 | ||
65 | wallabag_user: | 65 | wallabag_user: |
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 4801811d..31bb67fd 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -318,7 +318,7 @@ class EntryRestController extends WallabagRestController | |||
318 | 318 | ||
319 | $tags = $request->request->get('tags', ''); | 319 | $tags = $request->request->get('tags', ''); |
320 | if (!empty($tags)) { | 320 | if (!empty($tags)) { |
321 | $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); | 321 | $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); |
322 | } | 322 | } |
323 | 323 | ||
324 | if (!is_null($isStarred)) { | 324 | if (!is_null($isStarred)) { |
@@ -379,7 +379,7 @@ class EntryRestController extends WallabagRestController | |||
379 | 379 | ||
380 | $tags = $request->request->get('tags', ''); | 380 | $tags = $request->request->get('tags', ''); |
381 | if (!empty($tags)) { | 381 | if (!empty($tags)) { |
382 | $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); | 382 | $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); |
383 | } | 383 | } |
384 | 384 | ||
385 | $em = $this->getDoctrine()->getManager(); | 385 | $em = $this->getDoctrine()->getManager(); |
@@ -497,7 +497,7 @@ class EntryRestController extends WallabagRestController | |||
497 | 497 | ||
498 | $tags = $request->request->get('tags', ''); | 498 | $tags = $request->request->get('tags', ''); |
499 | if (!empty($tags)) { | 499 | if (!empty($tags)) { |
500 | $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); | 500 | $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); |
501 | } | 501 | } |
502 | 502 | ||
503 | $em = $this->getDoctrine()->getManager(); | 503 | $em = $this->getDoctrine()->getManager(); |
@@ -626,7 +626,7 @@ class EntryRestController extends WallabagRestController | |||
626 | $tags = $element->tags; | 626 | $tags = $element->tags; |
627 | 627 | ||
628 | if (false !== $entry && !(empty($tags))) { | 628 | if (false !== $entry && !(empty($tags))) { |
629 | $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); | 629 | $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $tags); |
630 | 630 | ||
631 | $em = $this->getDoctrine()->getManager(); | 631 | $em = $this->getDoctrine()->getManager(); |
632 | $em->persist($entry); | 632 | $em->persist($entry); |
diff --git a/src/Wallabag/ApiBundle/Controller/UserRestController.php b/src/Wallabag/ApiBundle/Controller/UserRestController.php new file mode 100644 index 00000000..a1b78e3f --- /dev/null +++ b/src/Wallabag/ApiBundle/Controller/UserRestController.php | |||
@@ -0,0 +1,139 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ApiBundle\Controller; | ||
4 | |||
5 | use FOS\UserBundle\Event\UserEvent; | ||
6 | use FOS\UserBundle\FOSUserEvents; | ||
7 | use JMS\Serializer\SerializationContext; | ||
8 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; | ||
9 | use Symfony\Component\HttpFoundation\Request; | ||
10 | use Symfony\Component\HttpFoundation\JsonResponse; | ||
11 | use Wallabag\UserBundle\Entity\User; | ||
12 | |||
13 | class UserRestController extends WallabagRestController | ||
14 | { | ||
15 | /** | ||
16 | * Retrieve current logged in user informations. | ||
17 | * | ||
18 | * @ApiDoc() | ||
19 | * | ||
20 | * @return JsonResponse | ||
21 | */ | ||
22 | public function getUserAction() | ||
23 | { | ||
24 | $this->validateAuthentication(); | ||
25 | |||
26 | return $this->sendUser($this->getUser()); | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * Register an user. | ||
31 | * | ||
32 | * @ApiDoc( | ||
33 | * requirements={ | ||
34 | * {"name"="username", "dataType"="string", "required"=true, "description"="The user's username"}, | ||
35 | * {"name"="password", "dataType"="string", "required"=true, "description"="The user's password"}, | ||
36 | * {"name"="email", "dataType"="string", "required"=true, "description"="The user's email"} | ||
37 | * } | ||
38 | * ) | ||
39 | * | ||
40 | * @todo Make this method (or the whole API) accessible only through https | ||
41 | * | ||
42 | * @return JsonResponse | ||
43 | */ | ||
44 | public function putUserAction(Request $request) | ||
45 | { | ||
46 | if (!$this->container->getParameter('fosuser_registration')) { | ||
47 | $json = $this->get('serializer')->serialize(['error' => "Server doesn't allow registrations"], 'json'); | ||
48 | |||
49 | return (new JsonResponse())->setJson($json)->setStatusCode(403); | ||
50 | } | ||
51 | |||
52 | $userManager = $this->get('fos_user.user_manager'); | ||
53 | $user = $userManager->createUser(); | ||
54 | // enable created user by default | ||
55 | $user->setEnabled(true); | ||
56 | |||
57 | $form = $this->createForm('Wallabag\UserBundle\Form\NewUserType', $user, [ | ||
58 | 'csrf_protection' => false, | ||
59 | ]); | ||
60 | |||
61 | // simulate form submission | ||
62 | $form->submit([ | ||
63 | 'username' => $request->request->get('username'), | ||
64 | 'plainPassword' => [ | ||
65 | 'first' => $request->request->get('password'), | ||
66 | 'second' => $request->request->get('password'), | ||
67 | ], | ||
68 | 'email' => $request->request->get('email'), | ||
69 | ]); | ||
70 | |||
71 | if ($form->isSubmitted() && false === $form->isValid()) { | ||
72 | $view = $this->view($form, 400); | ||
73 | $view->setFormat('json'); | ||
74 | |||
75 | // handle errors in a more beautiful way than the default view | ||
76 | $data = json_decode($this->handleView($view)->getContent(), true)['children']; | ||
77 | $errors = []; | ||
78 | |||
79 | if (isset($data['username']['errors'])) { | ||
80 | $errors['username'] = $this->translateErrors($data['username']['errors']); | ||
81 | } | ||
82 | |||
83 | if (isset($data['email']['errors'])) { | ||
84 | $errors['email'] = $this->translateErrors($data['email']['errors']); | ||
85 | } | ||
86 | |||
87 | if (isset($data['plainPassword']['children']['first']['errors'])) { | ||
88 | $errors['password'] = $this->translateErrors($data['plainPassword']['children']['first']['errors']); | ||
89 | } | ||
90 | |||
91 | $json = $this->get('serializer')->serialize(['error' => $errors], 'json'); | ||
92 | |||
93 | return (new JsonResponse())->setJson($json)->setStatusCode(400); | ||
94 | } | ||
95 | |||
96 | $userManager->updateUser($user); | ||
97 | |||
98 | // dispatch a created event so the associated config will be created | ||
99 | $event = new UserEvent($user, $request); | ||
100 | $this->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event); | ||
101 | |||
102 | return $this->sendUser($user); | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * Send user response. | ||
107 | * | ||
108 | * @param User $user | ||
109 | * | ||
110 | * @return JsonResponse | ||
111 | */ | ||
112 | private function sendUser(User $user) | ||
113 | { | ||
114 | $json = $this->get('serializer')->serialize( | ||
115 | $user, | ||
116 | 'json', | ||
117 | SerializationContext::create()->setGroups(['user_api']) | ||
118 | ); | ||
119 | |||
120 | return (new JsonResponse())->setJson($json); | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * Translate errors message. | ||
125 | * | ||
126 | * @param array $errors | ||
127 | * | ||
128 | * @return array | ||
129 | */ | ||
130 | private function translateErrors($errors) | ||
131 | { | ||
132 | $translatedErrors = []; | ||
133 | foreach ($errors as $error) { | ||
134 | $translatedErrors[] = $this->get('translator')->trans($error); | ||
135 | } | ||
136 | |||
137 | return $translatedErrors; | ||
138 | } | ||
139 | } | ||
diff --git a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml index 57d37f4b..c0283e71 100644 --- a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml +++ b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml | |||
@@ -17,3 +17,8 @@ misc: | |||
17 | type: rest | 17 | type: rest |
18 | resource: "WallabagApiBundle:WallabagRest" | 18 | resource: "WallabagApiBundle:WallabagRest" |
19 | name_prefix: api_ | 19 | name_prefix: api_ |
20 | |||
21 | user: | ||
22 | type: rest | ||
23 | resource: "WallabagApiBundle:UserRest" | ||
24 | name_prefix: api_ | ||
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 8a093289..fb6a720b 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -28,7 +28,7 @@ class TagController extends Controller | |||
28 | $form->handleRequest($request); | 28 | $form->handleRequest($request); |
29 | 29 | ||
30 | if ($form->isSubmitted() && $form->isValid()) { | 30 | if ($form->isSubmitted() && $form->isValid()) { |
31 | $this->get('wallabag_core.content_proxy')->assignTagsToEntry( | 31 | $this->get('wallabag_core.tags_assigner')->assignTagsToEntry( |
32 | $entry, | 32 | $entry, |
33 | $form->get('label')->getData() | 33 | $form->get('label')->getData() |
34 | ); | 34 | ); |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 9a08db3d..4b3e6fbb 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -5,9 +5,7 @@ namespace Wallabag\CoreBundle\Helper; | |||
5 | use Graby\Graby; | 5 | use Graby\Graby; |
6 | use Psr\Log\LoggerInterface; | 6 | use Psr\Log\LoggerInterface; |
7 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
8 | use Wallabag\CoreBundle\Entity\Tag; | ||
9 | use Wallabag\CoreBundle\Tools\Utils; | 8 | use Wallabag\CoreBundle\Tools\Utils; |
10 | use Wallabag\CoreBundle\Repository\TagRepository; | ||
11 | use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; | 9 | use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; |
12 | 10 | ||
13 | /** | 11 | /** |
@@ -19,16 +17,15 @@ class ContentProxy | |||
19 | protected $graby; | 17 | protected $graby; |
20 | protected $tagger; | 18 | protected $tagger; |
21 | protected $logger; | 19 | protected $logger; |
22 | protected $tagRepository; | ||
23 | protected $mimeGuesser; | 20 | protected $mimeGuesser; |
24 | protected $fetchingErrorMessage; | 21 | protected $fetchingErrorMessage; |
22 | protected $eventDispatcher; | ||
25 | 23 | ||
26 | public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, LoggerInterface $logger, $fetchingErrorMessage) | 24 | public function __construct(Graby $graby, RuleBasedTagger $tagger, LoggerInterface $logger, $fetchingErrorMessage) |
27 | { | 25 | { |
28 | $this->graby = $graby; | 26 | $this->graby = $graby; |
29 | $this->tagger = $tagger; | 27 | $this->tagger = $tagger; |
30 | $this->logger = $logger; | 28 | $this->logger = $logger; |
31 | $this->tagRepository = $tagRepository; | ||
32 | $this->mimeGuesser = new MimeTypeExtensionGuesser(); | 29 | $this->mimeGuesser = new MimeTypeExtensionGuesser(); |
33 | $this->fetchingErrorMessage = $fetchingErrorMessage; | 30 | $this->fetchingErrorMessage = $fetchingErrorMessage; |
34 | } | 31 | } |
@@ -122,54 +119,6 @@ class ContentProxy | |||
122 | } | 119 | } |
123 | 120 | ||
124 | /** | 121 | /** |
125 | * Assign some tags to an entry. | ||
126 | * | ||
127 | * @param Entry $entry | ||
128 | * @param array|string $tags An array of tag or a string coma separated of tag | ||
129 | * @param array $entitiesReady Entities from the EntityManager which are persisted but not yet flushed | ||
130 | * It is mostly to fix duplicate tag on import @see http://stackoverflow.com/a/7879164/569101 | ||
131 | */ | ||
132 | public function assignTagsToEntry(Entry $entry, $tags, array $entitiesReady = []) | ||
133 | { | ||
134 | if (!is_array($tags)) { | ||
135 | $tags = explode(',', $tags); | ||
136 | } | ||
137 | |||
138 | // keeps only Tag entity from the "not yet flushed entities" | ||
139 | $tagsNotYetFlushed = []; | ||
140 | foreach ($entitiesReady as $entity) { | ||
141 | if ($entity instanceof Tag) { | ||
142 | $tagsNotYetFlushed[$entity->getLabel()] = $entity; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | foreach ($tags as $label) { | ||
147 | $label = trim($label); | ||
148 | |||
149 | // avoid empty tag | ||
150 | if (0 === strlen($label)) { | ||
151 | continue; | ||
152 | } | ||
153 | |||
154 | if (isset($tagsNotYetFlushed[$label])) { | ||
155 | $tagEntity = $tagsNotYetFlushed[$label]; | ||
156 | } else { | ||
157 | $tagEntity = $this->tagRepository->findOneByLabel($label); | ||
158 | |||
159 | if (is_null($tagEntity)) { | ||
160 | $tagEntity = new Tag(); | ||
161 | $tagEntity->setLabel($label); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | // only add the tag on the entry if the relation doesn't exist | ||
166 | if (false === $entry->getTags()->contains($tagEntity)) { | ||
167 | $entry->addTag($tagEntity); | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * Validate that the given content as enough value to be used | 122 | * Validate that the given content as enough value to be used |
174 | * instead of fetch the content from the url. | 123 | * instead of fetch the content from the url. |
175 | * | 124 | * |
diff --git a/src/Wallabag/CoreBundle/Helper/TagsAssigner.php b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php new file mode 100644 index 00000000..a2fb0b9a --- /dev/null +++ b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php | |||
@@ -0,0 +1,75 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Helper; | ||
4 | |||
5 | use Wallabag\CoreBundle\Entity\Entry; | ||
6 | use Wallabag\CoreBundle\Entity\Tag; | ||
7 | use Wallabag\CoreBundle\Repository\TagRepository; | ||
8 | |||
9 | class TagsAssigner | ||
10 | { | ||
11 | /** | ||
12 | * @var TagRepository | ||
13 | */ | ||
14 | protected $tagRepository; | ||
15 | |||
16 | public function __construct(TagRepository $tagRepository) | ||
17 | { | ||
18 | $this->tagRepository = $tagRepository; | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Assign some tags to an entry. | ||
23 | * | ||
24 | * @param Entry $entry | ||
25 | * @param array|string $tags An array of tag or a string coma separated of tag | ||
26 | * @param array $entitiesReady Entities from the EntityManager which are persisted but not yet flushed | ||
27 | * It is mostly to fix duplicate tag on import @see http://stackoverflow.com/a/7879164/569101 | ||
28 | * | ||
29 | * @return Tag[] | ||
30 | */ | ||
31 | public function assignTagsToEntry(Entry $entry, $tags, array $entitiesReady = []) | ||
32 | { | ||
33 | $tagsEntities = []; | ||
34 | |||
35 | if (!is_array($tags)) { | ||
36 | $tags = explode(',', $tags); | ||
37 | } | ||
38 | |||
39 | // keeps only Tag entity from the "not yet flushed entities" | ||
40 | $tagsNotYetFlushed = []; | ||
41 | foreach ($entitiesReady as $entity) { | ||
42 | if ($entity instanceof Tag) { | ||
43 | $tagsNotYetFlushed[$entity->getLabel()] = $entity; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | foreach ($tags as $label) { | ||
48 | $label = trim($label); | ||
49 | |||
50 | // avoid empty tag | ||
51 | if (0 === strlen($label)) { | ||
52 | continue; | ||
53 | } | ||
54 | |||
55 | if (isset($tagsNotYetFlushed[$label])) { | ||
56 | $tagEntity = $tagsNotYetFlushed[$label]; | ||
57 | } else { | ||
58 | $tagEntity = $this->tagRepository->findOneByLabel($label); | ||
59 | |||
60 | if (null === $tagEntity) { | ||
61 | $tagEntity = new Tag(); | ||
62 | $tagEntity->setLabel($label); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | // only add the tag on the entry if the relation doesn't exist | ||
67 | if (false === $entry->getTags()->contains($tagEntity)) { | ||
68 | $entry->addTag($tagEntity); | ||
69 | $tagsEntities[] = $tagEntity; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | return $tagsEntities; | ||
74 | } | ||
75 | } | ||
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index a9134ac3..a68b2fdc 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -89,10 +89,14 @@ services: | |||
89 | arguments: | 89 | arguments: |
90 | - "@wallabag_core.graby" | 90 | - "@wallabag_core.graby" |
91 | - "@wallabag_core.rule_based_tagger" | 91 | - "@wallabag_core.rule_based_tagger" |
92 | - "@wallabag_core.tag_repository" | ||
93 | - "@logger" | 92 | - "@logger" |
94 | - '%wallabag_core.fetching_error_message%' | 93 | - '%wallabag_core.fetching_error_message%' |
95 | 94 | ||
95 | wallabag_core.tags_assigner: | ||
96 | class: Wallabag\CoreBundle\Helper\TagsAssigner | ||
97 | arguments: | ||
98 | - "@wallabag_core.tag_repository" | ||
99 | |||
96 | wallabag_core.rule_based_tagger: | 100 | wallabag_core.rule_based_tagger: |
97 | class: Wallabag\CoreBundle\Helper\RuleBasedTagger | 101 | class: Wallabag\CoreBundle\Helper\RuleBasedTagger |
98 | arguments: | 102 | arguments: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 1bd0b8fd..3e64af8f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -240,6 +240,9 @@ entry: | |||
240 | save_label: 'Gem' | 240 | save_label: 'Gem' |
241 | public: | 241 | public: |
242 | # shared_by_wallabag: "This article has been shared by <a href=%wallabag_instance%'>wallabag</a>" | 242 | # shared_by_wallabag: "This article has been shared by <a href=%wallabag_instance%'>wallabag</a>" |
243 | confirm: | ||
244 | # delete: "Are you sure you want to remove that article?" | ||
245 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
243 | 246 | ||
244 | about: | 247 | about: |
245 | page_title: 'Om' | 248 | page_title: 'Om' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 94bb3295..00468575 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -110,7 +110,7 @@ config: | |||
110 | annotations: Entferne ALLE Annotationen | 110 | annotations: Entferne ALLE Annotationen |
111 | tags: Entferne ALLE Tags | 111 | tags: Entferne ALLE Tags |
112 | entries: Entferne ALLE Einträge | 112 | entries: Entferne ALLE Einträge |
113 | # archived: Remove ALL archived entries | 113 | archived: Entferne ALLE archivierten Einträge |
114 | confirm: Bist du wirklich sicher? (DIES KANN NICHT RÜCKGÄNGIG GEMACHT WERDEN) | 114 | confirm: Bist du wirklich sicher? (DIES KANN NICHT RÜCKGÄNGIG GEMACHT WERDEN) |
115 | form_password: | 115 | form_password: |
116 | description: "Hier kannst du dein Kennwort ändern. Dieses sollte mindestens acht Zeichen enthalten." | 116 | description: "Hier kannst du dein Kennwort ändern. Dieses sollte mindestens acht Zeichen enthalten." |
@@ -155,7 +155,7 @@ config: | |||
155 | or: 'Eine Regel ODER die andere' | 155 | or: 'Eine Regel ODER die andere' |
156 | and: 'Eine Regel UND eine andere' | 156 | and: 'Eine Regel UND eine andere' |
157 | matches: 'Testet, ob eine <i>Variable</i> auf eine <i>Suche</i> zutrifft (Groß- und Kleinschreibung wird nicht berücksichtigt).<br />Beispiel: <code>title matches "Fußball"</code>' | 157 | matches: 'Testet, ob eine <i>Variable</i> auf eine <i>Suche</i> zutrifft (Groß- und Kleinschreibung wird nicht berücksichtigt).<br />Beispiel: <code>title matches "Fußball"</code>' |
158 | # notmatches: 'Tests that a <i>subject</i> is not matches a <i>search</i> (case-insensitive).<br />Example: <code>title notmatches "football"</code>' | 158 | notmatches: 'Testet, ob ein <i>Titel</i> nicht auf eine <i>Suche</i> zutrifft (Groß- und Kleinschreibung wird nicht berücksichtigt).<br />Beispiel: <code>title notmatches "Fußball"</code>' |
159 | 159 | ||
160 | entry: | 160 | entry: |
161 | page_titles: | 161 | page_titles: |
@@ -225,8 +225,8 @@ entry: | |||
225 | original_article: 'original' | 225 | original_article: 'original' |
226 | annotations_on_the_entry: '{0} Keine Anmerkungen|{1} Eine Anmerkung|]1,Inf[ %count% Anmerkungen' | 226 | annotations_on_the_entry: '{0} Keine Anmerkungen|{1} Eine Anmerkung|]1,Inf[ %count% Anmerkungen' |
227 | created_at: 'Erstellungsdatum' | 227 | created_at: 'Erstellungsdatum' |
228 | # published_at: 'Publication date' | 228 | published_at: 'Erscheinungsdatum' |
229 | # published_by: 'Published by' | 229 | published_by: 'Veröffentlicht von' |
230 | new: | 230 | new: |
231 | page_title: 'Neuen Artikel speichern' | 231 | page_title: 'Neuen Artikel speichern' |
232 | placeholder: 'https://website.de' | 232 | placeholder: 'https://website.de' |
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Speichern' | 241 | save_label: 'Speichern' |
242 | public: | 242 | public: |
243 | shared_by_wallabag: "Dieser Artikel wurde mittels <a href='%wallabag_instance%'>wallabag</a> geteilt" | 243 | shared_by_wallabag: "Dieser Artikel wurde mittels <a href='%wallabag_instance%'>wallabag</a> geteilt" |
244 | confirm: | ||
245 | delete: "Bist du sicher, dass du diesen Artikel löschen möchtest?" | ||
246 | delete_tag: "Bist du sicher, dass du diesen Tag vom Artikel entfernen möchtest?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'Ãœber' | 249 | page_title: 'Ãœber' |
@@ -514,7 +517,7 @@ user: | |||
514 | delete_confirm: Bist du sicher? | 517 | delete_confirm: Bist du sicher? |
515 | back_to_list: Zurück zur Liste | 518 | back_to_list: Zurück zur Liste |
516 | search: | 519 | search: |
517 | # placeholder: Filter by username or email | 520 | placeholder: Filtere nach Benutzer oder E-Mail-Adresse |
518 | 521 | ||
519 | error: | 522 | error: |
520 | page_title: Ein Fehler ist aufgetreten | 523 | page_title: Ein Fehler ist aufgetreten |
@@ -533,7 +536,7 @@ flashes: | |||
533 | annotations_reset: Anmerkungen zurücksetzen | 536 | annotations_reset: Anmerkungen zurücksetzen |
534 | tags_reset: Tags zurücksetzen | 537 | tags_reset: Tags zurücksetzen |
535 | entries_reset: Einträge zurücksetzen | 538 | entries_reset: Einträge zurücksetzen |
536 | # archived_reset: Archived entries deleted | 539 | archived_reset: Archiverte Einträge zurücksetzen |
537 | entry: | 540 | entry: |
538 | notice: | 541 | notice: |
539 | entry_already_saved: 'Eintrag bereits am %date% gespeichert' | 542 | entry_already_saved: 'Eintrag bereits am %date% gespeichert' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 3a006a0e..8703a0e5 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Save' | 241 | save_label: 'Save' |
242 | public: | 242 | public: |
243 | shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" | 243 | shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | delete: "Are you sure you want to remove that article?" | ||
246 | delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'About' | 249 | page_title: 'About' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index ca5d9b2c..0f2a4a7b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Guardar' | 241 | save_label: 'Guardar' |
242 | public: | 242 | public: |
243 | shared_by_wallabag: "Este artÃculo se ha compartido con <a href='%wallabag_instance%'>wallabag</a>" | 243 | shared_by_wallabag: "Este artÃculo se ha compartido con <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | # delete: "Are you sure you want to remove that article?" | ||
246 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'Acerca de' | 249 | page_title: 'Acerca de' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index ecd8f64d..ec7a4362 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'ذخیره' | 241 | save_label: 'ذخیره' |
242 | public: | 242 | public: |
243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" | 243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | # delete: "Are you sure you want to remove that article?" | ||
246 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'درباره' | 249 | page_title: 'درباره' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 84706459..6969b67b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: "Enregistrer" | 241 | save_label: "Enregistrer" |
242 | public: | 242 | public: |
243 | shared_by_wallabag: "Cet article a été partagé par <a href=\"%wallabag_instance%\">wallabag</a>" | 243 | shared_by_wallabag: "Cet article a été partagé par <a href=\"%wallabag_instance%\">wallabag</a>" |
244 | confirm: | ||
245 | delete: "Voulez-vous vraiment supprimer cet article ?" | ||
246 | delete_tag: "Voulez-vous vraiment supprimer ce tag de cet article ?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: "À propos" | 249 | page_title: "À propos" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index a8baa96f..70e9575a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Salva' | 241 | save_label: 'Salva' |
242 | public: | 242 | public: |
243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" | 243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | # delete: "Are you sure you want to remove that article?" | ||
246 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'About' | 249 | page_title: 'About' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 8f39ce05..3ac472d0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Enregistrar' | 241 | save_label: 'Enregistrar' |
242 | public: | 242 | public: |
243 | shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>" | 243 | shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | # delete: "Are you sure you want to remove that article?" | ||
246 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'A prepaus' | 249 | page_title: 'A prepaus' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index a6e0c10f..fa672387 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -110,7 +110,7 @@ config: | |||
110 | annotations: Usuń WSZYSTKIE adnotacje | 110 | annotations: Usuń WSZYSTKIE adnotacje |
111 | tags: Usuń WSZYSTKIE tagi | 111 | tags: Usuń WSZYSTKIE tagi |
112 | entries: usuń WSZYTSTKIE wpisy | 112 | entries: usuń WSZYTSTKIE wpisy |
113 | # archived: Remove ALL archived entries | 113 | archived: usuń WSZYSTKIE zarchiwizowane wpisy |
114 | confirm: Jesteś pewien? (tej operacji NIE MOŻNA cofnąć) | 114 | confirm: Jesteś pewien? (tej operacji NIE MOŻNA cofnąć) |
115 | form_password: | 115 | form_password: |
116 | description: "Tutaj możesz zmienić swoje hasło. Twoje nowe hasło powinno mieć conajmniej 8 znaków." | 116 | description: "Tutaj możesz zmienić swoje hasło. Twoje nowe hasło powinno mieć conajmniej 8 znaków." |
@@ -155,7 +155,7 @@ config: | |||
155 | or: 'Jedna reguła LUB inna' | 155 | or: 'Jedna reguła LUB inna' |
156 | and: 'Jedna reguła I inna' | 156 | and: 'Jedna reguła I inna' |
157 | matches: 'Sprawdź czy <i>temat</i> pasuje <i>szukaj</i> (duże lub małe litery).<br />Przykład: <code>tytuł zawiera "piłka nożna"</code>' | 157 | matches: 'Sprawdź czy <i>temat</i> pasuje <i>szukaj</i> (duże lub małe litery).<br />Przykład: <code>tytuł zawiera "piłka nożna"</code>' |
158 | # notmatches: 'Tests that a <i>subject</i> is not matches a <i>search</i> (case-insensitive).<br />Example: <code>title notmatches "football"</code>' | 158 | notmatches: 'Sprawdź czy <i>temat</i> nie zawiera <i>szukaj</i> (duże lub małe litery).<br />Przykład: <code>tytuł nie zawiera "piłka nożna"</code>' |
159 | 159 | ||
160 | entry: | 160 | entry: |
161 | page_titles: | 161 | page_titles: |
@@ -225,8 +225,8 @@ entry: | |||
225 | original_article: 'oryginalny' | 225 | original_article: 'oryginalny' |
226 | annotations_on_the_entry: '{0} Nie ma adnotacji |{1} Jedna adnotacja |]1,Inf[ %count% adnotacji' | 226 | annotations_on_the_entry: '{0} Nie ma adnotacji |{1} Jedna adnotacja |]1,Inf[ %count% adnotacji' |
227 | created_at: 'Czas stworzenia' | 227 | created_at: 'Czas stworzenia' |
228 | # published_at: 'Publication date' | 228 | published_at: 'Data publikacji' |
229 | # published_by: 'Published by' | 229 | published_by: 'Opublikowane przez' |
230 | new: | 230 | new: |
231 | page_title: 'Zapisz nowy wpis' | 231 | page_title: 'Zapisz nowy wpis' |
232 | placeholder: 'http://website.com' | 232 | placeholder: 'http://website.com' |
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Zapisz' | 241 | save_label: 'Zapisz' |
242 | public: | 242 | public: |
243 | shared_by_wallabag: "Ten artykuł został udostępniony przez <a href='%wallabag_instance%'>wallabag</a>" | 243 | shared_by_wallabag: "Ten artykuł został udostępniony przez <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | delete: "Czy jesteś pewien, że chcesz usunąć ten artykuł?" | ||
246 | delete_tag: "Czy jesteś pewien, że chcesz usunąć ten tag, z tego artykułu?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'O nas' | 249 | page_title: 'O nas' |
@@ -514,7 +517,7 @@ user: | |||
514 | delete_confirm: JesteÅ› pewien? | 517 | delete_confirm: JesteÅ› pewien? |
515 | back_to_list: Powrót do listy | 518 | back_to_list: Powrót do listy |
516 | search: | 519 | search: |
517 | # placeholder: Filter by username or email | 520 | placeholder: Filtruj po nazwie użytkownika lub adresie e-mail |
518 | 521 | ||
519 | error: | 522 | error: |
520 | page_title: Wystąpił błąd | 523 | page_title: Wystąpił błąd |
@@ -533,7 +536,7 @@ flashes: | |||
533 | annotations_reset: Zresetuj adnotacje | 536 | annotations_reset: Zresetuj adnotacje |
534 | tags_reset: Zresetuj tagi | 537 | tags_reset: Zresetuj tagi |
535 | entries_reset: Zresetuj wpisy | 538 | entries_reset: Zresetuj wpisy |
536 | # archived_reset: Archived entries deleted | 539 | archived_reset: Zarchiwizowane wpisy usunięte |
537 | entry: | 540 | entry: |
538 | notice: | 541 | notice: |
539 | entry_already_saved: 'Wpis już został dodany %date%' | 542 | entry_already_saved: 'Wpis już został dodany %date%' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index a9473591..bf038ee8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Salvar' | 241 | save_label: 'Salvar' |
242 | public: | 242 | public: |
243 | shared_by_wallabag: "Este artigo foi compartilhado pelo <a href='%wallabag_instance%'>wallabag</a>" | 243 | shared_by_wallabag: "Este artigo foi compartilhado pelo <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | # delete: "Are you sure you want to remove that article?" | ||
246 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'Sobre' | 249 | page_title: 'Sobre' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 80d78a01..bd66d83a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Salvează' | 241 | save_label: 'Salvează' |
242 | public: | 242 | public: |
243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" | 243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | # delete: "Are you sure you want to remove that article?" | ||
246 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'Despre' | 249 | page_title: 'Despre' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 2896c823..b86c4003 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -241,6 +241,9 @@ entry: | |||
241 | save_label: 'Kaydet' | 241 | save_label: 'Kaydet' |
242 | public: | 242 | public: |
243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" | 243 | # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" |
244 | confirm: | ||
245 | # delete: "Are you sure you want to remove that article?" | ||
246 | # delete_tag: "Are you sure you want to remove that tag from that article?" | ||
244 | 247 | ||
245 | about: | 248 | about: |
246 | page_title: 'Hakkımızda' | 249 | page_title: 'Hakkımızda' |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index bdd44b54..0ba6f4f4 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | |||
@@ -50,7 +50,7 @@ | |||
50 | <li><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.list.original_article'|trans }} : {{ entry.title|e }}"><span>{{ entry.domainName|removeWww }}</span></a></li> | 50 | <li><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.list.original_article'|trans }} : {{ entry.title|e }}"><span>{{ entry.domainName|removeWww }}</span></a></li> |
51 | <li><a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool icon {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons md-24 vertical-align-middle">check</i><span>{{ 'entry.list.toogle_as_read'|trans }}</span></a></li> | 51 | <li><a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool icon {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons md-24 vertical-align-middle">check</i><span>{{ 'entry.list.toogle_as_read'|trans }}</span></a></li> |
52 | <li><a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool icon {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons md-24 vertical-align-middle">star_rate</i><span>{{ 'entry.list.toogle_as_star'|trans }}</span></a></li> | 52 | <li><a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool icon {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons md-24 vertical-align-middle">star_rate</i><span>{{ 'entry.list.toogle_as_star'|trans }}</span></a></li> |
53 | <li><a title="{{ 'entry.list.delete'|trans }}" class="tool icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons md-24 vertical-align-middle">delete</i><span>{{ 'entry.list.delete'|trans }}</span></a></li> | 53 | <li><a title="{{ 'entry.list.delete'|trans }}" class="tool icon" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons md-24 vertical-align-middle">delete</i><span>{{ 'entry.list.delete'|trans }}</span></a></li> |
54 | </ul> | 54 | </ul> |
55 | {% if (entry.previewPicture is null or listMode == 1) %} | 55 | {% if (entry.previewPicture is null or listMode == 1) %} |
56 | <ul class="card-entry-tags"> | 56 | <ul class="card-entry-tags"> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index 660211f2..3d20a6bc 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig | |||
@@ -22,7 +22,7 @@ | |||
22 | <li><a title="{{ markAsReadLabel|trans }}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %} markasread" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{{ markAsReadLabel|trans }}</span></a></li> | 22 | <li><a title="{{ markAsReadLabel|trans }}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %} markasread" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{{ markAsReadLabel|trans }}</span></a></li> |
23 | <li><a title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %} favorite" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span></a></li> | 23 | <li><a title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %} favorite" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span></a></li> |
24 | <li><a id="nav-btn-add-tag" class="tool icon icon-price-tags" title="{{ 'entry.view.left_menu.add_a_tag'|trans }}"><span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span></a></li> | 24 | <li><a id="nav-btn-add-tag" class="tool icon icon-price-tags" title="{{ 'entry.view.left_menu.add_a_tag'|trans }}"><span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span></a></li> |
25 | <li><a title="{{ 'entry.view.left_menu.delete'|trans }}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.delete'|trans }}</span></a></li> | 25 | <li><a title="{{ 'entry.view.left_menu.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.delete'|trans }}</span></a></li> |
26 | {% if craue_setting('share_public') %} | 26 | {% if craue_setting('share_public') %} |
27 | <li><a href="{{ path('share', {'id': entry.id }) }}" target="_blank" class="tool icon icon-eye" title="{{ 'entry.view.left_menu.public_link'|trans }}"><span>{{ 'entry.view.left_menu.public_link'|trans }}</span></a></li> | 27 | <li><a href="{{ path('share', {'id': entry.id }) }}" target="_blank" class="tool icon icon-eye" title="{{ 'entry.view.left_menu.public_link'|trans }}"><span>{{ 'entry.view.left_menu.public_link'|trans }}</span></a></li> |
28 | <li><a href="{{ path('delete_share', {'id': entry.id }) }}" class="tool icon icon-no-eye" title="{{ 'entry.view.left_menu.delete_public_link'|trans }}"><span>{{ 'entry.view.left_menu.delete_public_link'|trans }}</span></a></li> | 28 | <li><a href="{{ path('delete_share', {'id': entry.id }) }}" class="tool icon icon-no-eye" title="{{ 'entry.view.left_menu.delete_public_link'|trans }}"><span>{{ 'entry.view.left_menu.delete_public_link'|trans }}</span></a></li> |
@@ -74,7 +74,13 @@ | |||
74 | <aside class="tags"> | 74 | <aside class="tags"> |
75 | <div class="card-entry-tags"> | 75 | <div class="card-entry-tags"> |
76 | {% for tag in entry.tags %} | 76 | {% for tag in entry.tags %} |
77 | <span class="label-outline"><i class="material-icons">label_outline</i> <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a> <a href="{{ path('remove_tag', { 'entry': entry.id, 'tag': tag.id }) }}" class="nostyle"><i>✘</i></a></span> | 77 | <span class="label-outline"> |
78 | <i class="material-icons">label_outline</i> | ||
79 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a> | ||
80 | <a href="{{ path('remove_tag', { 'entry': entry.id, 'tag': tag.id }) }}" onclick="return confirm('{{ 'entry.confirm.delete_tag'|trans|escape('js') }}')" class="nostyle"> | ||
81 | <i>✘</i> | ||
82 | </a> | ||
83 | </span> | ||
78 | {% endfor %} | 84 | {% endfor %} |
79 | </div> | 85 | </div> |
80 | <div class="input-field baggy-add-tag" style="display: none"> | 86 | <div class="input-field baggy-add-tag" style="display: none"> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig index d278da1b..468338ac 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig | |||
@@ -9,7 +9,7 @@ | |||
9 | <li> | 9 | <li> |
10 | <a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}redo{% endif %}</i></a> | 10 | <a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}redo{% endif %}</i></a> |
11 | <a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a> | 11 | <a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a> |
12 | <a title="{{ 'entry.list.delete'|trans }}" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a> | 12 | <a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a> |
13 | </li> | 13 | </li> |
14 | </ul> | 14 | </ul> |
15 | </div> | 15 | </div> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig index 3ba6253a..174b7b54 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig | |||
@@ -10,7 +10,7 @@ | |||
10 | <li> | 10 | <li> |
11 | <a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}redo{% endif %}</i></a> | 11 | <a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}redo{% endif %}</i></a> |
12 | <a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a> | 12 | <a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a> |
13 | <a title="{{ 'entry.list.delete'|trans }}" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a> | 13 | <a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a> |
14 | </li> | 14 | </li> |
15 | </ul> | 15 | </ul> |
16 | </div> | 16 | </div> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index 58e08cbc..4cff7bf2 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig | |||
@@ -82,7 +82,7 @@ | |||
82 | <div class="collapsible-body"></div> | 82 | <div class="collapsible-body"></div> |
83 | </li> | 83 | </li> |
84 | <li class="bold border-bottom"> | 84 | <li class="bold border-bottom"> |
85 | <a class="waves-effect collapsible-header delete" title="{{ 'entry.view.left_menu.delete'|trans }}" href="{{ path('delete_entry', { 'id': entry.id }) }}"> | 85 | <a class="waves-effect collapsible-header delete" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" title="{{ 'entry.view.left_menu.delete'|trans }}" href="{{ path('delete_entry', { 'id': entry.id }) }}"> |
86 | <i class="material-icons small">delete</i> | 86 | <i class="material-icons small">delete</i> |
87 | <span>{{ 'entry.view.left_menu.delete'|trans }}</span> | 87 | <span>{{ 'entry.view.left_menu.delete'|trans }}</span> |
88 | </a> | 88 | </a> |
@@ -253,7 +253,10 @@ | |||
253 | <ul class="tags"> | 253 | <ul class="tags"> |
254 | {% for tag in entry.tags %} | 254 | {% for tag in entry.tags %} |
255 | <li class="chip"> | 255 | <li class="chip"> |
256 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a> <a href="{{ path('remove_tag', { 'entry': entry.id, 'tag': tag.id }) }}"><i class="material-icons vertical-align-middle">delete</i></a> | 256 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a> |
257 | <a href="{{ path('remove_tag', { 'entry': entry.id, 'tag': tag.id }) }}" onclick="return confirm('{{ 'entry.confirm.delete_tag'|trans|escape('js') }}')"> | ||
258 | <i class="material-icons vertical-align-middle">delete</i> | ||
259 | </a> | ||
257 | </li> | 260 | </li> |
258 | {% endfor %} | 261 | {% endfor %} |
259 | </ul> | 262 | </ul> |
@@ -279,7 +282,7 @@ | |||
279 | <ul> | 282 | <ul> |
280 | <li><a class="btn-floating" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">done</i></a></li> | 283 | <li><a class="btn-floating" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">done</i></a></li> |
281 | <li><a class="btn-floating" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">star_outline</i></a></li> | 284 | <li><a class="btn-floating" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">star_outline</i></a></li> |
282 | <li><a class="btn-floating" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a></li> | 285 | <li><a class="btn-floating" href="{{ path('delete_entry', { 'id': entry.id }) }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')"><i class="material-icons">delete</i></a></li> |
283 | </ul> | 286 | </ul> |
284 | </div> | 287 | </div> |
285 | </div> | 288 | </div> |
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index 1d4a6e27..a61388c0 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php | |||
@@ -8,6 +8,7 @@ use Doctrine\ORM\EntityManager; | |||
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | 8 | use Wallabag\CoreBundle\Helper\ContentProxy; |
9 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Entity\Tag; | 10 | use Wallabag\CoreBundle\Entity\Tag; |
11 | use Wallabag\CoreBundle\Helper\TagsAssigner; | ||
11 | use Wallabag\UserBundle\Entity\User; | 12 | use Wallabag\UserBundle\Entity\User; |
12 | use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface; | 13 | use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface; |
13 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; | 14 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
@@ -18,6 +19,7 @@ abstract class AbstractImport implements ImportInterface | |||
18 | protected $em; | 19 | protected $em; |
19 | protected $logger; | 20 | protected $logger; |
20 | protected $contentProxy; | 21 | protected $contentProxy; |
22 | protected $tagsAssigner; | ||
21 | protected $eventDispatcher; | 23 | protected $eventDispatcher; |
22 | protected $producer; | 24 | protected $producer; |
23 | protected $user; | 25 | protected $user; |
@@ -26,11 +28,12 @@ abstract class AbstractImport implements ImportInterface | |||
26 | protected $importedEntries = 0; | 28 | protected $importedEntries = 0; |
27 | protected $queuedEntries = 0; | 29 | protected $queuedEntries = 0; |
28 | 30 | ||
29 | public function __construct(EntityManager $em, ContentProxy $contentProxy, EventDispatcherInterface $eventDispatcher) | 31 | public function __construct(EntityManager $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher) |
30 | { | 32 | { |
31 | $this->em = $em; | 33 | $this->em = $em; |
32 | $this->logger = new NullLogger(); | 34 | $this->logger = new NullLogger(); |
33 | $this->contentProxy = $contentProxy; | 35 | $this->contentProxy = $contentProxy; |
36 | $this->tagsAssigner = $tagsAssigner; | ||
34 | $this->eventDispatcher = $eventDispatcher; | 37 | $this->eventDispatcher = $eventDispatcher; |
35 | } | 38 | } |
36 | 39 | ||
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 8bf7d92e..ef0eeb7e 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php | |||
@@ -4,7 +4,6 @@ namespace Wallabag\ImportBundle\Import; | |||
4 | 4 | ||
5 | use Wallabag\CoreBundle\Entity\Entry; | 5 | use Wallabag\CoreBundle\Entity\Entry; |
6 | use Wallabag\UserBundle\Entity\User; | 6 | use Wallabag\UserBundle\Entity\User; |
7 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
8 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | 7 | use Wallabag\CoreBundle\Event\EntrySavedEvent; |
9 | 8 | ||
10 | abstract class BrowserImport extends AbstractImport | 9 | abstract class BrowserImport extends AbstractImport |
@@ -205,7 +204,7 @@ abstract class BrowserImport extends AbstractImport | |||
205 | $entry = $this->fetchContent($entry, $data['url'], $data); | 204 | $entry = $this->fetchContent($entry, $data['url'], $data); |
206 | 205 | ||
207 | if (array_key_exists('tags', $data)) { | 206 | if (array_key_exists('tags', $data)) { |
208 | $this->contentProxy->assignTagsToEntry( | 207 | $this->tagsAssigner->assignTagsToEntry( |
209 | $entry, | 208 | $entry, |
210 | $data['tags'] | 209 | $data['tags'] |
211 | ); | 210 | ); |
diff --git a/src/Wallabag/ImportBundle/Import/PinboardImport.php b/src/Wallabag/ImportBundle/Import/PinboardImport.php index d9865534..489b9257 100644 --- a/src/Wallabag/ImportBundle/Import/PinboardImport.php +++ b/src/Wallabag/ImportBundle/Import/PinboardImport.php | |||
@@ -112,7 +112,7 @@ class PinboardImport extends AbstractImport | |||
112 | $entry = $this->fetchContent($entry, $data['url'], $data); | 112 | $entry = $this->fetchContent($entry, $data['url'], $data); |
113 | 113 | ||
114 | if (!empty($data['tags'])) { | 114 | if (!empty($data['tags'])) { |
115 | $this->contentProxy->assignTagsToEntry( | 115 | $this->tagsAssigner->assignTagsToEntry( |
116 | $entry, | 116 | $entry, |
117 | $data['tags'], | 117 | $data['tags'], |
118 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() | 118 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() |
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 33093480..8835161b 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -5,7 +5,6 @@ namespace Wallabag\ImportBundle\Import; | |||
5 | use GuzzleHttp\Client; | 5 | use GuzzleHttp\Client; |
6 | use GuzzleHttp\Exception\RequestException; | 6 | use GuzzleHttp\Exception\RequestException; |
7 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
9 | 8 | ||
10 | class PocketImport extends AbstractImport | 9 | class PocketImport extends AbstractImport |
11 | { | 10 | { |
@@ -216,7 +215,7 @@ class PocketImport extends AbstractImport | |||
216 | } | 215 | } |
217 | 216 | ||
218 | if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) { | 217 | if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) { |
219 | $this->contentProxy->assignTagsToEntry( | 218 | $this->tagsAssigner->assignTagsToEntry( |
220 | $entry, | 219 | $entry, |
221 | array_keys($importedEntry['tags']), | 220 | array_keys($importedEntry['tags']), |
222 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() | 221 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() |
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index 702da057..0e5382cf 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php | |||
@@ -111,7 +111,7 @@ abstract class WallabagImport extends AbstractImport | |||
111 | $entry = $this->fetchContent($entry, $data['url'], $data); | 111 | $entry = $this->fetchContent($entry, $data['url'], $data); |
112 | 112 | ||
113 | if (array_key_exists('tags', $data)) { | 113 | if (array_key_exists('tags', $data)) { |
114 | $this->contentProxy->assignTagsToEntry( | 114 | $this->tagsAssigner->assignTagsToEntry( |
115 | $entry, | 115 | $entry, |
116 | $data['tags'], | 116 | $data['tags'], |
117 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() | 117 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() |
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index c4fe3f92..661dc7e1 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml | |||
@@ -20,6 +20,7 @@ services: | |||
20 | arguments: | 20 | arguments: |
21 | - "@doctrine.orm.entity_manager" | 21 | - "@doctrine.orm.entity_manager" |
22 | - "@wallabag_core.content_proxy" | 22 | - "@wallabag_core.content_proxy" |
23 | - "@wallabag_core.tags_assigner" | ||
23 | - "@event_dispatcher" | 24 | - "@event_dispatcher" |
24 | calls: | 25 | calls: |
25 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] | 26 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] |
@@ -32,6 +33,7 @@ services: | |||
32 | arguments: | 33 | arguments: |
33 | - "@doctrine.orm.entity_manager" | 34 | - "@doctrine.orm.entity_manager" |
34 | - "@wallabag_core.content_proxy" | 35 | - "@wallabag_core.content_proxy" |
36 | - "@wallabag_core.tags_assigner" | ||
35 | - "@event_dispatcher" | 37 | - "@event_dispatcher" |
36 | calls: | 38 | calls: |
37 | - [ setLogger, [ "@logger" ]] | 39 | - [ setLogger, [ "@logger" ]] |
@@ -43,6 +45,7 @@ services: | |||
43 | arguments: | 45 | arguments: |
44 | - "@doctrine.orm.entity_manager" | 46 | - "@doctrine.orm.entity_manager" |
45 | - "@wallabag_core.content_proxy" | 47 | - "@wallabag_core.content_proxy" |
48 | - "@wallabag_core.tags_assigner" | ||
46 | - "@event_dispatcher" | 49 | - "@event_dispatcher" |
47 | calls: | 50 | calls: |
48 | - [ setLogger, [ "@logger" ]] | 51 | - [ setLogger, [ "@logger" ]] |
@@ -54,6 +57,7 @@ services: | |||
54 | arguments: | 57 | arguments: |
55 | - "@doctrine.orm.entity_manager" | 58 | - "@doctrine.orm.entity_manager" |
56 | - "@wallabag_core.content_proxy" | 59 | - "@wallabag_core.content_proxy" |
60 | - "@wallabag_core.tags_assigner" | ||
57 | - "@event_dispatcher" | 61 | - "@event_dispatcher" |
58 | calls: | 62 | calls: |
59 | - [ setLogger, [ "@logger" ]] | 63 | - [ setLogger, [ "@logger" ]] |
@@ -65,6 +69,7 @@ services: | |||
65 | arguments: | 69 | arguments: |
66 | - "@doctrine.orm.entity_manager" | 70 | - "@doctrine.orm.entity_manager" |
67 | - "@wallabag_core.content_proxy" | 71 | - "@wallabag_core.content_proxy" |
72 | - "@wallabag_core.tags_assigner" | ||
68 | - "@event_dispatcher" | 73 | - "@event_dispatcher" |
69 | calls: | 74 | calls: |
70 | - [ setLogger, [ "@logger" ]] | 75 | - [ setLogger, [ "@logger" ]] |
@@ -76,6 +81,7 @@ services: | |||
76 | arguments: | 81 | arguments: |
77 | - "@doctrine.orm.entity_manager" | 82 | - "@doctrine.orm.entity_manager" |
78 | - "@wallabag_core.content_proxy" | 83 | - "@wallabag_core.content_proxy" |
84 | - "@wallabag_core.tags_assigner" | ||
79 | - "@event_dispatcher" | 85 | - "@event_dispatcher" |
80 | calls: | 86 | calls: |
81 | - [ setLogger, [ "@logger" ]] | 87 | - [ setLogger, [ "@logger" ]] |
@@ -87,6 +93,7 @@ services: | |||
87 | arguments: | 93 | arguments: |
88 | - "@doctrine.orm.entity_manager" | 94 | - "@doctrine.orm.entity_manager" |
89 | - "@wallabag_core.content_proxy" | 95 | - "@wallabag_core.content_proxy" |
96 | - "@wallabag_core.tags_assigner" | ||
90 | - "@event_dispatcher" | 97 | - "@event_dispatcher" |
91 | calls: | 98 | calls: |
92 | - [ setLogger, [ "@logger" ]] | 99 | - [ setLogger, [ "@logger" ]] |
@@ -97,6 +104,7 @@ services: | |||
97 | arguments: | 104 | arguments: |
98 | - "@doctrine.orm.entity_manager" | 105 | - "@doctrine.orm.entity_manager" |
99 | - "@wallabag_core.content_proxy" | 106 | - "@wallabag_core.content_proxy" |
107 | - "@wallabag_core.tags_assigner" | ||
100 | - "@event_dispatcher" | 108 | - "@event_dispatcher" |
101 | calls: | 109 | calls: |
102 | - [ setLogger, [ "@logger" ]] | 110 | - [ setLogger, [ "@logger" ]] |
diff --git a/src/Wallabag/UserBundle/Controller/ManageController.php b/src/Wallabag/UserBundle/Controller/ManageController.php index 1c5c86d4..084f2c67 100644 --- a/src/Wallabag/UserBundle/Controller/ManageController.php +++ b/src/Wallabag/UserBundle/Controller/ManageController.php | |||
@@ -33,9 +33,7 @@ class ManageController extends Controller | |||
33 | // enable created user by default | 33 | // enable created user by default |
34 | $user->setEnabled(true); | 34 | $user->setEnabled(true); |
35 | 35 | ||
36 | $form = $this->createForm('Wallabag\UserBundle\Form\NewUserType', $user, [ | 36 | $form = $this->createForm('Wallabag\UserBundle\Form\NewUserType', $user); |
37 | 'validation_groups' => ['Profile'], | ||
38 | ]); | ||
39 | $form->handleRequest($request); | 37 | $form->handleRequest($request); |
40 | 38 | ||
41 | if ($form->isSubmitted() && $form->isValid()) { | 39 | if ($form->isSubmitted() && $form->isValid()) { |
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index 3a167de7..1ff3046a 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php | |||
@@ -4,11 +4,11 @@ namespace Wallabag\UserBundle\Entity; | |||
4 | 4 | ||
5 | use Doctrine\Common\Collections\ArrayCollection; | 5 | use Doctrine\Common\Collections\ArrayCollection; |
6 | use Doctrine\ORM\Mapping as ORM; | 6 | use Doctrine\ORM\Mapping as ORM; |
7 | use JMS\Serializer\Annotation\Groups; | ||
8 | use JMS\Serializer\Annotation\XmlRoot; | ||
7 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; | 9 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; |
8 | use Scheb\TwoFactorBundle\Model\TrustedComputerInterface; | 10 | use Scheb\TwoFactorBundle\Model\TrustedComputerInterface; |
9 | use FOS\UserBundle\Model\User as BaseUser; | 11 | use FOS\UserBundle\Model\User as BaseUser; |
10 | use JMS\Serializer\Annotation\ExclusionPolicy; | ||
11 | use JMS\Serializer\Annotation\Expose; | ||
12 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | 12 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
13 | use Symfony\Component\Security\Core\User\UserInterface; | 13 | use Symfony\Component\Security\Core\User\UserInterface; |
14 | use Wallabag\ApiBundle\Entity\Client; | 14 | use Wallabag\ApiBundle\Entity\Client; |
@@ -18,23 +18,25 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
18 | /** | 18 | /** |
19 | * User. | 19 | * User. |
20 | * | 20 | * |
21 | * @XmlRoot("user") | ||
21 | * @ORM\Entity(repositoryClass="Wallabag\UserBundle\Repository\UserRepository") | 22 | * @ORM\Entity(repositoryClass="Wallabag\UserBundle\Repository\UserRepository") |
22 | * @ORM\Table(name="`user`") | 23 | * @ORM\Table(name="`user`") |
23 | * @ORM\HasLifecycleCallbacks() | 24 | * @ORM\HasLifecycleCallbacks() |
24 | * @ExclusionPolicy("all") | ||
25 | * | 25 | * |
26 | * @UniqueEntity("email") | 26 | * @UniqueEntity("email") |
27 | * @UniqueEntity("username") | 27 | * @UniqueEntity("username") |
28 | */ | 28 | */ |
29 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface | 29 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface |
30 | { | 30 | { |
31 | /** @Serializer\XmlAttribute */ | ||
31 | /** | 32 | /** |
32 | * @var int | 33 | * @var int |
33 | * | 34 | * |
34 | * @Expose | ||
35 | * @ORM\Column(name="id", type="integer") | 35 | * @ORM\Column(name="id", type="integer") |
36 | * @ORM\Id | 36 | * @ORM\Id |
37 | * @ORM\GeneratedValue(strategy="AUTO") | 37 | * @ORM\GeneratedValue(strategy="AUTO") |
38 | * | ||
39 | * @Groups({"user_api"}) | ||
38 | */ | 40 | */ |
39 | protected $id; | 41 | protected $id; |
40 | 42 | ||
@@ -42,13 +44,31 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf | |||
42 | * @var string | 44 | * @var string |
43 | * | 45 | * |
44 | * @ORM\Column(name="name", type="text", nullable=true) | 46 | * @ORM\Column(name="name", type="text", nullable=true) |
47 | * | ||
48 | * @Groups({"user_api"}) | ||
45 | */ | 49 | */ |
46 | protected $name; | 50 | protected $name; |
47 | 51 | ||
48 | /** | 52 | /** |
53 | * @var string | ||
54 | * | ||
55 | * @Groups({"user_api"}) | ||
56 | */ | ||
57 | protected $username; | ||
58 | |||
59 | /** | ||
60 | * @var string | ||
61 | * | ||
62 | * @Groups({"user_api"}) | ||
63 | */ | ||
64 | protected $email; | ||
65 | |||
66 | /** | ||
49 | * @var date | 67 | * @var date |
50 | * | 68 | * |
51 | * @ORM\Column(name="created_at", type="datetime") | 69 | * @ORM\Column(name="created_at", type="datetime") |
70 | * | ||
71 | * @Groups({"user_api"}) | ||
52 | */ | 72 | */ |
53 | protected $createdAt; | 73 | protected $createdAt; |
54 | 74 | ||
@@ -56,6 +76,8 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf | |||
56 | * @var date | 76 | * @var date |
57 | * | 77 | * |
58 | * @ORM\Column(name="updated_at", type="datetime") | 78 | * @ORM\Column(name="updated_at", type="datetime") |
79 | * | ||
80 | * @Groups({"user_api"}) | ||
59 | */ | 81 | */ |
60 | protected $updatedAt; | 82 | protected $updatedAt; |
61 | 83 | ||
diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php new file mode 100644 index 00000000..3f4969a5 --- /dev/null +++ b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php | |||
@@ -0,0 +1,110 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Tests\Wallabag\ApiBundle\Controller; | ||
4 | |||
5 | use Tests\Wallabag\ApiBundle\WallabagApiTestCase; | ||
6 | |||
7 | class UserRestControllerTest extends WallabagApiTestCase | ||
8 | { | ||
9 | public function testGetUser() | ||
10 | { | ||
11 | $this->client->request('GET', '/api/user.json'); | ||
12 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
13 | |||
14 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
15 | |||
16 | $this->assertArrayHasKey('id', $content); | ||
17 | $this->assertArrayHasKey('email', $content); | ||
18 | $this->assertArrayHasKey('name', $content); | ||
19 | $this->assertArrayHasKey('username', $content); | ||
20 | $this->assertArrayHasKey('created_at', $content); | ||
21 | $this->assertArrayHasKey('updated_at', $content); | ||
22 | |||
23 | $this->assertEquals('bigboss@wallabag.org', $content['email']); | ||
24 | $this->assertEquals('Big boss', $content['name']); | ||
25 | $this->assertEquals('admin', $content['username']); | ||
26 | |||
27 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); | ||
28 | } | ||
29 | |||
30 | public function testCreateNewUser() | ||
31 | { | ||
32 | $this->client->request('PUT', '/api/user.json', [ | ||
33 | 'username' => 'google', | ||
34 | 'password' => 'googlegoogle', | ||
35 | 'email' => 'wallabag@google.com', | ||
36 | ]); | ||
37 | |||
38 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
39 | |||
40 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
41 | |||
42 | $this->assertArrayHasKey('id', $content); | ||
43 | $this->assertArrayHasKey('email', $content); | ||
44 | $this->assertArrayHasKey('username', $content); | ||
45 | $this->assertArrayHasKey('created_at', $content); | ||
46 | $this->assertArrayHasKey('updated_at', $content); | ||
47 | |||
48 | $this->assertEquals('wallabag@google.com', $content['email']); | ||
49 | $this->assertEquals('google', $content['username']); | ||
50 | |||
51 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); | ||
52 | |||
53 | // remove the created user to avoid side effect on other tests | ||
54 | // @todo remove these lines when test will be isolated | ||
55 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | ||
56 | |||
57 | $query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Config c WHERE c.user = :user_id'); | ||
58 | $query->setParameter('user_id', $content['id']); | ||
59 | $query->execute(); | ||
60 | |||
61 | $query = $em->createQuery('DELETE FROM Wallabag\UserBundle\Entity\User u WHERE u.id = :id'); | ||
62 | $query->setParameter('id', $content['id']); | ||
63 | $query->execute(); | ||
64 | } | ||
65 | |||
66 | public function testCreateNewUserWithExistingEmail() | ||
67 | { | ||
68 | $this->client->request('PUT', '/api/user.json', [ | ||
69 | 'username' => 'admin', | ||
70 | 'password' => 'googlegoogle', | ||
71 | 'email' => 'bigboss@wallabag.org', | ||
72 | ]); | ||
73 | |||
74 | $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | ||
75 | |||
76 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
77 | |||
78 | $this->assertArrayHasKey('error', $content); | ||
79 | $this->assertArrayHasKey('username', $content['error']); | ||
80 | $this->assertArrayHasKey('email', $content['error']); | ||
81 | |||
82 | // $this->assertEquals('fos_user.username.already_used', $content['error']['username'][0]); | ||
83 | // $this->assertEquals('fos_user.email.already_used', $content['error']['email'][0]); | ||
84 | // This shouldn't be translated ... | ||
85 | $this->assertEquals('This value is already used.', $content['error']['username'][0]); | ||
86 | $this->assertEquals('This value is already used.', $content['error']['email'][0]); | ||
87 | |||
88 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); | ||
89 | } | ||
90 | |||
91 | public function testCreateNewUserWithTooShortPassword() | ||
92 | { | ||
93 | $this->client->request('PUT', '/api/user.json', [ | ||
94 | 'username' => 'facebook', | ||
95 | 'password' => 'face', | ||
96 | 'email' => 'facebook@wallabag.org', | ||
97 | ]); | ||
98 | |||
99 | $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); | ||
100 | |||
101 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
102 | |||
103 | $this->assertArrayHasKey('error', $content); | ||
104 | $this->assertArrayHasKey('password', $content['error']); | ||
105 | |||
106 | $this->assertEquals('validator.password_too_short', $content['error']['password'][0]); | ||
107 | |||
108 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); | ||
109 | } | ||
110 | } | ||
diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php index cf9b3347..a67655c8 100644 --- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php +++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php | |||
@@ -37,7 +37,7 @@ abstract class WallabagApiTestCase extends WebTestCase | |||
37 | $firewallName = $container->getParameter('fos_user.firewall_name'); | 37 | $firewallName = $container->getParameter('fos_user.firewall_name'); |
38 | 38 | ||
39 | $this->user = $userManager->findUserBy(['username' => 'admin']); | 39 | $this->user = $userManager->findUserBy(['username' => 'admin']); |
40 | $loginManager->loginUser($firewallName, $this->user); | 40 | $loginManager->logInUser($firewallName, $this->user); |
41 | 41 | ||
42 | // save the login token into the session and put it in a cookie | 42 | // save the login token into the session and put it in a cookie |
43 | $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); | 43 | $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); |
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 8abb1bbb..77dfd5bf 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -7,10 +7,12 @@ use Wallabag\CoreBundle\Helper\ContentProxy; | |||
7 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
8 | use Wallabag\CoreBundle\Entity\Tag; | 8 | use Wallabag\CoreBundle\Entity\Tag; |
9 | use Wallabag\UserBundle\Entity\User; | 9 | use Wallabag\UserBundle\Entity\User; |
10 | use Wallabag\CoreBundle\Repository\TagRepository; | ||
11 | use Wallabag\CoreBundle\Helper\RuleBasedTagger; | ||
10 | 12 | ||
11 | class ContentProxyTest extends \PHPUnit_Framework_TestCase | 13 | class ContentProxyTest extends \PHPUnit_Framework_TestCase |
12 | { | 14 | { |
13 | private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.'; | 15 | private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.'; |
14 | 16 | ||
15 | public function testWithBadUrl() | 17 | public function testWithBadUrl() |
16 | { | 18 | { |
@@ -33,7 +35,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
33 | 'language' => '', | 35 | 'language' => '', |
34 | ]); | 36 | ]); |
35 | 37 | ||
36 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); | 38 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
37 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); | 39 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); |
38 | 40 | ||
39 | $this->assertEquals('http://user@:80', $entry->getUrl()); | 41 | $this->assertEquals('http://user@:80', $entry->getUrl()); |
@@ -67,7 +69,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
67 | 'language' => '', | 69 | 'language' => '', |
68 | ]); | 70 | ]); |
69 | 71 | ||
70 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); | 72 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
71 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 73 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
72 | 74 | ||
73 | $this->assertEquals('http://0.0.0.0', $entry->getUrl()); | 75 | $this->assertEquals('http://0.0.0.0', $entry->getUrl()); |
@@ -106,7 +108,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
106 | ], | 108 | ], |
107 | ]); | 109 | ]); |
108 | 110 | ||
109 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); | 111 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
110 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); | 112 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); |
111 | 113 | ||
112 | $this->assertEquals('http://domain.io', $entry->getUrl()); | 114 | $this->assertEquals('http://domain.io', $entry->getUrl()); |
@@ -147,7 +149,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
147 | ], | 149 | ], |
148 | ]); | 150 | ]); |
149 | 151 | ||
150 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); | 152 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
151 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 153 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
152 | 154 | ||
153 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 155 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); |
@@ -188,7 +190,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
188 | ], | 190 | ], |
189 | ]); | 191 | ]); |
190 | 192 | ||
191 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); | 193 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
192 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 194 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); |
193 | 195 | ||
194 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 196 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); |
@@ -210,7 +212,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
210 | 212 | ||
211 | $graby = $this->getMockBuilder('Graby\Graby')->getMock(); | 213 | $graby = $this->getMockBuilder('Graby\Graby')->getMock(); |
212 | 214 | ||
213 | $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); | 215 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
214 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ | 216 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ |
215 | 'html' => str_repeat('this is my content', 325), | 217 | 'html' => str_repeat('this is my content', 325), |
216 | 'title' => 'this is my title', | 218 | 'title' => 'this is my title', |
@@ -239,8 +241,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
239 | ->method('tag') | 241 | ->method('tag') |
240 | ->will($this->throwException(new \Exception())); | 242 | ->will($this->throwException(new \Exception())); |
241 | 243 | ||
242 | $tagRepo = $this->getTagRepositoryMock(); | 244 | $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); |
243 | $proxy = new ContentProxy($graby, $tagger, $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); | ||
244 | 245 | ||
245 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ | 246 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ |
246 | 'html' => str_repeat('this is my content', 325), | 247 | 'html' => str_repeat('this is my content', 325), |
@@ -253,134 +254,14 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
253 | $this->assertCount(0, $entry->getTags()); | 254 | $this->assertCount(0, $entry->getTags()); |
254 | } | 255 | } |
255 | 256 | ||
256 | public function testAssignTagsWithArrayAndExtraSpaces() | ||
257 | { | ||
258 | $graby = $this->getMockBuilder('Graby\Graby') | ||
259 | ->disableOriginalConstructor() | ||
260 | ->getMock(); | ||
261 | |||
262 | $tagRepo = $this->getTagRepositoryMock(); | ||
263 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); | ||
264 | |||
265 | $entry = new Entry(new User()); | ||
266 | |||
267 | $proxy->assignTagsToEntry($entry, [' tag1', 'tag2 ']); | ||
268 | |||
269 | $this->assertCount(2, $entry->getTags()); | ||
270 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
271 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | ||
272 | } | ||
273 | |||
274 | public function testAssignTagsWithString() | ||
275 | { | ||
276 | $graby = $this->getMockBuilder('Graby\Graby') | ||
277 | ->disableOriginalConstructor() | ||
278 | ->getMock(); | ||
279 | |||
280 | $tagRepo = $this->getTagRepositoryMock(); | ||
281 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); | ||
282 | |||
283 | $entry = new Entry(new User()); | ||
284 | |||
285 | $proxy->assignTagsToEntry($entry, 'tag1, tag2'); | ||
286 | |||
287 | $this->assertCount(2, $entry->getTags()); | ||
288 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
289 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | ||
290 | } | ||
291 | |||
292 | public function testAssignTagsWithEmptyArray() | ||
293 | { | ||
294 | $graby = $this->getMockBuilder('Graby\Graby') | ||
295 | ->disableOriginalConstructor() | ||
296 | ->getMock(); | ||
297 | |||
298 | $tagRepo = $this->getTagRepositoryMock(); | ||
299 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); | ||
300 | |||
301 | $entry = new Entry(new User()); | ||
302 | |||
303 | $proxy->assignTagsToEntry($entry, []); | ||
304 | |||
305 | $this->assertCount(0, $entry->getTags()); | ||
306 | } | ||
307 | |||
308 | public function testAssignTagsWithEmptyString() | ||
309 | { | ||
310 | $graby = $this->getMockBuilder('Graby\Graby') | ||
311 | ->disableOriginalConstructor() | ||
312 | ->getMock(); | ||
313 | |||
314 | $tagRepo = $this->getTagRepositoryMock(); | ||
315 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); | ||
316 | |||
317 | $entry = new Entry(new User()); | ||
318 | |||
319 | $proxy->assignTagsToEntry($entry, ''); | ||
320 | |||
321 | $this->assertCount(0, $entry->getTags()); | ||
322 | } | ||
323 | |||
324 | public function testAssignTagsAlreadyAssigned() | ||
325 | { | ||
326 | $graby = $this->getMockBuilder('Graby\Graby') | ||
327 | ->disableOriginalConstructor() | ||
328 | ->getMock(); | ||
329 | |||
330 | $tagRepo = $this->getTagRepositoryMock(); | ||
331 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); | ||
332 | |||
333 | $tagEntity = new Tag(); | ||
334 | $tagEntity->setLabel('tag1'); | ||
335 | |||
336 | $entry = new Entry(new User()); | ||
337 | $entry->addTag($tagEntity); | ||
338 | |||
339 | $proxy->assignTagsToEntry($entry, 'tag1, tag2'); | ||
340 | |||
341 | $this->assertCount(2, $entry->getTags()); | ||
342 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
343 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | ||
344 | } | ||
345 | |||
346 | public function testAssignTagsNotFlushed() | ||
347 | { | ||
348 | $graby = $this->getMockBuilder('Graby\Graby') | ||
349 | ->disableOriginalConstructor() | ||
350 | ->getMock(); | ||
351 | |||
352 | $tagRepo = $this->getTagRepositoryMock(); | ||
353 | $tagRepo->expects($this->never()) | ||
354 | ->method('__call'); | ||
355 | |||
356 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); | ||
357 | |||
358 | $tagEntity = new Tag(); | ||
359 | $tagEntity->setLabel('tag1'); | ||
360 | |||
361 | $entry = new Entry(new User()); | ||
362 | |||
363 | $proxy->assignTagsToEntry($entry, 'tag1', [$tagEntity]); | ||
364 | |||
365 | $this->assertCount(1, $entry->getTags()); | ||
366 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
367 | } | ||
368 | |||
369 | private function getTaggerMock() | 257 | private function getTaggerMock() |
370 | { | 258 | { |
371 | return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') | 259 | return $this->getMockBuilder(RuleBasedTagger::class) |
372 | ->setMethods(['tag']) | 260 | ->setMethods(['tag']) |
373 | ->disableOriginalConstructor() | 261 | ->disableOriginalConstructor() |
374 | ->getMock(); | 262 | ->getMock(); |
375 | } | 263 | } |
376 | 264 | ||
377 | private function getTagRepositoryMock() | ||
378 | { | ||
379 | return $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository') | ||
380 | ->disableOriginalConstructor() | ||
381 | ->getMock(); | ||
382 | } | ||
383 | |||
384 | private function getLogger() | 265 | private function getLogger() |
385 | { | 266 | { |
386 | return new NullLogger(); | 267 | return new NullLogger(); |
diff --git a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php new file mode 100644 index 00000000..6d6d6484 --- /dev/null +++ b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php | |||
@@ -0,0 +1,108 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Tests\Wallabag\CoreBundle\Helper; | ||
4 | |||
5 | use Wallabag\CoreBundle\Entity\Entry; | ||
6 | use Wallabag\CoreBundle\Entity\Tag; | ||
7 | use Wallabag\CoreBundle\Helper\TagsAssigner; | ||
8 | use Wallabag\UserBundle\Entity\User; | ||
9 | use Wallabag\CoreBundle\Repository\TagRepository; | ||
10 | |||
11 | class TagsAssignerTest extends \PHPUnit_Framework_TestCase | ||
12 | { | ||
13 | public function testAssignTagsWithArrayAndExtraSpaces() | ||
14 | { | ||
15 | $tagRepo = $this->getTagRepositoryMock(); | ||
16 | $tagsAssigner = new TagsAssigner($tagRepo); | ||
17 | |||
18 | $entry = new Entry(new User()); | ||
19 | |||
20 | $tagsAssigner->assignTagsToEntry($entry, [' tag1', 'tag2 ']); | ||
21 | |||
22 | $this->assertCount(2, $entry->getTags()); | ||
23 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
24 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | ||
25 | } | ||
26 | |||
27 | public function testAssignTagsWithString() | ||
28 | { | ||
29 | $tagRepo = $this->getTagRepositoryMock(); | ||
30 | $tagsAssigner = new TagsAssigner($tagRepo); | ||
31 | |||
32 | $entry = new Entry(new User()); | ||
33 | |||
34 | $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); | ||
35 | |||
36 | $this->assertCount(2, $entry->getTags()); | ||
37 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
38 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | ||
39 | } | ||
40 | |||
41 | public function testAssignTagsWithEmptyArray() | ||
42 | { | ||
43 | $tagRepo = $this->getTagRepositoryMock(); | ||
44 | $tagsAssigner = new TagsAssigner($tagRepo); | ||
45 | |||
46 | $entry = new Entry(new User()); | ||
47 | |||
48 | $tagsAssigner->assignTagsToEntry($entry, []); | ||
49 | |||
50 | $this->assertCount(0, $entry->getTags()); | ||
51 | } | ||
52 | |||
53 | public function testAssignTagsWithEmptyString() | ||
54 | { | ||
55 | $tagRepo = $this->getTagRepositoryMock(); | ||
56 | $tagsAssigner = new TagsAssigner($tagRepo); | ||
57 | |||
58 | $entry = new Entry(new User()); | ||
59 | |||
60 | $tagsAssigner->assignTagsToEntry($entry, ''); | ||
61 | |||
62 | $this->assertCount(0, $entry->getTags()); | ||
63 | } | ||
64 | |||
65 | public function testAssignTagsAlreadyAssigned() | ||
66 | { | ||
67 | $tagRepo = $this->getTagRepositoryMock(); | ||
68 | $tagsAssigner = new TagsAssigner($tagRepo); | ||
69 | |||
70 | $tagEntity = new Tag(); | ||
71 | $tagEntity->setLabel('tag1'); | ||
72 | |||
73 | $entry = new Entry(new User()); | ||
74 | $entry->addTag($tagEntity); | ||
75 | |||
76 | $tagsAssigner->assignTagsToEntry($entry, 'tag1, tag2'); | ||
77 | |||
78 | $this->assertCount(2, $entry->getTags()); | ||
79 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
80 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | ||
81 | } | ||
82 | |||
83 | public function testAssignTagsNotFlushed() | ||
84 | { | ||
85 | $tagRepo = $this->getTagRepositoryMock(); | ||
86 | $tagRepo->expects($this->never()) | ||
87 | ->method('__call'); | ||
88 | |||
89 | $tagsAssigner = new TagsAssigner($tagRepo); | ||
90 | |||
91 | $tagEntity = new Tag(); | ||
92 | $tagEntity->setLabel('tag1'); | ||
93 | |||
94 | $entry = new Entry(new User()); | ||
95 | |||
96 | $tagsAssigner->assignTagsToEntry($entry, 'tag1', [$tagEntity]); | ||
97 | |||
98 | $this->assertCount(1, $entry->getTags()); | ||
99 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
100 | } | ||
101 | |||
102 | private function getTagRepositoryMock() | ||
103 | { | ||
104 | return $this->getMockBuilder(TagRepository::class) | ||
105 | ->disableOriginalConstructor() | ||
106 | ->getMock(); | ||
107 | } | ||
108 | } | ||
diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php index 6b3adda4..cec19534 100644 --- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php | |||
@@ -17,6 +17,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase | |||
17 | protected $em; | 17 | protected $em; |
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | protected $tagsAssigner; | ||
20 | 21 | ||
21 | private function getChromeImport($unsetUser = false, $dispatched = 0) | 22 | private function getChromeImport($unsetUser = false, $dispatched = 0) |
22 | { | 23 | { |
@@ -30,6 +31,10 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase | |||
30 | ->disableOriginalConstructor() | 31 | ->disableOriginalConstructor() |
31 | ->getMock(); | 32 | ->getMock(); |
32 | 33 | ||
34 | $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') | ||
35 | ->disableOriginalConstructor() | ||
36 | ->getMock(); | ||
37 | |||
33 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | 38 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
34 | ->disableOriginalConstructor() | 39 | ->disableOriginalConstructor() |
35 | ->getMock(); | 40 | ->getMock(); |
@@ -38,7 +43,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase | |||
38 | ->expects($this->exactly($dispatched)) | 43 | ->expects($this->exactly($dispatched)) |
39 | ->method('dispatch'); | 44 | ->method('dispatch'); |
40 | 45 | ||
41 | $wallabag = new ChromeImport($this->em, $this->contentProxy, $dispatcher); | 46 | $wallabag = new ChromeImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); |
42 | 47 | ||
43 | $this->logHandler = new TestHandler(); | 48 | $this->logHandler = new TestHandler(); |
44 | $logger = new Logger('test', [$this->logHandler]); | 49 | $logger = new Logger('test', [$this->logHandler]); |
diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php index b516fbc5..c186c820 100644 --- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php | |||
@@ -17,6 +17,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase | |||
17 | protected $em; | 17 | protected $em; |
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | protected $tagsAssigner; | ||
20 | 21 | ||
21 | private function getFirefoxImport($unsetUser = false, $dispatched = 0) | 22 | private function getFirefoxImport($unsetUser = false, $dispatched = 0) |
22 | { | 23 | { |
@@ -30,6 +31,10 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase | |||
30 | ->disableOriginalConstructor() | 31 | ->disableOriginalConstructor() |
31 | ->getMock(); | 32 | ->getMock(); |
32 | 33 | ||
34 | $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') | ||
35 | ->disableOriginalConstructor() | ||
36 | ->getMock(); | ||
37 | |||
33 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | 38 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
34 | ->disableOriginalConstructor() | 39 | ->disableOriginalConstructor() |
35 | ->getMock(); | 40 | ->getMock(); |
@@ -38,7 +43,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase | |||
38 | ->expects($this->exactly($dispatched)) | 43 | ->expects($this->exactly($dispatched)) |
39 | ->method('dispatch'); | 44 | ->method('dispatch'); |
40 | 45 | ||
41 | $wallabag = new FirefoxImport($this->em, $this->contentProxy, $dispatcher); | 46 | $wallabag = new FirefoxImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); |
42 | 47 | ||
43 | $this->logHandler = new TestHandler(); | 48 | $this->logHandler = new TestHandler(); |
44 | $logger = new Logger('test', [$this->logHandler]); | 49 | $logger = new Logger('test', [$this->logHandler]); |
diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php index e262a808..6777a02e 100644 --- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php | |||
@@ -17,6 +17,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase | |||
17 | protected $em; | 17 | protected $em; |
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | protected $tagsAssigner; | ||
20 | 21 | ||
21 | private function getInstapaperImport($unsetUser = false, $dispatched = 0) | 22 | private function getInstapaperImport($unsetUser = false, $dispatched = 0) |
22 | { | 23 | { |
@@ -30,6 +31,10 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase | |||
30 | ->disableOriginalConstructor() | 31 | ->disableOriginalConstructor() |
31 | ->getMock(); | 32 | ->getMock(); |
32 | 33 | ||
34 | $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') | ||
35 | ->disableOriginalConstructor() | ||
36 | ->getMock(); | ||
37 | |||
33 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | 38 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
34 | ->disableOriginalConstructor() | 39 | ->disableOriginalConstructor() |
35 | ->getMock(); | 40 | ->getMock(); |
@@ -38,7 +43,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase | |||
38 | ->expects($this->exactly($dispatched)) | 43 | ->expects($this->exactly($dispatched)) |
39 | ->method('dispatch'); | 44 | ->method('dispatch'); |
40 | 45 | ||
41 | $import = new InstapaperImport($this->em, $this->contentProxy, $dispatcher); | 46 | $import = new InstapaperImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); |
42 | 47 | ||
43 | $this->logHandler = new TestHandler(); | 48 | $this->logHandler = new TestHandler(); |
44 | $logger = new Logger('test', [$this->logHandler]); | 49 | $logger = new Logger('test', [$this->logHandler]); |
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php index 141ece36..b81ebe15 100644 --- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php | |||
@@ -23,6 +23,8 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
23 | protected $em; | 23 | protected $em; |
24 | protected $contentProxy; | 24 | protected $contentProxy; |
25 | protected $logHandler; | 25 | protected $logHandler; |
26 | protected $tagsAssigner; | ||
27 | protected $uow; | ||
26 | 28 | ||
27 | private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) | 29 | private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) |
28 | { | 30 | { |
@@ -37,6 +39,10 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
37 | ->disableOriginalConstructor() | 39 | ->disableOriginalConstructor() |
38 | ->getMock(); | 40 | ->getMock(); |
39 | 41 | ||
42 | $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') | ||
43 | ->disableOriginalConstructor() | ||
44 | ->getMock(); | ||
45 | |||
40 | $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') | 46 | $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') |
41 | ->disableOriginalConstructor() | 47 | ->disableOriginalConstructor() |
42 | ->getMock(); | 48 | ->getMock(); |
@@ -63,7 +69,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
63 | ->expects($this->exactly($dispatched)) | 69 | ->expects($this->exactly($dispatched)) |
64 | ->method('dispatch'); | 70 | ->method('dispatch'); |
65 | 71 | ||
66 | $pocket = new PocketImport($this->em, $this->contentProxy, $dispatcher); | 72 | $pocket = new PocketImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); |
67 | $pocket->setUser($this->user); | 73 | $pocket->setUser($this->user); |
68 | 74 | ||
69 | $this->logHandler = new TestHandler(); | 75 | $this->logHandler = new TestHandler(); |
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php index d1bbe648..254f0a25 100644 --- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php | |||
@@ -17,6 +17,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase | |||
17 | protected $em; | 17 | protected $em; |
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | protected $tagsAssigner; | ||
20 | 21 | ||
21 | private function getReadabilityImport($unsetUser = false, $dispatched = 0) | 22 | private function getReadabilityImport($unsetUser = false, $dispatched = 0) |
22 | { | 23 | { |
@@ -30,6 +31,10 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase | |||
30 | ->disableOriginalConstructor() | 31 | ->disableOriginalConstructor() |
31 | ->getMock(); | 32 | ->getMock(); |
32 | 33 | ||
34 | $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') | ||
35 | ->disableOriginalConstructor() | ||
36 | ->getMock(); | ||
37 | |||
33 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | 38 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
34 | ->disableOriginalConstructor() | 39 | ->disableOriginalConstructor() |
35 | ->getMock(); | 40 | ->getMock(); |
@@ -38,7 +43,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase | |||
38 | ->expects($this->exactly($dispatched)) | 43 | ->expects($this->exactly($dispatched)) |
39 | ->method('dispatch'); | 44 | ->method('dispatch'); |
40 | 45 | ||
41 | $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $dispatcher); | 46 | $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); |
42 | 47 | ||
43 | $this->logHandler = new TestHandler(); | 48 | $this->logHandler = new TestHandler(); |
44 | $logger = new Logger('test', [$this->logHandler]); | 49 | $logger = new Logger('test', [$this->logHandler]); |
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php index 4dbced60..9f0c5bac 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php | |||
@@ -17,6 +17,8 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
17 | protected $em; | 17 | protected $em; |
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | protected $tagsAssigner; | ||
21 | protected $uow; | ||
20 | 22 | ||
21 | private function getWallabagV1Import($unsetUser = false, $dispatched = 0) | 23 | private function getWallabagV1Import($unsetUser = false, $dispatched = 0) |
22 | { | 24 | { |
@@ -44,6 +46,10 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
44 | ->disableOriginalConstructor() | 46 | ->disableOriginalConstructor() |
45 | ->getMock(); | 47 | ->getMock(); |
46 | 48 | ||
49 | $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') | ||
50 | ->disableOriginalConstructor() | ||
51 | ->getMock(); | ||
52 | |||
47 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | 53 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
48 | ->disableOriginalConstructor() | 54 | ->disableOriginalConstructor() |
49 | ->getMock(); | 55 | ->getMock(); |
@@ -52,7 +58,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
52 | ->expects($this->exactly($dispatched)) | 58 | ->expects($this->exactly($dispatched)) |
53 | ->method('dispatch'); | 59 | ->method('dispatch'); |
54 | 60 | ||
55 | $wallabag = new WallabagV1Import($this->em, $this->contentProxy, $dispatcher); | 61 | $wallabag = new WallabagV1Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); |
56 | 62 | ||
57 | $this->logHandler = new TestHandler(); | 63 | $this->logHandler = new TestHandler(); |
58 | $logger = new Logger('test', [$this->logHandler]); | 64 | $logger = new Logger('test', [$this->logHandler]); |
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php index 0e50b8b2..efcaeb9e 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php | |||
@@ -17,6 +17,8 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
17 | protected $em; | 17 | protected $em; |
18 | protected $logHandler; | 18 | protected $logHandler; |
19 | protected $contentProxy; | 19 | protected $contentProxy; |
20 | protected $tagsAssigner; | ||
21 | protected $uow; | ||
20 | 22 | ||
21 | private function getWallabagV2Import($unsetUser = false, $dispatched = 0) | 23 | private function getWallabagV2Import($unsetUser = false, $dispatched = 0) |
22 | { | 24 | { |
@@ -44,6 +46,10 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
44 | ->disableOriginalConstructor() | 46 | ->disableOriginalConstructor() |
45 | ->getMock(); | 47 | ->getMock(); |
46 | 48 | ||
49 | $this->tagsAssigner = $this->getMockBuilder('Wallabag\CoreBundle\Helper\TagsAssigner') | ||
50 | ->disableOriginalConstructor() | ||
51 | ->getMock(); | ||
52 | |||
47 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') | 53 | $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') |
48 | ->disableOriginalConstructor() | 54 | ->disableOriginalConstructor() |
49 | ->getMock(); | 55 | ->getMock(); |
@@ -52,7 +58,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
52 | ->expects($this->exactly($dispatched)) | 58 | ->expects($this->exactly($dispatched)) |
53 | ->method('dispatch'); | 59 | ->method('dispatch'); |
54 | 60 | ||
55 | $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $dispatcher); | 61 | $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $this->tagsAssigner, $dispatcher); |
56 | 62 | ||
57 | $this->logHandler = new TestHandler(); | 63 | $this->logHandler = new TestHandler(); |
58 | $logger = new Logger('test', [$this->logHandler]); | 64 | $logger = new Logger('test', [$this->logHandler]); |
diff --git a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php index 44b9a030..b46256a6 100644 --- a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php +++ b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php | |||
@@ -30,8 +30,8 @@ class ManageControllerTest extends WallabagCoreTestCase | |||
30 | $form = $crawler->selectButton('user.form.save')->form(array( | 30 | $form = $crawler->selectButton('user.form.save')->form(array( |
31 | 'new_user[username]' => 'test_user', | 31 | 'new_user[username]' => 'test_user', |
32 | 'new_user[email]' => 'test@test.io', | 32 | 'new_user[email]' => 'test@test.io', |
33 | 'new_user[plainPassword][first]' => 'test', | 33 | 'new_user[plainPassword][first]' => 'testtest', |
34 | 'new_user[plainPassword][second]' => 'test', | 34 | 'new_user[plainPassword][second]' => 'testtest', |
35 | )); | 35 | )); |
36 | 36 | ||
37 | $client->submit($form); | 37 | $client->submit($form); |