From: Nicolas Lœuillet Date: Sat, 7 Nov 2015 12:39:30 +0000 (+0100) Subject: Merge pull request #1510 from wallabag/v2-sf3 X-Git-Tag: 2.0.0-alpha.1~16 X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=commitdiff_plain;h=4529d0f4b6b20cbbd1ccb5339a753aff7d35552b;hp=3d9ccf9390f35e73428ebf42258253c6808f1590 Merge pull request #1510 from wallabag/v2-sf3 v2 – Fix some deprecated for Symfony3 --- diff --git a/.travis.yml b/.travis.yml index d5355820..df3a5c72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,7 @@ before_script: script: - ant prepare-$DB - - bin/phpunit --exclude-group command-doctrine -v + - SYMFONY_DEPRECATIONS_HELPER=weak bin/phpunit --exclude-group command-doctrine -v # after_script: # - | diff --git a/app/config/routing.yml b/app/config/routing.yml index af3e32b1..0f7b61fb 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,10 +1,10 @@ wallabag_api: resource: "@WallabagApiBundle/Resources/config/routing.yml" - prefix: / + prefix: / app: resource: @WallabagCoreBundle/Controller/ - type: annotation + type: annotation doc-api: resource: "@NelmioApiDocBundle/Resources/config/routing.yml" @@ -16,10 +16,10 @@ rest : prefix : /api homepage: - pattern: "/{page}" - defaults: { _controller: WallabagCoreBundle:Entry:showUnread, page : 1 } + path: "/{page}" + defaults: { _controller: WallabagCoreBundle:Entry:showUnread, page : 1 } requirements: - page: \d+ + page: \d+ fos_user: resource: "@FOSUserBundle/Resources/config/routing/all.xml" diff --git a/composer.json b/composer.json index e16de833..b8c936f0 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,8 @@ "require-dev": { "doctrine/doctrine-fixtures-bundle": "~2.2.0", "sensio/generator-bundle": "~2.5", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "~4.4", + "symfony/phpunit-bridge": "~2.7.0" }, "scripts": { "post-install-cmd": [ diff --git a/composer.lock b/composer.lock index 368f9f95..ee6e483a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "7fb67fafde0e24c1802714a2a47da5e1", - "content-hash": "372936ba75537d8422a8e63bd419c213", + "hash": "01e7829e7ff2b39b288871661bb05e9a", + "content-hash": "76830bc9c2cd6f600613c9eea7c0f1b1", "packages": [ { "name": "doctrine/annotations", @@ -77,16 +77,16 @@ }, { "name": "doctrine/cache", - "version": "v1.5.0", + "version": "v1.5.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f" + "reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/eb8a73619af4f1c8711e2ce482f5de3643258a1f", - "reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f", + "url": "https://api.github.com/repos/doctrine/cache/zipball/2b9cec5a5e722010cbebc91713d4c11eaa064d5e", + "reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e", "shasum": "" }, "require": { @@ -143,7 +143,7 @@ "cache", "caching" ], - "time": "2015-10-28 11:27:45" + "time": "2015-11-02 18:35:48" }, { "name": "doctrine/collections", @@ -357,16 +357,16 @@ }, { "name": "doctrine/doctrine-bundle", - "version": "v1.5.2", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3" + "reference": "a5b3ba908ba68f3e14e42762a7b940fde65ed7da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3", - "reference": "d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/a5b3ba908ba68f3e14e42762a7b940fde65ed7da", + "reference": "a5b3ba908ba68f3e14e42762a7b940fde65ed7da", "shasum": "" }, "require": { @@ -431,42 +431,42 @@ "orm", "persistence" ], - "time": "2015-08-31 14:47:06" + "time": "2015-11-04 21:33:02" }, { "name": "doctrine/doctrine-cache-bundle", - "version": "v1.0.1", - "target-dir": "Doctrine/Bundle/DoctrineCacheBundle", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineCacheBundle.git", - "reference": "e4b6f810aa047f9cbfe41c3d6a3d7e83d7477a9d" + "reference": "3233bc78e222d528ca89a6a47d48d6f37888e95e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/e4b6f810aa047f9cbfe41c3d6a3d7e83d7477a9d", - "reference": "e4b6f810aa047f9cbfe41c3d6a3d7e83d7477a9d", + "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/3233bc78e222d528ca89a6a47d48d6f37888e95e", + "reference": "3233bc78e222d528ca89a6a47d48d6f37888e95e", "shasum": "" }, "require": { - "doctrine/cache": "~1.3", + "doctrine/cache": "^1.4.2", "doctrine/inflector": "~1.0", "php": ">=5.3.2", - "symfony/doctrine-bridge": "~2.2", - "symfony/framework-bundle": "~2.2", - "symfony/security": "~2.2" + "symfony/doctrine-bridge": "~2.2|~3.0", + "symfony/security-acl": "~2.3|~3.0" }, "require-dev": { "instaclick/coding-standard": "~1.1", "instaclick/object-calisthenics-sniffs": "dev-master", "instaclick/symfony2-coding-standard": "dev-remaster", - "phpunit/phpunit": "~3.7", + "phpunit/phpunit": "~4", "satooshi/php-coveralls": "~0.6.1", - "squizlabs/php_codesniffer": "dev-master", - "symfony/console": "~2.2", - "symfony/finder": "~2.2", - "symfony/validator": "~2.2", - "symfony/yaml": "~2.2" + "squizlabs/php_codesniffer": "~1.5", + "symfony/console": "~2.2|~3.0", + "symfony/finder": "~2.2|~3.0", + "symfony/framework-bundle": "~2.2|~3.0", + "symfony/phpunit-bridge": "~2.7|~3.0", + "symfony/validator": "~2.2|~3.0", + "symfony/yaml": "~2.2|~3.0" }, "type": "symfony-bundle", "extra": { @@ -475,8 +475,8 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Bundle\\DoctrineCacheBundle": "" + "psr-4": { + "Doctrine\\Bundle\\DoctrineCacheBundle\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -509,26 +509,26 @@ "email": "fabien@symfony.com" } ], - "description": "Symfony2 Bundle for Doctrine Cache", + "description": "Symfony Bundle for Doctrine Cache", "homepage": "http://www.doctrine-project.org", "keywords": [ "cache", "caching" ], - "time": "2014-11-28 09:43:36" + "time": "2015-11-05 13:48:27" }, { "name": "doctrine/inflector", - "version": "v1.0.1", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", - "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", "shasum": "" }, "require": { @@ -540,7 +540,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -582,7 +582,7 @@ "singularize", "string" ], - "time": "2014-12-20 21:24:13" + "time": "2015-11-06 14:35:42" }, { "name": "doctrine/instantiator", @@ -1027,12 +1027,12 @@ "source": { "type": "git", "url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git", - "reference": "d5b28c367d393f9d9fbc48c4138b2a74d51c0c83" + "reference": "45d6f40178216a840885b4ca6d7de9e67068568a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", - "reference": "d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/45d6f40178216a840885b4ca6d7de9e67068568a", + "reference": "45d6f40178216a840885b4ca6d7de9e67068568a", "shasum": "" }, "require": { @@ -1086,7 +1086,7 @@ "keywords": [ "User management" ], - "time": "2015-09-15 13:15:07" + "time": "2015-11-03 10:24:23" }, { "name": "guzzlehttp/guzzle", @@ -3437,16 +3437,16 @@ }, { "name": "twig/twig", - "version": "v1.23.0", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "5868cd822fd6cf626d5f805439575f9c323cee2a" + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/5868cd822fd6cf626d5f805439575f9c323cee2a", - "reference": "5868cd822fd6cf626d5f805439575f9c323cee2a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6", + "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6", "shasum": "" }, "require": { @@ -3494,7 +3494,7 @@ "keywords": [ "templating" ], - "time": "2015-10-29 23:29:01" + "time": "2015-11-05 12:49:06" }, { "name": "willdurand/hateoas", @@ -4713,6 +4713,58 @@ ], "description": "This bundle generates code for you", "time": "2015-03-17 06:36:52" + }, + { + "name": "symfony/phpunit-bridge", + "version": "v2.7.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/phpunit-bridge.git", + "reference": "896bbd1742a6ecd2f7904167bdb6bf88eb6cfbe4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/896bbd1742a6ecd2f7904167bdb6bf88eb6cfbe4", + "reference": "896bbd1742a6ecd2f7904167bdb6bf88eb6cfbe4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Bridge\\PhpUnit\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony PHPUnit Bridge", + "homepage": "https://symfony.com", + "time": "2015-09-27 10:08:51" } ], "aliases": [], diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6f6269a4..7bec5b5e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,6 +20,11 @@ + + diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 1fee56ad..74bfe4dc 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -40,7 +40,7 @@ class WallabagRestController extends FOSRestController private function validateAuthentication() { - if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) { + if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { throw new AccessDeniedException(); } } @@ -347,7 +347,7 @@ class WallabagRestController extends FOSRestController */ private function validateUserAccess($requestUserId) { - $user = $this->get('security.context')->getToken()->getUser(); + $user = $this->get('security.token_storage')->getToken()->getUser(); if ($requestUserId != $user->getId()) { throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId()); } diff --git a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php index 119889b3..09cde0f6 100644 --- a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php @@ -25,7 +25,6 @@ abstract class AbstractControllerTest extends WebTestCase $client = static::createClient(); $container = $client->getContainer(); - $session = $container->get('session'); /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ $userManager = $container->get('fos_user.user_manager'); /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ @@ -36,9 +35,10 @@ abstract class AbstractControllerTest extends WebTestCase $loginManager->loginUser($firewallName, $user); // save the login token into the session and put it in a cookie - $container->get('session')->set('_security_'.$firewallName, - serialize($container->get('security.context')->getToken())); + $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); $container->get('session')->save(); + + $session = $container->get('session'); $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId())); return $client; diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 6ebbd93c..808baaf6 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -8,6 +8,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\NullOutput; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Helper\Table; use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Entity\Config; @@ -85,10 +88,11 @@ class InstallCommand extends ContainerAwareCommand } $rows[] = array($label, $status, $help); - $this->getHelper('table') + $table = new Table($this->defaultOutput); + $table ->setHeaders(array('Checked', 'Status', 'Recommendation')) ->setRows($rows) - ->render($this->defaultOutput); + ->render(); if (!$fulfilled) { throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.'); @@ -130,9 +134,10 @@ class InstallCommand extends ContainerAwareCommand return $this; } - $dialog = $this->getHelper('dialog'); + $questionHelper = $this->getHelper('question'); + $question = new ConfirmationQuestion('It appears that your database already exists. Would you like to reset it? (y/N)', false); - if ($dialog->askConfirmation($this->defaultOutput, 'It appears that your database already exists. Would you like to reset it? (y/N) ', false)) { + if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) { $this->defaultOutput->writeln('Droping database, creating database and schema'); $this @@ -141,7 +146,8 @@ class InstallCommand extends ContainerAwareCommand ->runCommand('doctrine:schema:create') ; } elseif ($this->isSchemaPresent()) { - if ($dialog->askConfirmation($this->defaultOutput, 'Seems like your database contains schema. Do you want to reset it? (y/N) ', false)) { + $question = new ConfirmationQuestion('Seems like your database contains schema. Do you want to reset it? (y/N)', false); + if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) { $this->defaultOutput->writeln('Droping schema and creating schema'); $this @@ -160,17 +166,6 @@ class InstallCommand extends ContainerAwareCommand $this->defaultOutput->writeln('Clearing the cache'); $this->runCommand('cache:clear'); - /* - if ($this->getHelperSet()->get('dialog')->askConfirmation($this->defaultOutput, 'Load fixtures (Y/N)?', false)) { - $doctrineConfig = $this->getContainer()->get('doctrine.orm.entity_manager')->getConnection()->getConfiguration(); - $logger = $doctrineConfig->getSQLLogger(); - // speed up fixture load - $doctrineConfig->setSQLLogger(null); - $this->runCommand('doctrine:fixtures:load'); - $doctrineConfig->setSQLLogger($logger); - } - */ - $this->defaultOutput->writeln(''); return $this; @@ -180,9 +175,10 @@ class InstallCommand extends ContainerAwareCommand { $this->defaultOutput->writeln('Step 3 of 4. Administration setup.'); - $dialog = $this->getHelperSet()->get('dialog'); + $questionHelper = $this->getHelperSet()->get('question'); + $question = new ConfirmationQuestion('Would you like to create a new user ? (y/N)', false); - if (false === $dialog->askConfirmation($this->defaultOutput, 'Would you like to create a new user ? (y/N)', true)) { + if (!$questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) { return $this; } @@ -190,9 +186,16 @@ class InstallCommand extends ContainerAwareCommand $userManager = $this->getContainer()->get('fos_user.user_manager'); $user = $userManager->createUser(); - $user->setUsername($dialog->ask($this->defaultOutput, 'Username (default: wallabag) :', 'wallabag')); - $user->setPlainPassword($dialog->ask($this->defaultOutput, 'Password (default: wallabag) :', 'wallabag')); - $user->setEmail($dialog->ask($this->defaultOutput, 'Email:', '')); + + $question = new Question('Username (default: wallabag) :', 'wallabag'); + $user->setUsername($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)); + + $question = new Question('Password (default: wallabag) :', 'wallabag'); + $user->setPlainPassword($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)); + + $question = new Question('Email:', ''); + $user->setEmail($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)); + $user->setEnabled(true); $em->persist($user); diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index ca4acc6a..8bbe4ca0 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -29,7 +29,7 @@ class ConfigController extends Controller $user = $this->getUser(); // handle basic config detail (this form is defined as a service) - $configForm = $this->createForm('config', $config); + $configForm = $this->createForm('config', $config, array('action' => $this->generateUrl('config'))); $configForm->handleRequest($request); if ($configForm->isValid()) { @@ -49,7 +49,7 @@ class ConfigController extends Controller } // handle changing password - $pwdForm = $this->createForm(new ChangePasswordType()); + $pwdForm = $this->createForm(new ChangePasswordType(), null, array('action' => $this->generateUrl('config').'#set4')); $pwdForm->handleRequest($request); if ($pwdForm->isValid()) { @@ -65,7 +65,10 @@ class ConfigController extends Controller } // handle changing user information - $userForm = $this->createForm(new UserInformationType(), $user, array('validation_groups' => array('Profile'))); + $userForm = $this->createForm(new UserInformationType(), $user, array( + 'validation_groups' => array('Profile'), + 'action' => $this->generateUrl('config').'#set3', + )); $userForm->handleRequest($request); if ($userForm->isValid()) { @@ -80,7 +83,7 @@ class ConfigController extends Controller } // handle rss information - $rssForm = $this->createForm(new RssType(), $config); + $rssForm = $this->createForm(new RssType(), $config, array('action' => $this->generateUrl('config').'#set2')); $rssForm->handleRequest($request); if ($rssForm->isValid()) { @@ -99,7 +102,10 @@ class ConfigController extends Controller $newUser = $userManager->createUser(); // enable created user by default $newUser->setEnabled(true); - $newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile'))); + $newUserForm = $this->createForm(new NewUserType(), $newUser, array( + 'validation_groups' => array('Profile'), + 'action' => $this->generateUrl('config').'#set5', + )); $newUserForm->handleRequest($request); if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { diff --git a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php index 054a3752..23e98042 100644 --- a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php +++ b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php @@ -3,7 +3,7 @@ namespace Wallabag\CoreBundle\Helper; use Liip\ThemeBundle\Helper\DeviceDetectionInterface; -use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Wallabag\UserBundle\Entity\User; /** @@ -14,16 +14,16 @@ use Wallabag\UserBundle\Entity\User; */ class DetectActiveTheme implements DeviceDetectionInterface { - protected $securityContext; + protected $tokenStorage; protected $defaultTheme; /** - * @param SecurityContextInterface $securityContext Needed to retrieve the current user - * @param string $defaultTheme Default theme when user isn't logged in + * @param TokenStorageInterface $tokenStorage Needed to retrieve the current user + * @param string $defaultTheme Default theme when user isn't logged in */ - public function __construct(SecurityContextInterface $securityContext, $defaultTheme) + public function __construct(TokenStorageInterface $tokenStorage, $defaultTheme) { - $this->securityContext = $securityContext; + $this->tokenStorage = $tokenStorage; $this->defaultTheme = $defaultTheme; } @@ -42,7 +42,7 @@ class DetectActiveTheme implements DeviceDetectionInterface */ public function getType() { - $token = $this->securityContext->getToken(); + $token = $this->tokenStorage->getToken(); if (is_null($token)) { return $this->defaultTheme; diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 3c479ff6..debbf39e 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -2,7 +2,7 @@ services: wallabag_core.helper.detect_active_theme: class: Wallabag\CoreBundle\Helper\DetectActiveTheme arguments: - - @security.context + - @security.token_storage - %theme% # default theme from parameters.yml # custom form type diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index abe5dc9e..7a7d6af1 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig @@ -5,7 +5,7 @@ {% block content %}

{% trans %}Wallabag configuration{% endtrans %}

-
+ {{ form_start(form.config) }} {{ form_errors(form.config) }}
@@ -37,7 +37,7 @@

{% trans %}RSS configuration{% endtrans %}

- + {{ form_start(form.rss) }} {{ form_errors(form.rss) }}
@@ -81,7 +81,7 @@

{% trans %}User information{% endtrans %}

- + {{ form_start(form.user) }} {{ form_errors(form.user) }}
@@ -115,7 +115,7 @@

{% trans %}Change your password{% endtrans %}

- + {{ form_start(form.pwd) }} {{ form_errors(form.pwd) }}
@@ -148,7 +148,7 @@ {% if is_granted('ROLE_SUPER_ADMIN') %}

{% trans %}Add a user{% endtrans %}

- + {{ form_start(form.new_user) }} {{ form_errors(form.new_user) }}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index ab24d4ef..8f121a2b 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig @@ -21,9 +21,8 @@ -
- + {{ form_start(form.config) }} {{ form_errors(form.config) }}
@@ -57,9 +56,8 @@
-
-
+ {{ form_start(form.rss) }} {{ form_errors(form.rss) }}
@@ -111,9 +109,8 @@
-
-
+ {{ form_start(form.user) }} {{ form_errors(form.user) }}
@@ -150,9 +147,8 @@
-
-
+ {{ form_start(form.pwd) }} {{ form_errors(form.pwd) }}
@@ -189,7 +185,7 @@ {% if is_granted('ROLE_SUPER_ADMIN') %}
- + {{ form_start(form.new_user) }} {{ form_errors(form.new_user) }}
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index 24910e60..e98dd202 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php @@ -35,19 +35,16 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the DialogHelper - $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') + // We mock the QuestionHelper + $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') ->disableOriginalConstructor() ->getMock(); - $dialog->expects($this->any()) + $question->expects($this->any()) ->method('ask') - ->will($this->returnValue('test_'.uniqid('', true))); - $dialog->expects($this->any()) - ->method('askConfirmation') - ->will($this->returnValue(true)); + ->will($this->returnValue('yes_'.uniqid('', true))); // We override the standard helper with our mock - $command->getHelperSet()->set($dialog, 'dialog'); + $command->getHelperSet()->set($question, 'question'); $tester = new CommandTester($command); $tester->execute(array( @@ -69,19 +66,16 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the DialogHelper - $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') + // We mock the QuestionHelper + $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') ->disableOriginalConstructor() ->getMock(); - $dialog->expects($this->any()) + $question->expects($this->any()) ->method('ask') - ->will($this->returnValue('test_'.uniqid('', true))); - $dialog->expects($this->any()) - ->method('askConfirmation') - ->will($this->returnValue(true)); + ->will($this->returnValue('yes_'.uniqid('', true))); // We override the standard helper with our mock - $command->getHelperSet()->set($dialog, 'dialog'); + $command->getHelperSet()->set($question, 'question'); $tester = new CommandTester($command); $tester->execute(array( @@ -119,19 +113,16 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the DialogHelper - $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') + // We mock the QuestionHelper + $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') ->disableOriginalConstructor() ->getMock(); - $dialog->expects($this->any()) + $question->expects($this->any()) ->method('ask') - ->will($this->returnValue('test_'.uniqid('', true))); - $dialog->expects($this->any()) - ->method('askConfirmation') - ->will($this->returnValue(true)); + ->will($this->returnValue('yes_'.uniqid('', true))); // We override the standard helper with our mock - $command->getHelperSet()->set($dialog, 'dialog'); + $command->getHelperSet()->set($question, 'question'); $tester = new CommandTester($command); $tester->execute(array( @@ -156,13 +147,13 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the DialogHelper - $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') + // We mock the QuestionHelper + $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') ->disableOriginalConstructor() ->getMock(); - $dialog->expects($this->exactly(3)) - ->method('askConfirmation') + $question->expects($this->exactly(3)) + ->method('ask') ->will($this->onConsecutiveCalls( false, // don't want to reset the entire database true, // do want to reset the schema @@ -170,7 +161,7 @@ class InstallCommandTest extends WallabagCoreTestCase )); // We override the standard helper with our mock - $command->getHelperSet()->set($dialog, 'dialog'); + $command->getHelperSet()->set($question, 'question'); $tester = new CommandTester($command); $tester->execute(array( @@ -216,20 +207,20 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the DialogHelper - $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') + // We mock the QuestionHelper + $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') ->disableOriginalConstructor() ->getMock(); - $dialog->expects($this->exactly(2)) - ->method('askConfirmation') + $question->expects($this->exactly(2)) + ->method('ask') ->will($this->onConsecutiveCalls( false, // don't want to reset the entire database false // don't want to create a new user )); // We override the standard helper with our mock - $command->getHelperSet()->set($dialog, 'dialog'); + $command->getHelperSet()->set($question, 'question'); $tester = new CommandTester($command); $tester->execute(array( @@ -253,19 +244,16 @@ class InstallCommandTest extends WallabagCoreTestCase $command = $application->find('wallabag:install'); - // We mock the DialogHelper - $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') + // We mock the QuestionHelper + $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') ->disableOriginalConstructor() ->getMock(); - $dialog->expects($this->any()) + $question->expects($this->any()) ->method('ask') - ->will($this->returnValue('test_'.uniqid('', true))); - $dialog->expects($this->any()) - ->method('askConfirmation') - ->will($this->returnValue(true)); + ->will($this->returnValue('yes_'.uniqid('', true))); // We override the standard helper with our mock - $command->getHelperSet()->set($dialog, 'dialog'); + $command->getHelperSet()->set($question, 'question'); $tester = new CommandTester($command); $tester->execute(array(