From d68e045d86278c775511cb9bbefd43a7c6e61eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 30 Nov 2016 11:08:38 +0100 Subject: Upgrade to Symfony 3.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a5ef9529..d6211328 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "ext-iconv": "*", "ext-tokenizer": "*", "ext-pdo": "*", - "symfony/symfony": "3.1.*", + "symfony/symfony": "3.2.*", "doctrine/orm": "^2.5", "doctrine/doctrine-bundle": "^1.6", "doctrine/doctrine-cache-bundle": "^1.2", -- cgit v1.2.3 From 202a66ce02bf42743e66fbc1ea1dbfe5b6a1c83a Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 13 Dec 2016 09:33:05 +0100 Subject: Use simple-phpunit instead of phpunit To avoid problem with the Yaml constant http://symfony.com/blog/how-to-solve-phpunit-issues-in-symfony-3-2-applications --- .travis.yml | 3 +-- composer.json | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bffa0704..8c8093bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,6 @@ before_script: - if [[ ! $PHP = hhvm* ]]; then echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; # xdebug isn't enable for PHP 7.1 - if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi - - if [[ $PHP = 5.5 ]]; then composer require "phpunit/phpunit:4.*" --no-update; fi; - composer self-update --no-progress - if [[ $DB = pgsql ]]; then psql -c 'create database wallabag_test;' -U postgres; fi; @@ -72,7 +71,7 @@ before_install: script: - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist - ant prepare-$DB - - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then phpunit -v ; fi; + - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi; - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi; - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi; - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi; diff --git a/composer.json b/composer.json index d6211328..fb6bed5b 100644 --- a/composer.json +++ b/composer.json @@ -90,7 +90,6 @@ "doctrine/doctrine-fixtures-bundle": "~2.2", "doctrine/data-fixtures": "~1.1.1", "sensio/generator-bundle": "^3.0", - "phpunit/phpunit": "~4.0", "symfony/phpunit-bridge": "^3.0", "friendsofphp/php-cs-fixer": "~1.9", "m6web/redis-mock": "^2.0" -- cgit v1.2.3 From 21e7ccef3d960f4747d58fc0c9e081618e9451eb Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 14 Dec 2016 11:54:30 +0100 Subject: Fix tests & deprecation notice --- app/config/routing.yml | 4 ---- .../ApiBundle/Controller/DeveloperController.php | 2 +- src/Wallabag/ApiBundle/Resources/config/routing.yml | 0 .../CoreBundle/Controller/ConfigController.php | 10 +++++----- src/Wallabag/CoreBundle/Controller/EntryController.php | 18 +++++++++++++----- src/Wallabag/CoreBundle/Controller/TagController.php | 2 +- .../ImportBundle/Controller/BrowserController.php | 2 +- .../ImportBundle/Controller/InstapaperController.php | 2 +- .../ImportBundle/Controller/PinboardController.php | 2 +- .../ImportBundle/Controller/ReadabilityController.php | 2 +- .../ImportBundle/Controller/WallabagController.php | 2 +- 11 files changed, 25 insertions(+), 21 deletions(-) delete mode 100644 src/Wallabag/ApiBundle/Resources/config/routing.yml diff --git a/app/config/routing.yml b/app/config/routing.yml index eedf51d5..0bd2d130 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -17,10 +17,6 @@ wallabag_api: type: annotation prefix: / -wallabag_api: - resource: "@WallabagApiBundle/Resources/config/routing.yml" - prefix: / - app: resource: "@WallabagCoreBundle/Controller/" type: annotation 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 $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(); 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 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 $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(); 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 * @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(); 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 $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() 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 $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'; 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 $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'; 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 $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'; 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 $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'; 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 $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'; -- cgit v1.2.3 From 6ad8aabb83581fdc978d0cea81be8e776a3b7198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 15 Dec 2016 21:31:13 +0100 Subject: Fixed search bug --- src/Wallabag/CoreBundle/Controller/EntryController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 9ed1cb12..ff6f564e 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -278,7 +278,7 @@ class EntryController extends Controller { $repository = $this->get('wallabag_core.entry_repository'); $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); - $currentRoute = (!is_null($request->get('currentRoute')) ? $request->get('currentRoute') : ''); + $currentRoute = (!is_null($request->query->get('currentRoute')) ? $request->query->get('currentRoute') : ''); switch ($type) { case 'search': -- cgit v1.2.3