aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-12-14 11:54:30 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-12-15 21:38:16 +0100
commit21e7ccef3d960f4747d58fc0c9e081618e9451eb (patch)
tree295c0af56ecaaf9202618d14b67244da373e5f99 /src/Wallabag
parent202a66ce02bf42743e66fbc1ea1dbfe5b6a1c83a (diff)
downloadwallabag-21e7ccef3d960f4747d58fc0c9e081618e9451eb.tar.gz
wallabag-21e7ccef3d960f4747d58fc0c9e081618e9451eb.tar.zst
wallabag-21e7ccef3d960f4747d58fc0c9e081618e9451eb.zip
Fix tests & deprecation notice
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/ApiBundle/Controller/DeveloperController.php2
-rw-r--r--src/Wallabag/ApiBundle/Resources/config/routing.yml0
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php10
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php18
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/BrowserController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/InstapaperController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/PinboardController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/ReadabilityController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagController.php2
10 files changed, 25 insertions, 17 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php
index 550c0608..9cb1b626 100644
--- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php
+++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php
@@ -42,7 +42,7 @@ class DeveloperController extends Controller
42 $clientForm = $this->createForm(ClientType::class, $client); 42 $clientForm = $this->createForm(ClientType::class, $client);
43 $clientForm->handleRequest($request); 43 $clientForm->handleRequest($request);
44 44
45 if ($clientForm->isValid()) { 45 if ($clientForm->isSubmitted() && $clientForm->isValid()) {
46 $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']); 46 $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']);
47 $em->persist($client); 47 $em->persist($client);
48 $em->flush(); 48 $em->flush();
diff --git a/src/Wallabag/ApiBundle/Resources/config/routing.yml b/src/Wallabag/ApiBundle/Resources/config/routing.yml
deleted file mode 100644
index e69de29b..00000000
--- a/src/Wallabag/ApiBundle/Resources/config/routing.yml
+++ /dev/null
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 68f30f6e..907bf78e 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -35,7 +35,7 @@ class ConfigController extends Controller
35 $configForm = $this->createForm(ConfigType::class, $config, ['action' => $this->generateUrl('config')]); 35 $configForm = $this->createForm(ConfigType::class, $config, ['action' => $this->generateUrl('config')]);
36 $configForm->handleRequest($request); 36 $configForm->handleRequest($request);
37 37
38 if ($configForm->isValid()) { 38 if ($configForm->isSubmitted() && $configForm->isValid()) {
39 $em->persist($config); 39 $em->persist($config);
40 $em->flush(); 40 $em->flush();
41 41
@@ -57,7 +57,7 @@ class ConfigController extends Controller
57 $pwdForm = $this->createForm(ChangePasswordType::class, null, ['action' => $this->generateUrl('config').'#set4']); 57 $pwdForm = $this->createForm(ChangePasswordType::class, null, ['action' => $this->generateUrl('config').'#set4']);
58 $pwdForm->handleRequest($request); 58 $pwdForm->handleRequest($request);
59 59
60 if ($pwdForm->isValid()) { 60 if ($pwdForm->isSubmitted() && $pwdForm->isValid()) {
61 if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) { 61 if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) {
62 $message = 'flashes.config.notice.password_not_updated_demo'; 62 $message = 'flashes.config.notice.password_not_updated_demo';
63 } else { 63 } else {
@@ -79,7 +79,7 @@ class ConfigController extends Controller
79 ]); 79 ]);
80 $userForm->handleRequest($request); 80 $userForm->handleRequest($request);
81 81
82 if ($userForm->isValid()) { 82 if ($userForm->isSubmitted() && $userForm->isValid()) {
83 $userManager->updateUser($user, true); 83 $userManager->updateUser($user, true);
84 84
85 $this->get('session')->getFlashBag()->add( 85 $this->get('session')->getFlashBag()->add(
@@ -94,7 +94,7 @@ class ConfigController extends Controller
94 $rssForm = $this->createForm(RssType::class, $config, ['action' => $this->generateUrl('config').'#set2']); 94 $rssForm = $this->createForm(RssType::class, $config, ['action' => $this->generateUrl('config').'#set2']);
95 $rssForm->handleRequest($request); 95 $rssForm->handleRequest($request);
96 96
97 if ($rssForm->isValid()) { 97 if ($rssForm->isSubmitted() && $rssForm->isValid()) {
98 $em->persist($config); 98 $em->persist($config);
99 $em->flush(); 99 $em->flush();
100 100
@@ -125,7 +125,7 @@ class ConfigController extends Controller
125 $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $action]); 125 $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $action]);
126 $newTaggingRule->handleRequest($request); 126 $newTaggingRule->handleRequest($request);
127 127
128 if ($newTaggingRule->isValid()) { 128 if ($newTaggingRule->isSubmitted() && $newTaggingRule->isValid()) {
129 $taggingRule->setConfig($config); 129 $taggingRule->setConfig($config);
130 $em->persist($taggingRule); 130 $em->persist($taggingRule);
131 $em->flush(); 131 $em->flush();
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 8c13255e..9ed1cb12 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -23,17 +23,25 @@ class EntryController extends Controller
23 * @param Request $request 23 * @param Request $request
24 * @param int $page 24 * @param int $page
25 * 25 *
26 * @Route("/search/{page}", name="search", defaults={"page" = "1"}) 26 * @Route("/search/{page}", name="search", defaults={"page" = 1})
27 *
28 * Default parameter for page is hardcoded (in duplication of the defaults from the Route)
29 * because this controller is also called inside the layout template without any page as argument
27 * 30 *
28 * @return \Symfony\Component\HttpFoundation\Response 31 * @return \Symfony\Component\HttpFoundation\Response
29 */ 32 */
30 public function searchFormAction(Request $request, $page, $currentRoute) 33 public function searchFormAction(Request $request, $page = 1, $currentRoute = null)
31 { 34 {
35 // fallback to retrieve currentRoute from query parameter instead of injected one (when using inside a template)
36 if (null === $currentRoute && $request->query->has('currentRoute')) {
37 $currentRoute = $request->query->get('currentRoute');
38 }
39
32 $form = $this->createForm(SearchEntryType::class); 40 $form = $this->createForm(SearchEntryType::class);
33 41
34 $form->handleRequest($request); 42 $form->handleRequest($request);
35 43
36 if ($form->isValid()) { 44 if ($form->isSubmitted() && $form->isValid()) {
37 return $this->showEntries('search', $request, $page); 45 return $this->showEntries('search', $request, $page);
38 } 46 }
39 47
@@ -90,7 +98,7 @@ class EntryController extends Controller
90 98
91 $form->handleRequest($request); 99 $form->handleRequest($request);
92 100
93 if ($form->isValid()) { 101 if ($form->isSubmitted() && $form->isValid()) {
94 $existingEntry = $this->checkIfEntryAlreadyExists($entry); 102 $existingEntry = $this->checkIfEntryAlreadyExists($entry);
95 103
96 if (false !== $existingEntry) { 104 if (false !== $existingEntry) {
@@ -173,7 +181,7 @@ class EntryController extends Controller
173 181
174 $form->handleRequest($request); 182 $form->handleRequest($request);
175 183
176 if ($form->isValid()) { 184 if ($form->isSubmitted() && $form->isValid()) {
177 $em = $this->getDoctrine()->getManager(); 185 $em = $this->getDoctrine()->getManager();
178 $em->persist($entry); 186 $em->persist($entry);
179 $em->flush(); 187 $em->flush();
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index a3e70fd0..52707cb8 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -27,7 +27,7 @@ class TagController extends Controller
27 $form = $this->createForm(NewTagType::class, new Tag()); 27 $form = $this->createForm(NewTagType::class, new Tag());
28 $form->handleRequest($request); 28 $form->handleRequest($request);
29 29
30 if ($form->isValid()) { 30 if ($form->isSubmitted() && $form->isValid()) {
31 $this->get('wallabag_core.content_proxy')->assignTagsToEntry( 31 $this->get('wallabag_core.content_proxy')->assignTagsToEntry(
32 $entry, 32 $entry,
33 $form->get('label')->getData() 33 $form->get('label')->getData()
diff --git a/src/Wallabag/ImportBundle/Controller/BrowserController.php b/src/Wallabag/ImportBundle/Controller/BrowserController.php
index 144a4880..e119098f 100644
--- a/src/Wallabag/ImportBundle/Controller/BrowserController.php
+++ b/src/Wallabag/ImportBundle/Controller/BrowserController.php
@@ -39,7 +39,7 @@ abstract class BrowserController extends Controller
39 $wallabag = $this->getImportService(); 39 $wallabag = $this->getImportService();
40 $wallabag->setUser($this->getUser()); 40 $wallabag->setUser($this->getUser());
41 41
42 if ($form->isValid()) { 42 if ($form->isSubmitted() && $form->isValid()) {
43 $file = $form->get('file')->getData(); 43 $file = $form->get('file')->getData();
44 $markAsRead = $form->get('mark_as_read')->getData(); 44 $markAsRead = $form->get('mark_as_read')->getData();
45 $name = $this->getUser()->getId().'.json'; 45 $name = $this->getUser()->getId().'.json';
diff --git a/src/Wallabag/ImportBundle/Controller/InstapaperController.php b/src/Wallabag/ImportBundle/Controller/InstapaperController.php
index c3fc8a39..0251acb9 100644
--- a/src/Wallabag/ImportBundle/Controller/InstapaperController.php
+++ b/src/Wallabag/ImportBundle/Controller/InstapaperController.php
@@ -26,7 +26,7 @@ class InstapaperController extends Controller
26 $instapaper->setProducer($this->get('wallabag_import.producer.redis.instapaper')); 26 $instapaper->setProducer($this->get('wallabag_import.producer.redis.instapaper'));
27 } 27 }
28 28
29 if ($form->isValid()) { 29 if ($form->isSubmitted() && $form->isValid()) {
30 $file = $form->get('file')->getData(); 30 $file = $form->get('file')->getData();
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'instapaper_'.$this->getUser()->getId().'.csv'; 32 $name = 'instapaper_'.$this->getUser()->getId().'.csv';
diff --git a/src/Wallabag/ImportBundle/Controller/PinboardController.php b/src/Wallabag/ImportBundle/Controller/PinboardController.php
index 9c3f98d6..d0ad8aa8 100644
--- a/src/Wallabag/ImportBundle/Controller/PinboardController.php
+++ b/src/Wallabag/ImportBundle/Controller/PinboardController.php
@@ -26,7 +26,7 @@ class PinboardController extends Controller
26 $pinboard->setProducer($this->get('wallabag_import.producer.redis.pinboard')); 26 $pinboard->setProducer($this->get('wallabag_import.producer.redis.pinboard'));
27 } 27 }
28 28
29 if ($form->isValid()) { 29 if ($form->isSubmitted() && $form->isValid()) {
30 $file = $form->get('file')->getData(); 30 $file = $form->get('file')->getData();
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'pinboard_'.$this->getUser()->getId().'.json'; 32 $name = 'pinboard_'.$this->getUser()->getId().'.json';
diff --git a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
index d00e22c2..aa732ddd 100644
--- a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
+++ b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
@@ -26,7 +26,7 @@ class ReadabilityController extends Controller
26 $readability->setProducer($this->get('wallabag_import.producer.redis.readability')); 26 $readability->setProducer($this->get('wallabag_import.producer.redis.readability'));
27 } 27 }
28 28
29 if ($form->isValid()) { 29 if ($form->isSubmitted() && $form->isValid()) {
30 $file = $form->get('file')->getData(); 30 $file = $form->get('file')->getData();
31 $markAsRead = $form->get('mark_as_read')->getData(); 31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'readability_'.$this->getUser()->getId().'.json'; 32 $name = 'readability_'.$this->getUser()->getId().'.json';
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagController.php b/src/Wallabag/ImportBundle/Controller/WallabagController.php
index 9c0cde80..e81c1ca9 100644
--- a/src/Wallabag/ImportBundle/Controller/WallabagController.php
+++ b/src/Wallabag/ImportBundle/Controller/WallabagController.php
@@ -40,7 +40,7 @@ abstract class WallabagController extends Controller
40 $wallabag = $this->getImportService(); 40 $wallabag = $this->getImportService();
41 $wallabag->setUser($this->getUser()); 41 $wallabag->setUser($this->getUser());
42 42
43 if ($form->isValid()) { 43 if ($form->isSubmitted() && $form->isValid()) {
44 $file = $form->get('file')->getData(); 44 $file = $form->get('file')->getData();
45 $markAsRead = $form->get('mark_as_read')->getData(); 45 $markAsRead = $form->get('mark_as_read')->getData();
46 $name = $this->getUser()->getId().'.json'; 46 $name = $this->getUser()->getId().'.json';