diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-06-08 16:35:02 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-06-08 16:35:02 +0200 |
commit | ac9d58211e1c6676485ef15d023215e5a465f3a8 (patch) | |
tree | 8b73ad50783cf8066ec4171367e2dd1e26026636 /src/Wallabag | |
parent | 82d6d9cb06a1486e2e3b05fa6ce857b3b8655180 (diff) | |
parent | 3cf22a05416b9994aa458ea045d232264006e7cf (diff) | |
download | wallabag-ac9d58211e1c6676485ef15d023215e5a465f3a8.tar.gz wallabag-ac9d58211e1c6676485ef15d023215e5a465f3a8.tar.zst wallabag-ac9d58211e1c6676485ef15d023215e5a465f3a8.zip |
Merge branch 'v2' into v2-edit-title
Diffstat (limited to 'src/Wallabag')
7 files changed, 24 insertions, 18 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index d5890971..49b05b80 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; | |||
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 8 | ||
9 | class ConfigType extends AbstractType | 9 | class ConfigType extends AbstractType |
10 | { | 10 | { |
@@ -24,14 +24,17 @@ class ConfigType extends AbstractType | |||
24 | public function buildForm(FormBuilderInterface $builder, array $options) | 24 | public function buildForm(FormBuilderInterface $builder, array $options) |
25 | { | 25 | { |
26 | $builder | 26 | $builder |
27 | ->add('theme', 'choice', array('choices' => $this->themes)) | 27 | ->add('theme', 'choice', array( |
28 | 'choices' => array_flip($this->themes), | ||
29 | 'choices_as_values' => true, | ||
30 | )) | ||
28 | ->add('items_per_page') | 31 | ->add('items_per_page') |
29 | ->add('language') | 32 | ->add('language') |
30 | ->add('save', 'submit') | 33 | ->add('save', 'submit') |
31 | ; | 34 | ; |
32 | } | 35 | } |
33 | 36 | ||
34 | public function setDefaultOptions(OptionsResolverInterface $resolver) | 37 | public function configureOptions(OptionsResolver $resolver) |
35 | { | 38 | { |
36 | $resolver->setDefaults(array( | 39 | $resolver->setDefaults(array( |
37 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', | 40 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php index a2d203ea..cb96d11a 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewEntryType.php | |||
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; | |||
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 8 | ||
9 | class NewEntryType extends AbstractType | 9 | class NewEntryType extends AbstractType |
10 | { | 10 | { |
@@ -16,7 +16,7 @@ class NewEntryType extends AbstractType | |||
16 | ; | 16 | ; |
17 | } | 17 | } |
18 | 18 | ||
19 | public function setDefaultOptions(OptionsResolverInterface $resolver) | 19 | public function configureOptions(OptionsResolver $resolver) |
20 | { | 20 | { |
21 | $resolver->setDefaults(array( | 21 | $resolver->setDefaults(array( |
22 | 'data_class' => 'Wallabag\CoreBundle\Entity\Entry', | 22 | 'data_class' => 'Wallabag\CoreBundle\Entity\Entry', |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php index a12fff2b..985cb55b 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php | |||
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; | |||
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | use Symfony\Component\Validator\Constraints; | 8 | use Symfony\Component\Validator\Constraints; |
9 | 9 | ||
10 | class NewUserType extends AbstractType | 10 | class NewUserType extends AbstractType |
@@ -27,7 +27,7 @@ class NewUserType extends AbstractType | |||
27 | ; | 27 | ; |
28 | } | 28 | } |
29 | 29 | ||
30 | public function setDefaultOptions(OptionsResolverInterface $resolver) | 30 | public function configureOptions(OptionsResolver $resolver) |
31 | { | 31 | { |
32 | $resolver->setDefaults(array( | 32 | $resolver->setDefaults(array( |
33 | 'data_class' => 'Wallabag\CoreBundle\Entity\User', | 33 | 'data_class' => 'Wallabag\CoreBundle\Entity\User', |
diff --git a/src/Wallabag/CoreBundle/Form/Type/RssType.php b/src/Wallabag/CoreBundle/Form/Type/RssType.php index e14e84e1..1f7f4c68 100644 --- a/src/Wallabag/CoreBundle/Form/Type/RssType.php +++ b/src/Wallabag/CoreBundle/Form/Type/RssType.php | |||
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; | |||
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 8 | ||
9 | class RssType extends AbstractType | 9 | class RssType extends AbstractType |
10 | { | 10 | { |
@@ -16,7 +16,7 @@ class RssType extends AbstractType | |||
16 | ; | 16 | ; |
17 | } | 17 | } |
18 | 18 | ||
19 | public function setDefaultOptions(OptionsResolverInterface $resolver) | 19 | public function configureOptions(OptionsResolver $resolver) |
20 | { | 20 | { |
21 | $resolver->setDefaults(array( | 21 | $resolver->setDefaults(array( |
22 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', | 22 | 'data_class' => 'Wallabag\CoreBundle\Entity\Config', |
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php index f0367d14..1b628051 100644 --- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php +++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php | |||
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; | |||
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | 8 | ||
9 | class UserInformationType extends AbstractType | 9 | class UserInformationType extends AbstractType |
10 | { | 10 | { |
@@ -17,7 +17,7 @@ class UserInformationType extends AbstractType | |||
17 | ; | 17 | ; |
18 | } | 18 | } |
19 | 19 | ||
20 | public function setDefaultOptions(OptionsResolverInterface $resolver) | 20 | public function configureOptions(OptionsResolver $resolver) |
21 | { | 21 | { |
22 | $resolver->setDefaults(array( | 22 | $resolver->setDefaults(array( |
23 | 'data_class' => 'Wallabag\CoreBundle\Entity\User', | 23 | 'data_class' => 'Wallabag\CoreBundle\Entity\User', |
diff --git a/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php b/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php index 5586f976..52062773 100644 --- a/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php +++ b/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php | |||
@@ -3,7 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Security\Validator; | 3 | namespace Wallabag\CoreBundle\Security\Validator; |
4 | 4 | ||
5 | use Symfony\Component\Security\Core\User\UserInterface; | 5 | use Symfony\Component\Security\Core\User\UserInterface; |
6 | use Symfony\Component\Security\Core\SecurityContextInterface; | 6 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
7 | use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; | 7 | use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; |
8 | use Symfony\Component\Validator\Constraint; | 8 | use Symfony\Component\Validator\Constraint; |
9 | use Symfony\Component\Validator\ConstraintValidator; | 9 | use Symfony\Component\Validator\ConstraintValidator; |
@@ -11,14 +11,17 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException; | |||
11 | use Symfony\Component\Validator\Exception\UnexpectedTypeException; | 11 | use Symfony\Component\Validator\Exception\UnexpectedTypeException; |
12 | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | 12 | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; |
13 | 13 | ||
14 | /** | ||
15 | * @see Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator | ||
16 | */ | ||
14 | class WallabagUserPasswordValidator extends ConstraintValidator | 17 | class WallabagUserPasswordValidator extends ConstraintValidator |
15 | { | 18 | { |
16 | private $securityContext; | 19 | private $securityContext; |
17 | private $encoderFactory; | 20 | private $encoderFactory; |
18 | 21 | ||
19 | public function __construct(SecurityContextInterface $securityContext, EncoderFactoryInterface $encoderFactory) | 22 | public function __construct(TokenStorageInterface $tokenStorage, EncoderFactoryInterface $encoderFactory) |
20 | { | 23 | { |
21 | $this->securityContext = $securityContext; | 24 | $this->tokenStorage = $tokenStorage; |
22 | $this->encoderFactory = $encoderFactory; | 25 | $this->encoderFactory = $encoderFactory; |
23 | } | 26 | } |
24 | 27 | ||
@@ -31,7 +34,7 @@ class WallabagUserPasswordValidator extends ConstraintValidator | |||
31 | throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword'); | 34 | throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword'); |
32 | } | 35 | } |
33 | 36 | ||
34 | $user = $this->securityContext->getToken()->getUser(); | 37 | $user = $this->tokenStorage->getToken()->getUser(); |
35 | 38 | ||
36 | if (!$user instanceof UserInterface) { | 39 | if (!$user instanceof UserInterface) { |
37 | throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.'); | 40 | throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.'); |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index a0145780..f72cba65 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -44,7 +44,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
44 | $form = $crawler->filter('button[id=config_save]')->form(); | 44 | $form = $crawler->filter('button[id=config_save]')->form(); |
45 | 45 | ||
46 | $data = array( | 46 | $data = array( |
47 | 'config[theme]' => 'baggy', | 47 | 'config[theme]' => 0, |
48 | 'config[items_per_page]' => '30', | 48 | 'config[items_per_page]' => '30', |
49 | 'config[language]' => 'fr_FR', | 49 | 'config[language]' => 'fr_FR', |
50 | ); | 50 | ); |
@@ -63,12 +63,12 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
63 | { | 63 | { |
64 | return array( | 64 | return array( |
65 | array(array( | 65 | array(array( |
66 | 'config[theme]' => 'baggy', | 66 | 'config[theme]' => 0, |
67 | 'config[items_per_page]' => '', | 67 | 'config[items_per_page]' => '', |
68 | 'config[language]' => 'fr_FR', | 68 | 'config[language]' => 'fr_FR', |
69 | )), | 69 | )), |
70 | array(array( | 70 | array(array( |
71 | 'config[theme]' => 'baggy', | 71 | 'config[theme]' => 0, |
72 | 'config[items_per_page]' => '12', | 72 | 'config[items_per_page]' => '12', |
73 | 'config[language]' => '', | 73 | 'config[language]' => '', |
74 | )), | 74 | )), |