Merge pull request #1510 from wallabag/v2-sf3
v2 – Fix some deprecated for Symfony3
This commit is contained in:
commit
4529d0f4b6
@ -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:
|
||||
# - |
|
||||
|
@ -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"
|
||||
|
@ -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": [
|
||||
|
144
composer.lock
generated
144
composer.lock
generated
@ -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": [],
|
||||
|
@ -20,6 +20,11 @@
|
||||
|
||||
<php>
|
||||
<server name="KERNEL_DIR" value="./app/" />
|
||||
<!--
|
||||
Avoid tests to fail because of deprecated stuff
|
||||
see: http://symfony.com/doc/current/cookbook/upgrade/major_version.html#deprecations-in-phpunit
|
||||
-->
|
||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||
</php>
|
||||
|
||||
<filter>
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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, '<question>It appears that your database already exists. Would you like to reset it? (y/N)</question> ', 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, '<question>Seems like your database contains schema. Do you want to reset it? (y/N)</question> ', 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, '<question>Load fixtures (Y/N)?</question>', 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('<info><comment>Step 3 of 4.</comment> Administration setup.</info>');
|
||||
|
||||
$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, '<question>Would you like to create a new user ? (y/N)</question>', 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, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
||||
$user->setPlainPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
||||
$user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', ''));
|
||||
|
||||
$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);
|
||||
|
@ -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')) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,7 @@
|
||||
{% block content %}
|
||||
<h2>{% trans %}Wallabag configuration{% endtrans %}</h2>
|
||||
|
||||
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}>
|
||||
{{ form_start(form.config) }}
|
||||
{{ form_errors(form.config) }}
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
<h2>{% trans %}RSS configuration{% endtrans %}</h2>
|
||||
|
||||
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.rss) }}>
|
||||
{{ form_start(form.rss) }}
|
||||
{{ form_errors(form.rss) }}
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
<h2>{% trans %}User information{% endtrans %}</h2>
|
||||
|
||||
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.user) }}>
|
||||
{{ form_start(form.user) }}
|
||||
{{ form_errors(form.user) }}
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
@ -115,7 +115,7 @@
|
||||
|
||||
<h2>{% trans %}Change your password{% endtrans %}</h2>
|
||||
|
||||
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.pwd) }}>
|
||||
{{ form_start(form.pwd) }}
|
||||
{{ form_errors(form.pwd) }}
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
@ -148,7 +148,7 @@
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||
<h2>{% trans %}Add a user{% endtrans %}</h2>
|
||||
|
||||
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.new_user) }}>
|
||||
{{ form_start(form.new_user) }}
|
||||
{{ form_errors(form.new_user) }}
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
|
@ -21,9 +21,8 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="set1" class="col s12">
|
||||
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}>
|
||||
{{ form_start(form.config) }}
|
||||
{{ form_errors(form.config) }}
|
||||
|
||||
<div class="row">
|
||||
@ -57,9 +56,8 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="set2" class="col s12">
|
||||
<form action="{{ path('config') }}#set2" method="post" {{ form_enctype(form.rss) }}>
|
||||
{{ form_start(form.rss) }}
|
||||
{{ form_errors(form.rss) }}
|
||||
|
||||
<div class="row">
|
||||
@ -111,9 +109,8 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="set3" class="col s12">
|
||||
<form action="{{ path('config') }}#set3" method="post" {{ form_enctype(form.user) }}>
|
||||
{{ form_start(form.user) }}
|
||||
{{ form_errors(form.user) }}
|
||||
|
||||
<div class="row">
|
||||
@ -150,9 +147,8 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="set4" class="col s12">
|
||||
<form action="{{ path('config') }}#set4" method="post" {{ form_enctype(form.pwd) }}>
|
||||
{{ form_start(form.pwd) }}
|
||||
{{ form_errors(form.pwd) }}
|
||||
|
||||
<div class="row">
|
||||
@ -189,7 +185,7 @@
|
||||
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||
<div id="set5" class="col s12">
|
||||
<form action="{{ path('config') }}#set5" method="post" {{ form_enctype(form.new_user) }}>
|
||||
{{ form_start(form.new_user) }}
|
||||
{{ form_errors(form.new_user) }}
|
||||
|
||||
<div class="row">
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user