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
This commit is contained in:
Jeremy Benoist 2018-10-04 14:07:20 +02:00
parent 2b6380f5ac
commit 115de64e5b
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
34 changed files with 132 additions and 62 deletions

View file

@ -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)) {

View file

@ -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

View file

@ -1,6 +1,7 @@
imports:
- { resource: config_dev.yml }
- { resource: parameters_test.yml }
- { resource: services_test.yml }
framework:
test: ~

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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",

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;
/**

View file

@ -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;

View file

@ -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

View file

@ -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
{

View file

@ -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;

View file

@ -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']

View file

@ -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

View file

@ -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
{

View file

@ -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
{

View file

@ -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
{

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
{

View file

@ -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
{

View file

@ -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']

View file

@ -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)
{

View file

@ -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']);

View file

@ -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');

View file

@ -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']);

View file

@ -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());

View file

@ -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());

View file

@ -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]);