Fix tests & deprecation notice

This commit is contained in:
Jeremy Benoist 2016-12-14 11:54:30 +01:00
parent 202a66ce02
commit 21e7ccef3d
No known key found for this signature in database
GPG Key ID: BCA73962457ACC3C
11 changed files with 25 additions and 21 deletions

View File

@ -17,10 +17,6 @@ wallabag_api:
type: annotation
prefix: /
wallabag_api:
resource: "@WallabagApiBundle/Resources/config/routing.yml"
prefix: /
app:
resource: "@WallabagCoreBundle/Controller/"
type: annotation

View File

@ -42,7 +42,7 @@ class DeveloperController extends Controller
$clientForm = $this->createForm(ClientType::class, $client);
$clientForm->handleRequest($request);
if ($clientForm->isValid()) {
if ($clientForm->isSubmitted() && $clientForm->isValid()) {
$client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']);
$em->persist($client);
$em->flush();

View File

@ -35,7 +35,7 @@ class ConfigController extends Controller
$configForm = $this->createForm(ConfigType::class, $config, ['action' => $this->generateUrl('config')]);
$configForm->handleRequest($request);
if ($configForm->isValid()) {
if ($configForm->isSubmitted() && $configForm->isValid()) {
$em->persist($config);
$em->flush();
@ -57,7 +57,7 @@ class ConfigController extends Controller
$pwdForm = $this->createForm(ChangePasswordType::class, null, ['action' => $this->generateUrl('config').'#set4']);
$pwdForm->handleRequest($request);
if ($pwdForm->isValid()) {
if ($pwdForm->isSubmitted() && $pwdForm->isValid()) {
if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) {
$message = 'flashes.config.notice.password_not_updated_demo';
} else {
@ -79,7 +79,7 @@ class ConfigController extends Controller
]);
$userForm->handleRequest($request);
if ($userForm->isValid()) {
if ($userForm->isSubmitted() && $userForm->isValid()) {
$userManager->updateUser($user, true);
$this->get('session')->getFlashBag()->add(
@ -94,7 +94,7 @@ class ConfigController extends Controller
$rssForm = $this->createForm(RssType::class, $config, ['action' => $this->generateUrl('config').'#set2']);
$rssForm->handleRequest($request);
if ($rssForm->isValid()) {
if ($rssForm->isSubmitted() && $rssForm->isValid()) {
$em->persist($config);
$em->flush();
@ -125,7 +125,7 @@ class ConfigController extends Controller
$newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $action]);
$newTaggingRule->handleRequest($request);
if ($newTaggingRule->isValid()) {
if ($newTaggingRule->isSubmitted() && $newTaggingRule->isValid()) {
$taggingRule->setConfig($config);
$em->persist($taggingRule);
$em->flush();

View File

@ -23,17 +23,25 @@ class EntryController extends Controller
* @param Request $request
* @param int $page
*
* @Route("/search/{page}", name="search", defaults={"page" = "1"})
* @Route("/search/{page}", name="search", defaults={"page" = 1})
*
* Default parameter for page is hardcoded (in duplication of the defaults from the Route)
* because this controller is also called inside the layout template without any page as argument
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function searchFormAction(Request $request, $page, $currentRoute)
public function searchFormAction(Request $request, $page = 1, $currentRoute = null)
{
// fallback to retrieve currentRoute from query parameter instead of injected one (when using inside a template)
if (null === $currentRoute && $request->query->has('currentRoute')) {
$currentRoute = $request->query->get('currentRoute');
}
$form = $this->createForm(SearchEntryType::class);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
return $this->showEntries('search', $request, $page);
}
@ -90,7 +98,7 @@ class EntryController extends Controller
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$existingEntry = $this->checkIfEntryAlreadyExists($entry);
if (false !== $existingEntry) {
@ -173,7 +181,7 @@ class EntryController extends Controller
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entry);
$em->flush();

View File

@ -27,7 +27,7 @@ class TagController extends Controller
$form = $this->createForm(NewTagType::class, new Tag());
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$this->get('wallabag_core.content_proxy')->assignTagsToEntry(
$entry,
$form->get('label')->getData()

View File

@ -39,7 +39,7 @@ abstract class BrowserController extends Controller
$wallabag = $this->getImportService();
$wallabag->setUser($this->getUser());
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$file = $form->get('file')->getData();
$markAsRead = $form->get('mark_as_read')->getData();
$name = $this->getUser()->getId().'.json';

View File

@ -26,7 +26,7 @@ class InstapaperController extends Controller
$instapaper->setProducer($this->get('wallabag_import.producer.redis.instapaper'));
}
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$file = $form->get('file')->getData();
$markAsRead = $form->get('mark_as_read')->getData();
$name = 'instapaper_'.$this->getUser()->getId().'.csv';

View File

@ -26,7 +26,7 @@ class PinboardController extends Controller
$pinboard->setProducer($this->get('wallabag_import.producer.redis.pinboard'));
}
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$file = $form->get('file')->getData();
$markAsRead = $form->get('mark_as_read')->getData();
$name = 'pinboard_'.$this->getUser()->getId().'.json';

View File

@ -26,7 +26,7 @@ class ReadabilityController extends Controller
$readability->setProducer($this->get('wallabag_import.producer.redis.readability'));
}
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$file = $form->get('file')->getData();
$markAsRead = $form->get('mark_as_read')->getData();
$name = 'readability_'.$this->getUser()->getId().'.json';

View File

@ -40,7 +40,7 @@ abstract class WallabagController extends Controller
$wallabag = $this->getImportService();
$wallabag->setUser($this->getUser());
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$file = $form->get('file')->getData();
$markAsRead = $form->get('mark_as_read')->getData();
$name = $this->getUser()->getId().'.json';