aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php9
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryType.php4
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/NewUserType.php4
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/RssType.php4
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/UserInformationType.php4
-rw-r--r--src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php11
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php6
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
5use Symfony\Component\Form\AbstractType; 5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface; 6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolverInterface; 7use Symfony\Component\OptionsResolver\OptionsResolver;
8 8
9class ConfigType extends AbstractType 9class 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/EntryType.php b/src/Wallabag/CoreBundle/Form/Type/EntryType.php
index 0532bf10..4abdc10b 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntryType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryType.php
@@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
4 4
5use Symfony\Component\Form\AbstractType; 5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface; 6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolverInterface; 7use Symfony\Component\OptionsResolver\OptionsResolver;
8 8
9class EntryType extends AbstractType 9class EntryType extends AbstractType
10{ 10{
@@ -16,7 +16,7 @@ class EntryType 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
5use Symfony\Component\Form\AbstractType; 5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface; 6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolverInterface; 7use Symfony\Component\OptionsResolver\OptionsResolver;
8use Symfony\Component\Validator\Constraints; 8use Symfony\Component\Validator\Constraints;
9 9
10class NewUserType extends AbstractType 10class 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
5use Symfony\Component\Form\AbstractType; 5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface; 6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolverInterface; 7use Symfony\Component\OptionsResolver\OptionsResolver;
8 8
9class RssType extends AbstractType 9class 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
5use Symfony\Component\Form\AbstractType; 5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface; 6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolverInterface; 7use Symfony\Component\OptionsResolver\OptionsResolver;
8 8
9class UserInformationType extends AbstractType 9class 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 @@
3namespace Wallabag\CoreBundle\Security\Validator; 3namespace Wallabag\CoreBundle\Security\Validator;
4 4
5use Symfony\Component\Security\Core\User\UserInterface; 5use Symfony\Component\Security\Core\User\UserInterface;
6use Symfony\Component\Security\Core\SecurityContextInterface; 6use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
7use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; 7use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
8use Symfony\Component\Validator\Constraint; 8use Symfony\Component\Validator\Constraint;
9use Symfony\Component\Validator\ConstraintValidator; 9use Symfony\Component\Validator\ConstraintValidator;
@@ -11,14 +11,17 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
11use Symfony\Component\Validator\Exception\UnexpectedTypeException; 11use Symfony\Component\Validator\Exception\UnexpectedTypeException;
12use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; 12use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
13 13
14/**
15 * @see Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator
16 */
14class WallabagUserPasswordValidator extends ConstraintValidator 17class 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 )),