From 115de64e5bb9d7f9151ecf15e15a0d988563528e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 4 Oct 2018 14:07:20 +0200 Subject: [PATCH] Jump to Symfony 3.4 Thanks to the BC compatibility, almost nothing have to be changed. All changes are related to new bundle version of: - SensioFrameworkExtraBundle - DoctrineFixturesBundle --- app/AppKernel.php | 2 +- app/config/config.yml | 5 +++ app/config/config_test.yml | 1 + app/config/security.yml | 3 ++ app/config/services.yml | 6 --- app/config/services_test.yml | 38 +++++++++++++++++++ composer.json | 9 ++--- .../Controller/DeveloperController.php | 2 +- .../Controller/ConfigController.php | 2 +- .../CoreBundle/Controller/EntryController.php | 2 +- .../Controller/ExportController.php | 2 +- .../CoreBundle/Controller/RssController.php | 2 +- .../Controller/SiteCredentialController.php | 15 +++----- .../Controller/StaticController.php | 2 +- .../CoreBundle/Controller/TagController.php | 2 +- .../CoreBundle/Resources/config/services.yml | 29 ++++++++++++++ .../Controller/BrowserController.php | 2 +- .../Controller/ChromeController.php | 2 +- .../Controller/FirefoxController.php | 2 +- .../Controller/ImportController.php | 2 +- .../Controller/InstapaperController.php | 2 +- .../Controller/PinboardController.php | 2 +- .../Controller/PocketController.php | 2 +- .../Controller/ReadabilityController.php | 2 +- .../Controller/WallabagV1Controller.php | 2 +- .../Controller/WallabagV2Controller.php | 2 +- .../Resources/config/services.yml | 8 ++++ .../Controller/ManageController.php | 12 ++---- .../WallabagAnnotationTestCase.php | 4 +- .../Controller/DeveloperControllerTest.php | 2 +- .../ApiBundle/WallabagApiTestCase.php | 4 +- .../Command/ReloadEntryCommandTest.php | 6 +-- .../Controller/EntryControllerTest.php | 12 +++--- .../CoreBundle/WallabagCoreTestCase.php | 4 +- 34 files changed, 132 insertions(+), 62 deletions(-) create mode 100644 app/config/services_test.yml diff --git a/app/AppKernel.php b/app/AppKernel.php index 40726f054..546794deb 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -32,6 +32,7 @@ class AppKernel extends Kernel new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(), + new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), // wallabag bundles new Wallabag\CoreBundle\WallabagCoreBundle(), @@ -39,7 +40,6 @@ class AppKernel extends Kernel new Wallabag\UserBundle\WallabagUserBundle(), new Wallabag\ImportBundle\WallabagImportBundle(), new Wallabag\AnnotationBundle\WallabagAnnotationBundle(), - new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { diff --git a/app/config/config.yml b/app/config/config.yml index 0c2b6a1da..951cdf718 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -357,3 +357,8 @@ jms_serializer: # see: https://github.com/schmittjoh/JMSSerializerBundle/pull/494 datetime: default_format: "Y-m-d\\TH:i:sO" # ATOM + +# see https://github.com/symfony/symfony-standard/pull/1133 +sensio_framework_extra: + router: + annotations: false diff --git a/app/config/config_test.yml b/app/config/config_test.yml index fc067ff46..11e0feb77 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -1,6 +1,7 @@ imports: - { resource: config_dev.yml } - { resource: parameters_test.yml } + - { resource: services_test.yml } framework: test: ~ diff --git a/app/config/security.yml b/app/config/security.yml index 02afc9eaa..98f43011f 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -31,12 +31,15 @@ security: fos_oauth: true stateless: true anonymous: true + provider: fos_userbundle login_firewall: + logout_on_user_change: true pattern: ^/login$ anonymous: ~ secured_area: + logout_on_user_change: true pattern: ^/ form_login: provider: fos_userbundle diff --git a/app/config/services.yml b/app/config/services.yml index 7b85d846b..25bbe5dc0 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -2,12 +2,6 @@ parameters: lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber services: - # used for tests - filesystem_cache: - class: Doctrine\Common\Cache\FilesystemCache - arguments: - - "%kernel.cache_dir%/doctrine/metadata" - twig.extension.text: class: Twig_Extensions_Extension_Text tags: diff --git a/app/config/services_test.yml b/app/config/services_test.yml new file mode 100644 index 000000000..a300f75de --- /dev/null +++ b/app/config/services_test.yml @@ -0,0 +1,38 @@ +services: + # see https://github.com/symfony/symfony/issues/24543 + fos_user.user_manager.test: + alias: fos_user.user_manager + public: true + + fos_user.security.login_manager.test: + alias: fos_user.security.login_manager + public: true + + wallabag_core.entry_repository.test: + alias: wallabag_core.entry_repository + public: true + + wallabag_user.user_repository.test: + alias: wallabag_user.user_repository + public: true + + filesystem_cache: + class: Doctrine\Common\Cache\FilesystemCache + arguments: + - "%kernel.cache_dir%/doctrine/metadata" + + # fixtures + Wallabag\AnnotationBundle\DataFixtures\ORM\: + resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/ORM/*' + tags: ['doctrine.fixture.orm'] + autowire: true + + Wallabag\CoreBundle\DataFixtures\ORM\: + resource: '../../src/Wallabag/CoreBundle/DataFixtures/ORM/*' + tags: ['doctrine.fixture.orm'] + autowire: true + + Wallabag\UserBundle\DataFixtures\ORM\: + resource: '../../src/Wallabag/UserBundle/DataFixtures/ORM/*' + tags: ['doctrine.fixture.orm'] + autowire: true diff --git a/composer.json b/composer.json index 9ed91f20d..f209a5c22 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "ext-iconv": "*", "ext-tokenizer": "*", "ext-pdo": "*", - "symfony/symfony": "~3.3.13", + "symfony/symfony": "3.4.*", "doctrine/orm": "^2.5.12", "doctrine/doctrine-bundle": "^1.8.0", "doctrine/doctrine-cache-bundle": "^1.3.2", @@ -51,7 +51,7 @@ "symfony/swiftmailer-bundle": "^2.6.7", "symfony/monolog-bundle": "^3.1.2", "sensio/distribution-bundle": "^5.0.21", - "sensio/framework-extra-bundle": "^3.0.28", + "sensio/framework-extra-bundle": "^5.2.1", "incenteev/composer-parameter-handler": "^2.1.2", "nelmio/cors-bundle": "~1.5", "friendsofsymfony/rest-bundle": "~2.1", @@ -82,14 +82,13 @@ "predis/predis": "^1.1.1", "javibravo/simpleue": "^2.0", "symfony/dom-crawler": "^3.3.13", - "friendsofsymfony/jsrouting-bundle": "^1.6.3", + "friendsofsymfony/jsrouting-bundle": "^2.2.1", "bdunogier/guzzle-site-authenticator": "^1.0.0@dev", "defuse/php-encryption": "^2.1", "html2text/html2text": "^4.1" }, "require-dev": { - "doctrine/doctrine-fixtures-bundle": "~2.2", - "doctrine/data-fixtures": "~1.1", + "doctrine/doctrine-fixtures-bundle": "~3.0", "sensio/generator-bundle": "^3.0", "symfony/phpunit-bridge": "^3.3", "friendsofphp/php-cs-fixer": "~2.0", diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php index c7178017e..ae7e83daf 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php @@ -2,9 +2,9 @@ namespace Wallabag\ApiBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\ApiBundle\Entity\Client; use Wallabag\ApiBundle\Form\Type\ClientType; diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index b999c539f..242f557f0 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -2,12 +2,12 @@ namespace Wallabag\CoreBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\TaggingRule; use Wallabag\CoreBundle\Form\Type\ChangePasswordType; diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 294008339..ac372a333 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -5,9 +5,9 @@ namespace Wallabag\CoreBundle\Controller; use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Event\EntryDeletedEvent; diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 7ca892394..0d2b15c52 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -2,10 +2,10 @@ namespace Wallabag\CoreBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\CoreBundle\Entity\Entry; /** diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index 848bb8140..1c831c039 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php @@ -7,10 +7,10 @@ use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Pagerfanta\Pagerfanta; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\UserBundle\Entity\User; diff --git a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php index 548de7448..51bc1d94a 100644 --- a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php +++ b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php @@ -2,10 +2,9 @@ namespace Wallabag\CoreBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\CoreBundle\Entity\SiteCredential; use Wallabag\UserBundle\Entity\User; @@ -19,8 +18,7 @@ class SiteCredentialController extends Controller /** * Lists all User entities. * - * @Route("/", name="site_credentials_index") - * @Method("GET") + * @Route("/", name="site_credentials_index", methods={"GET"}) */ public function indexAction() { @@ -36,8 +34,7 @@ class SiteCredentialController extends Controller /** * Creates a new site credential entity. * - * @Route("/new", name="site_credentials_new") - * @Method({"GET", "POST"}) + * @Route("/new", name="site_credentials_new", methods={"GET", "POST"}) * * @param Request $request * @@ -77,8 +74,7 @@ class SiteCredentialController extends Controller /** * Displays a form to edit an existing site credential entity. * - * @Route("/{id}/edit", name="site_credentials_edit") - * @Method({"GET", "POST"}) + * @Route("/{id}/edit", name="site_credentials_edit", methods={"GET", "POST"}) * * @param Request $request * @param SiteCredential $siteCredential @@ -121,8 +117,7 @@ class SiteCredentialController extends Controller /** * Deletes a site credential entity. * - * @Route("/{id}", name="site_credentials_delete") - * @Method("DELETE") + * @Route("/{id}", name="site_credentials_delete", methods={"DELETE"}) * * @param Request $request * @param SiteCredential $siteCredential diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php index 318af303c..fa760c144 100644 --- a/src/Wallabag/CoreBundle/Controller/StaticController.php +++ b/src/Wallabag/CoreBundle/Controller/StaticController.php @@ -2,8 +2,8 @@ namespace Wallabag\CoreBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\Routing\Annotation\Route; class StaticController extends Controller { diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index b6d28e59d..15f06ff52 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -5,9 +5,9 @@ namespace Wallabag\CoreBundle\Controller; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Form\Type\NewTagType; diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 85306276d..a27dd2108 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -181,6 +181,7 @@ services: wallabag_core.exception_controller: class: Wallabag\CoreBundle\Controller\ExceptionController + public: true arguments: - '@twig' - '%kernel.debug%' @@ -218,3 +219,31 @@ services: arguments: - "%wallabag_core.site_credentials.encryption_key_path%" - "@logger" + + wallabag_core.command.clean_duplicates: + class: Wallabag\CoreBundle\Command\CleanDuplicatesCommand + tags: ['console.command'] + + wallabag_core.command.export: + class: Wallabag\CoreBundle\Command\ExportCommand + tags: ['console.command'] + + wallabag_core.command.install: + class: Wallabag\CoreBundle\Command\InstallCommand + tags: ['console.command'] + + wallabag_core.command.list_user: + class: Wallabag\CoreBundle\Command\ListUserCommand + tags: ['console.command'] + + wallabag_core.command.reload_entry: + class: Wallabag\CoreBundle\Command\ReloadEntryCommand + tags: ['console.command'] + + wallabag_core.command.show_user: + class: Wallabag\CoreBundle\Command\ShowUserCommand + tags: ['console.command'] + + wallabag_core.command.tag_all: + class: Wallabag\CoreBundle\Command\TagAllCommand + tags: ['console.command'] diff --git a/src/Wallabag/ImportBundle/Controller/BrowserController.php b/src/Wallabag/ImportBundle/Controller/BrowserController.php index 6418925c0..58d2a7303 100644 --- a/src/Wallabag/ImportBundle/Controller/BrowserController.php +++ b/src/Wallabag/ImportBundle/Controller/BrowserController.php @@ -2,10 +2,10 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\ImportBundle\Form\Type\UploadImportType; abstract class BrowserController extends Controller diff --git a/src/Wallabag/ImportBundle/Controller/ChromeController.php b/src/Wallabag/ImportBundle/Controller/ChromeController.php index 0cb418a1a..6628cdb0b 100644 --- a/src/Wallabag/ImportBundle/Controller/ChromeController.php +++ b/src/Wallabag/ImportBundle/Controller/ChromeController.php @@ -2,8 +2,8 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; class ChromeController extends BrowserController { diff --git a/src/Wallabag/ImportBundle/Controller/FirefoxController.php b/src/Wallabag/ImportBundle/Controller/FirefoxController.php index 88697f9dc..dce8455f3 100644 --- a/src/Wallabag/ImportBundle/Controller/FirefoxController.php +++ b/src/Wallabag/ImportBundle/Controller/FirefoxController.php @@ -2,8 +2,8 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; class FirefoxController extends BrowserController { diff --git a/src/Wallabag/ImportBundle/Controller/ImportController.php b/src/Wallabag/ImportBundle/Controller/ImportController.php index 7e4fd1744..fbd7434e5 100644 --- a/src/Wallabag/ImportBundle/Controller/ImportController.php +++ b/src/Wallabag/ImportBundle/Controller/ImportController.php @@ -2,8 +2,8 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\Routing\Annotation\Route; class ImportController extends Controller { diff --git a/src/Wallabag/ImportBundle/Controller/InstapaperController.php b/src/Wallabag/ImportBundle/Controller/InstapaperController.php index f184baf91..faed3b728 100644 --- a/src/Wallabag/ImportBundle/Controller/InstapaperController.php +++ b/src/Wallabag/ImportBundle/Controller/InstapaperController.php @@ -2,9 +2,9 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\ImportBundle\Form\Type\UploadImportType; class InstapaperController extends Controller diff --git a/src/Wallabag/ImportBundle/Controller/PinboardController.php b/src/Wallabag/ImportBundle/Controller/PinboardController.php index 6f54c69a0..cc6fae798 100644 --- a/src/Wallabag/ImportBundle/Controller/PinboardController.php +++ b/src/Wallabag/ImportBundle/Controller/PinboardController.php @@ -2,9 +2,9 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\ImportBundle\Form\Type\UploadImportType; class PinboardController extends Controller diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php index 9f28819aa..71ceb4276 100644 --- a/src/Wallabag/ImportBundle/Controller/PocketController.php +++ b/src/Wallabag/ImportBundle/Controller/PocketController.php @@ -2,10 +2,10 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class PocketController extends Controller diff --git a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php index 729a97a3b..b120ef967 100644 --- a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php +++ b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php @@ -2,9 +2,9 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\ImportBundle\Form\Type\UploadImportType; class ReadabilityController extends Controller diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php index d700d8a88..e1c353438 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php @@ -2,8 +2,8 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; class WallabagV1Controller extends WallabagController { diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php index ab26400cf..c4116c1d0 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php @@ -2,8 +2,8 @@ namespace Wallabag\ImportBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; class WallabagV2Controller extends WallabagController { diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index b224a6a23..2dd7dff8c 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml @@ -112,3 +112,11 @@ services: - [ setLogger, [ "@logger" ]] tags: - { name: wallabag_import.import, alias: chrome } + + wallabag_import.command.import: + class: Wallabag\ImportBundle\Command\ImportCommand + tags: ['console.command'] + + wallabag_import.command.redis_worker: + class: Wallabag\ImportBundle\Command\RedisWorkerCommand + tags: ['console.command'] diff --git a/src/Wallabag/UserBundle/Controller/ManageController.php b/src/Wallabag/UserBundle/Controller/ManageController.php index f3de656f9..a9746fb47 100644 --- a/src/Wallabag/UserBundle/Controller/ManageController.php +++ b/src/Wallabag/UserBundle/Controller/ManageController.php @@ -7,10 +7,9 @@ use FOS\UserBundle\FOSUserEvents; use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Pagerfanta\Pagerfanta; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Form\SearchUserType; @@ -22,8 +21,7 @@ class ManageController extends Controller /** * Creates a new User entity. * - * @Route("/new", name="user_new") - * @Method({"GET", "POST"}) + * @Route("/new", name="user_new", methods={"GET", "POST"}) */ public function newAction(Request $request) { @@ -60,8 +58,7 @@ class ManageController extends Controller /** * Displays a form to edit an existing User entity. * - * @Route("/{id}/edit", name="user_edit") - * @Method({"GET", "POST"}) + * @Route("/{id}/edit", name="user_edit", methods={"GET", "POST"}) */ public function editAction(Request $request, User $user) { @@ -93,8 +90,7 @@ class ManageController extends Controller /** * Deletes a User entity. * - * @Route("/{id}", name="user_delete") - * @Method("DELETE") + * @Route("/{id}", name="user_delete", methods={"DELETE"}) */ public function deleteAction(Request $request, User $user) { diff --git a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php index 105e8add2..9c7aba6bd 100644 --- a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php +++ b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php @@ -43,9 +43,9 @@ abstract class WallabagAnnotationTestCase extends WebTestCase $container = $client->getContainer(); /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ - $userManager = $container->get('fos_user.user_manager'); + $userManager = $container->get('fos_user.user_manager.test'); /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ - $loginManager = $container->get('fos_user.security.login_manager'); + $loginManager = $container->get('fos_user.security.login_manager.test'); $firewallName = $container->getParameter('fos_user.firewall_name'); $this->user = $userManager->findUserBy(['username' => 'admin']); diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index f58d1c120..090155d79 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php @@ -121,7 +121,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase { $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); - $userManager = $client->getContainer()->get('fos_user.user_manager'); + $userManager = $client->getContainer()->get('fos_user.user_manager.test'); $user = $userManager->findUserBy(['username' => $username]); $apiClient = new Client($user); $apiClient->setName('My app'); diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php index 8a188e1c9..0c52aea06 100644 --- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php +++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php @@ -31,9 +31,9 @@ abstract class WallabagApiTestCase extends WebTestCase $container = $client->getContainer(); /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ - $userManager = $container->get('fos_user.user_manager'); + $userManager = $container->get('fos_user.user_manager.test'); /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ - $loginManager = $container->get('fos_user.security.login_manager'); + $loginManager = $container->get('fos_user.security.login_manager.test'); $firewallName = $container->getParameter('fos_user.firewall_name'); $this->user = $userManager->findUserBy(['username' => 'admin']); diff --git a/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php b/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php index b13f6519a..c4bd6dace 100644 --- a/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php @@ -26,7 +26,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase { parent::setUp(); - $userRepository = $this->getClient()->getContainer()->get('wallabag_user.user_repository'); + $userRepository = $this->getClient()->getContainer()->get('wallabag_user.user_repository.test'); $user = $userRepository->findOneByUserName('admin'); $this->adminEntry = new Entry($user); @@ -60,7 +60,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase $reloadedEntries = $this->getClient() ->getContainer() - ->get('wallabag_core.entry_repository') + ->get('wallabag_core.entry_repository.test') ->findById([$this->adminEntry->getId(), $this->bobEntry->getId()]); foreach ($reloadedEntries as $reloadedEntry) { @@ -84,7 +84,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase 'interactive' => false, ]); - $entryRepository = $this->getClient()->getContainer()->get('wallabag_core.entry_repository'); + $entryRepository = $this->getClient()->getContainer()->get('wallabag_core.entry_repository.test'); $reloadedAdminEntry = $entryRepository->find($this->adminEntry->getId()); $this->assertNotEmpty($reloadedAdminEntry->getContent()); diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 0ac119d86..6effe43e8 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -985,8 +985,13 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/share/' . $content->getId()); $this->assertSame(302, $client->getResponse()->getStatusCode()); - // follow link with uid - $crawler = $client->followRedirect(); + $shareUrl = $client->getResponse()->getTargetUrl(); + + // use a new client to have a fresh empty session (instead of a logged one from the previous client) + $client->restart(); + + $client->request('GET', $shareUrl); + $this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); @@ -1002,9 +1007,6 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/share/' . $content->getUid()); $this->assertSame(404, $client->getResponse()->getStatusCode()); - $client->request('GET', '/view/' . $content->getId()); - $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); - // removing the share $client->request('GET', '/share/delete/' . $content->getId()); $this->assertSame(302, $client->getResponse()->getStatusCode()); diff --git a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php index 6e1163c56..816d22f4d 100644 --- a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php +++ b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php @@ -84,8 +84,8 @@ abstract class WallabagCoreTestCase extends WebTestCase $container = $this->client->getContainer(); $session = $container->get('session'); - $userManager = $container->get('fos_user.user_manager'); - $loginManager = $container->get('fos_user.security.login_manager'); + $userManager = $container->get('fos_user.user_manager.test'); + $loginManager = $container->get('fos_user.security.login_manager.test'); $firewallName = $container->getParameter('fos_user.firewall_name'); $user = $userManager->findUserBy(['username' => $username]);