aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php6
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php4
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php2
-rw-r--r--src/Wallabag/CoreBundle/Entity/User.php250
-rw-r--r--src/Wallabag/CoreBundle/Filter/EntryFilterType.php15
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/UserInformationType.php7
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig7
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php8
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php26
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php17
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php2
13 files changed, 77 insertions, 269 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 491c67f9..1bd76ae3 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -192,6 +192,7 @@ class InstallCommand extends ContainerAwareCommand
192 $user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 192 $user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
193 $user->setPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 193 $user->setPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
194 $user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', '')); 194 $user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', ''));
195 $user->setEnabled(true);
195 196
196 $em->persist($user); 197 $em->persist($user);
197 198
@@ -272,10 +273,11 @@ class InstallCommand extends ContainerAwareCommand
272 */ 273 */
273 private function isDatabasePresent() 274 private function isDatabasePresent()
274 { 275 {
275 $databaseName = $this->getContainer()->getParameter('database_name'); 276 $connection = $this->getContainer()->get('doctrine')->getManager()->getConnection();
277 $databaseName = $connection->getDatabase();
276 278
277 try { 279 try {
278 $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager(); 280 $schemaManager = $connection->getSchemaManager();
279 } catch (\Exception $exception) { 281 } catch (\Exception $exception) {
280 if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) { 282 if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
281 return false; 283 return false;
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 62ef3eea..73484d86 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -65,7 +65,7 @@ class ConfigController extends Controller
65 } 65 }
66 66
67 // handle changing user information 67 // handle changing user information
68 $userForm = $this->createForm(new UserInformationType(), $user); 68 $userForm = $this->createForm(new UserInformationType(), $user, array('validation_groups' => array('Profile')));
69 $userForm->handleRequest($request); 69 $userForm->handleRequest($request);
70 70
71 if ($userForm->isValid()) { 71 if ($userForm->isValid()) {
@@ -98,7 +98,7 @@ class ConfigController extends Controller
98 98
99 // handle adding new user 99 // handle adding new user
100 $newUser = new User(); 100 $newUser = new User();
101 $newUserForm = $this->createForm(new NewUserType(), $newUser); 101 $newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile')));
102 $newUserForm->handleRequest($request); 102 $newUserForm->handleRequest($request);
103 103
104 if ($newUserForm->isValid()) { 104 if ($newUserForm->isValid()) {
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php
index 1c7f9dfa..4ef53329 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php
@@ -19,6 +19,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
19 $userAdmin->setEmail('bigboss@wallabag.org'); 19 $userAdmin->setEmail('bigboss@wallabag.org');
20 $userAdmin->setUsername('admin'); 20 $userAdmin->setUsername('admin');
21 $userAdmin->setPassword('mypassword'); 21 $userAdmin->setPassword('mypassword');
22 $userAdmin->setEnabled(true);
22 23
23 $manager->persist($userAdmin); 24 $manager->persist($userAdmin);
24 25
@@ -29,6 +30,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
29 $bobUser->setEmail('bobby@wallabag.org'); 30 $bobUser->setEmail('bobby@wallabag.org');
30 $bobUser->setUsername('bob'); 31 $bobUser->setUsername('bob');
31 $bobUser->setPassword('mypassword'); 32 $bobUser->setPassword('mypassword');
33 $bobUser->setEnabled(true);
32 34
33 $manager->persist($bobUser); 35 $manager->persist($bobUser);
34 36
diff --git a/src/Wallabag/CoreBundle/Entity/User.php b/src/Wallabag/CoreBundle/Entity/User.php
index 510a1594..eeae331e 100644
--- a/src/Wallabag/CoreBundle/Entity/User.php
+++ b/src/Wallabag/CoreBundle/Entity/User.php
@@ -10,6 +10,7 @@ use Symfony\Component\Security\Core\User\AdvancedUserInterface;
10use Symfony\Component\Validator\Constraints as Assert; 10use Symfony\Component\Validator\Constraints as Assert;
11use JMS\Serializer\Annotation\ExclusionPolicy; 11use JMS\Serializer\Annotation\ExclusionPolicy;
12use JMS\Serializer\Annotation\Expose; 12use JMS\Serializer\Annotation\Expose;
13use FOS\UserBundle\Model\User as BaseUser;
13 14
14/** 15/**
15 * User. 16 * User.
@@ -22,7 +23,7 @@ use JMS\Serializer\Annotation\Expose;
22 * @UniqueEntity("email") 23 * @UniqueEntity("email")
23 * @UniqueEntity("username") 24 * @UniqueEntity("username")
24 */ 25 */
25class User implements AdvancedUserInterface, \Serializable 26class User extends BaseUser implements AdvancedUserInterface, \Serializable
26{ 27{
27 /** 28 /**
28 * @var int 29 * @var int
@@ -32,100 +33,49 @@ class User implements AdvancedUserInterface, \Serializable
32 * @ORM\Id 33 * @ORM\Id
33 * @ORM\GeneratedValue(strategy="AUTO") 34 * @ORM\GeneratedValue(strategy="AUTO")
34 */ 35 */
35 private $id; 36 protected $id;
36
37 /**
38 * @var string
39 *
40 * @ORM\Column(name="username", type="text")
41 * @Assert\NotBlank()
42 * @Assert\Length(
43 * min = "3",
44 * max = "255"
45 * )
46 */
47 private $username;
48
49 /**
50 * @var string
51 *
52 * @ORM\Column(type="string", length=32)
53 */
54 private $salt;
55
56 /**
57 * @var string
58 *
59 * @ORM\Column(name="password", type="text")
60 */
61 private $password;
62 37
63 /** 38 /**
64 * @var string 39 * @var string
65 * 40 *
66 * @ORM\Column(name="name", type="text", nullable=true) 41 * @ORM\Column(name="name", type="text", nullable=true)
67 */ 42 */
68 private $name; 43 protected $name;
69
70 /**
71 * @var string
72 *
73 * @ORM\Column(name="email", type="text", nullable=false)
74 * @Assert\Email()
75 * @Assert\NotBlank()
76 */
77 private $email;
78
79 /**
80 * @ORM\Column(name="is_active", type="boolean", nullable=false)
81 */
82 private $isActive = true;
83
84 /**
85 * @ORM\Column(name="confirmation_token", type="string", nullable=true)
86 */
87 private $confirmationToken;
88
89 /**
90 * @ORM\Column(name="password_requested_at", type="datetime", nullable=true)
91 */
92 private $passwordRequestedAt;
93 44
94 /** 45 /**
95 * @var date 46 * @var date
96 * 47 *
97 * @ORM\Column(name="created_at", type="datetime") 48 * @ORM\Column(name="created_at", type="datetime")
98 */ 49 */
99 private $createdAt; 50 protected $createdAt;
100 51
101 /** 52 /**
102 * @var date 53 * @var date
103 * 54 *
104 * @ORM\Column(name="updated_at", type="datetime") 55 * @ORM\Column(name="updated_at", type="datetime")
105 */ 56 */
106 private $updatedAt; 57 protected $updatedAt;
107 58
108 /** 59 /**
109 * @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"}) 60 * @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"})
110 */ 61 */
111 private $entries; 62 protected $entries;
112 63
113 /** 64 /**
114 * @ORM\OneToOne(targetEntity="Config", mappedBy="user") 65 * @ORM\OneToOne(targetEntity="Config", mappedBy="user")
115 */ 66 */
116 private $config; 67 protected $config;
117 68
118 /** 69 /**
119 * @ORM\OneToMany(targetEntity="Tag", mappedBy="user", cascade={"remove"}) 70 * @ORM\OneToMany(targetEntity="Tag", mappedBy="user", cascade={"remove"})
120 */ 71 */
121 private $tags; 72 protected $tags;
122 73
123 public function __construct() 74 public function __construct()
124 { 75 {
125 $this->isActive = true; 76 parent::__construct();
126 $this->salt = md5(uniqid(null, true)); 77 $this->entries = new ArrayCollection();
127 $this->entries = new ArrayCollection(); 78 $this->tags = new ArrayCollection();
128 $this->tags = new ArrayCollection();
129 } 79 }
130 80
131 /** 81 /**
@@ -142,56 +92,6 @@ class User implements AdvancedUserInterface, \Serializable
142 } 92 }
143 93
144 /** 94 /**
145 * Get id.
146 *
147 * @return int
148 */
149 public function getId()
150 {
151 return $this->id;
152 }
153
154 /**
155 * Set username.
156 *
157 * @param string $username
158 *
159 * @return User
160 */
161 public function setUsername($username)
162 {
163 $this->username = $username;
164
165 return $this;
166 }
167
168 /**
169 * Get username.
170 *
171 * @return string
172 */
173 public function getUsername()
174 {
175 return $this->username;
176 }
177
178 /**
179 * {@inheritdoc}
180 */
181 public function getSalt()
182 {
183 return $this->salt;
184 }
185
186 /**
187 * {@inheritdoc}
188 */
189 public function getRoles()
190 {
191 return array('ROLE_USER');
192 }
193
194 /**
195 * Set password. 95 * Set password.
196 * 96 *
197 * @param string $password 97 * @param string $password
@@ -210,16 +110,6 @@ class User implements AdvancedUserInterface, \Serializable
210 } 110 }
211 111
212 /** 112 /**
213 * Get password.
214 *
215 * @return string
216 */
217 public function getPassword()
218 {
219 return $this->password;
220 }
221
222 /**
223 * Set name. 113 * Set name.
224 * 114 *
225 * @param string $name 115 * @param string $name
@@ -244,30 +134,6 @@ class User implements AdvancedUserInterface, \Serializable
244 } 134 }
245 135
246 /** 136 /**
247 * Set email.
248 *
249 * @param string $email
250 *
251 * @return User
252 */
253 public function setEmail($email)
254 {
255 $this->email = $email;
256
257 return $this;
258 }
259
260 /**
261 * Get email.
262 *
263 * @return string
264 */
265 public function getEmail()
266 {
267 return $this->email;
268 }
269
270 /**
271 * @return string 137 * @return string
272 */ 138 */
273 public function getCreatedAt() 139 public function getCreatedAt()
@@ -322,56 +188,12 @@ class User implements AdvancedUserInterface, \Serializable
322 { 188 {
323 return $this->tags; 189 return $this->tags;
324 } 190 }
325 /**
326 * {@inheritdoc}
327 */
328 public function eraseCredentials()
329 {
330 }
331
332 /**
333 * @see \Serializable::serialize()
334 */
335 public function serialize()
336 {
337 return serialize(array(
338 $this->id,
339 ));
340 }
341
342 /**
343 * @see \Serializable::unserialize()
344 */
345 public function unserialize($serialized)
346 {
347 list(
348 $this->id) = unserialize($serialized);
349 }
350 191
351 public function isEqualTo(UserInterface $user) 192 public function isEqualTo(UserInterface $user)
352 { 193 {
353 return $this->username === $user->getUsername(); 194 return $this->username === $user->getUsername();
354 } 195 }
355 196
356 public function isAccountNonExpired()
357 {
358 return true;
359 }
360
361 public function isAccountNonLocked()
362 {
363 return true;
364 }
365
366 public function isCredentialsNonExpired()
367 {
368 return true;
369 }
370
371 public function isEnabled()
372 {
373 return $this->isActive;
374 }
375 /** 197 /**
376 * Set config. 198 * Set config.
377 * 199 *
@@ -395,52 +217,4 @@ class User implements AdvancedUserInterface, \Serializable
395 { 217 {
396 return $this->config; 218 return $this->config;
397 } 219 }
398
399 /**
400 * Set confirmationToken.
401 *
402 * @param string $confirmationToken
403 *
404 * @return User
405 */
406 public function setConfirmationToken($confirmationToken)
407 {
408 $this->confirmationToken = $confirmationToken;
409
410 return $this;
411 }
412
413 /**
414 * Get confirmationToken.
415 *
416 * @return string
417 */
418 public function getConfirmationToken()
419 {
420 return $this->confirmationToken;
421 }
422
423 /**
424 * Set passwordRequestedAt.
425 *
426 * @param \DateTime $passwordRequestedAt
427 *
428 * @return User
429 */
430 public function setPasswordRequestedAt($passwordRequestedAt)
431 {
432 $this->passwordRequestedAt = $passwordRequestedAt;
433
434 return $this;
435 }
436
437 /**
438 * Get passwordRequestedAt.
439 *
440 * @return \DateTime
441 */
442 public function getPasswordRequestedAt()
443 {
444 return $this->passwordRequestedAt;
445 }
446} 220}
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
index 85d1a061..de95eed9 100644
--- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
@@ -39,10 +39,21 @@ class EntryFilterType extends AbstractType
39 $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); 39 $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%'));
40 40
41 return $filterQuery->createCondition($expression); 41 return $filterQuery->createCondition($expression);
42 }, 42 },
43 )) 43 ))
44 ->add('isArchived', 'filter_checkbox') 44 ->add('isArchived', 'filter_checkbox')
45 ->add('isStarred', 'filter_checkbox'); 45 ->add('isStarred', 'filter_checkbox')
46 ->add('previewPicture', 'filter_checkbox', array(
47 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
48 if (false === $values['value']) {
49 return;
50 }
51
52 $expression = $filterQuery->getExpr()->isNotNull($field);
53
54 return $filterQuery->createCondition($expression);
55 },
56 ));
46 } 57 }
47 58
48 public function getName() 59 public function getName()
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
index 1b628051..e3196d9c 100644
--- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
@@ -14,9 +14,16 @@ class UserInformationType extends AbstractType
14 ->add('name', 'text') 14 ->add('name', 'text')
15 ->add('email', 'email') 15 ->add('email', 'email')
16 ->add('save', 'submit') 16 ->add('save', 'submit')
17 ->remove('username')
18 ->remove('plainPassword')
17 ; 19 ;
18 } 20 }
19 21
22 public function getParent()
23 {
24 return 'fos_user_registration';
25 }
26
20 public function configureOptions(OptionsResolver $resolver) 27 public function configureOptions(OptionsResolver $resolver)
21 { 28 {
22 $resolver->setDefaults(array( 29 $resolver->setDefaults(array(
diff --git a/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig b/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig
index f669574e..5437d20c 100644
--- a/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig
@@ -30,6 +30,7 @@
30 </div> 30 </div>
31 31
32 <div class="row mts txtcenter"> 32 <div class="row mts txtcenter">
33 <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
33 <button type="submit">Login</button> 34 <button type="submit">Login</button>
34 <a href="{{ path('forgot_password') }}" class="small">Forgot your password?</a> 35 <a href="{{ path('forgot_password') }}" class="small">Forgot your password?</a>
35 </div> 36 </div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
index f7f53b9d..b46d8f11 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
@@ -62,7 +62,6 @@
62 {% endfor %} 62 {% endfor %}
63 </ul> 63 </ul>
64 64
65
66 <!-- Filters --> 65 <!-- Filters -->
67 <div id="filters" class="side-nav fixed right-aligned"> 66 <div id="filters" class="side-nav fixed right-aligned">
68 <form action="{{ path('all') }}"> 67 <form action="{{ path('all') }}">
@@ -75,6 +74,12 @@
75 <div class="col s12"> 74 <div class="col s12">
76 <label>{% trans %}Status{% endtrans %}</label> 75 <label>{% trans %}Status{% endtrans %}</label>
77 </div> 76 </div>
77
78 <div class="input-field col s6">
79 {{ form_widget(form.previewPicture) }}
80 <label for="entry_filter_previewPicture">{% trans %}Has a preview picture{% endtrans %}</label>
81 </div>
82
78 <div class="input-field col s6"> 83 <div class="input-field col s6">
79 {{ form_widget(form.isArchived) }} 84 {{ form_widget(form.isArchived) }}
80 <label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label> 85 <label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig
index 2c513ffe..c9979198 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig
@@ -44,6 +44,7 @@
44 44
45 </div> 45 </div>
46 <div class="card-action"> 46 <div class="card-action">
47 <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
47 <button class="btn waves-effect waves-light" type="submit" name="send"> 48 <button class="btn waves-effect waves-light" type="submit" name="send">
48 {% trans %}Login{% endtrans %} 49 {% trans %}Login{% endtrans %}
49 <i class="mdi-content-send right"></i> 50 <i class="mdi-content-send right"></i>
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
index 7a819953..24910e60 100644
--- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
@@ -41,7 +41,7 @@ class InstallCommandTest extends WallabagCoreTestCase
41 ->getMock(); 41 ->getMock();
42 $dialog->expects($this->any()) 42 $dialog->expects($this->any())
43 ->method('ask') 43 ->method('ask')
44 ->will($this->returnValue('test')); 44 ->will($this->returnValue('test_'.uniqid('', true)));
45 $dialog->expects($this->any()) 45 $dialog->expects($this->any())
46 ->method('askConfirmation') 46 ->method('askConfirmation')
47 ->will($this->returnValue(true)); 47 ->will($this->returnValue(true));
@@ -75,7 +75,7 @@ class InstallCommandTest extends WallabagCoreTestCase
75 ->getMock(); 75 ->getMock();
76 $dialog->expects($this->any()) 76 $dialog->expects($this->any())
77 ->method('ask') 77 ->method('ask')
78 ->will($this->returnValue('test')); 78 ->will($this->returnValue('test_'.uniqid('', true)));
79 $dialog->expects($this->any()) 79 $dialog->expects($this->any())
80 ->method('askConfirmation') 80 ->method('askConfirmation')
81 ->will($this->returnValue(true)); 81 ->will($this->returnValue(true));
@@ -125,7 +125,7 @@ class InstallCommandTest extends WallabagCoreTestCase
125 ->getMock(); 125 ->getMock();
126 $dialog->expects($this->any()) 126 $dialog->expects($this->any())
127 ->method('ask') 127 ->method('ask')
128 ->will($this->returnValue('test')); 128 ->will($this->returnValue('test_'.uniqid('', true)));
129 $dialog->expects($this->any()) 129 $dialog->expects($this->any())
130 ->method('askConfirmation') 130 ->method('askConfirmation')
131 ->will($this->returnValue(true)); 131 ->will($this->returnValue(true));
@@ -259,7 +259,7 @@ class InstallCommandTest extends WallabagCoreTestCase
259 ->getMock(); 259 ->getMock();
260 $dialog->expects($this->any()) 260 $dialog->expects($this->any())
261 ->method('ask') 261 ->method('ask')
262 ->will($this->returnValue('test')); 262 ->will($this->returnValue('test_'.uniqid('', true)));
263 $dialog->expects($this->any()) 263 $dialog->expects($this->any())
264 ->method('askConfirmation') 264 ->method('askConfirmation')
265 ->will($this->returnValue(true)); 265 ->will($this->returnValue(true));
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
index 5ab9c329..116eec60 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
@@ -192,14 +192,14 @@ class ConfigControllerTest extends WallabagCoreTestCase
192 'update_user[name]' => '', 192 'update_user[name]' => '',
193 'update_user[email]' => '', 193 'update_user[email]' => '',
194 ), 194 ),
195 'This value should not be blank.', 195 'Please enter an email',
196 ), 196 ),
197 array( 197 array(
198 array( 198 array(
199 'update_user[name]' => '', 199 'update_user[name]' => '',
200 'update_user[email]' => 'test', 200 'update_user[email]' => 'test',
201 ), 201 ),
202 'This value is not a valid email address.', 202 'The email is not valid',
203 ), 203 ),
204 ); 204 );
205 } 205 }
@@ -261,31 +261,23 @@ class ConfigControllerTest extends WallabagCoreTestCase
261 'new_user[password]' => '', 261 'new_user[password]' => '',
262 'new_user[email]' => '', 262 'new_user[email]' => '',
263 ), 263 ),
264 'This value should not be blank.', 264 'Please enter a username',
265 ), 265 ),
266 array( 266 array(
267 array( 267 array(
268 'new_user[username]' => 'ad', 268 'new_user[username]' => 'a',
269 'new_user[password]' => '', 269 'new_user[password]' => 'mypassword',
270 'new_user[email]' => '', 270 'new_user[email]' => '',
271 ), 271 ),
272 'This value is too short.', 272 'The username is too short',
273 ), 273 ),
274 array( 274 array(
275 array( 275 array(
276 'new_user[username]' => 'wallace', 276 'new_user[username]' => 'wallace',
277 'new_user[password]' => '', 277 'new_user[password]' => 'mypassword',
278 'new_user[email]' => 'test', 278 'new_user[email]' => 'test',
279 ), 279 ),
280 'This value is not a valid email address.', 280 'The email is not valid',
281 ),
282 array(
283 array(
284 'new_user[username]' => 'wallace',
285 'new_user[password]' => 'admin',
286 'new_user[email]' => 'wallace@wallace.me',
287 ),
288 'Password should by at least',
289 ), 281 ),
290 array( 282 array(
291 array( 283 array(
@@ -293,7 +285,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
293 'new_user[password]' => 'wallacewallace', 285 'new_user[password]' => 'wallacewallace',
294 'new_user[email]' => 'wallace@wallace.me', 286 'new_user[email]' => 'wallace@wallace.me',
295 ), 287 ),
296 'This value is already used', 288 'The username is already used',
297 ), 289 ),
298 ); 290 );
299 } 291 }
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index a0966285..77b57884 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -209,7 +209,7 @@ class EntryControllerTest extends WallabagCoreTestCase
209 $content = $client->getContainer() 209 $content = $client->getContainer()
210 ->get('doctrine.orm.entity_manager') 210 ->get('doctrine.orm.entity_manager')
211 ->getRepository('WallabagCoreBundle:Entry') 211 ->getRepository('WallabagCoreBundle:Entry')
212 ->findOneById(1); 212 ->findOneByIsStarred(false);
213 213
214 $client->request('GET', '/delete/'.$content->getId()); 214 $client->request('GET', '/delete/'.$content->getId());
215 215
@@ -360,13 +360,26 @@ class EntryControllerTest extends WallabagCoreTestCase
360 $form['entry_filter[isStarred]']->untick(); 360 $form['entry_filter[isStarred]']->untick();
361 361
362 $crawler = $client->submit($form); 362 $crawler = $client->submit($form);
363 $this->assertCount(1, $crawler->filter('div[class=entry]')); 363 $this->assertCount(2, $crawler->filter('div[class=entry]'));
364 364
365 $form = $crawler->filter('button[id=submit-filter]')->form(); 365 $form = $crawler->filter('button[id=submit-filter]')->form();
366 $form['entry_filter[isArchived]']->untick(); 366 $form['entry_filter[isArchived]']->untick();
367 $form['entry_filter[isStarred]']->tick(); 367 $form['entry_filter[isStarred]']->tick();
368 368
369 $crawler = $client->submit($form); 369 $crawler = $client->submit($form);
370 $this->assertCount(2, $crawler->filter('div[class=entry]'));
371 }
372
373 public function testPreviewPictureFilter()
374 {
375 $this->logInAs('admin');
376 $client = $this->getClient();
377
378 $crawler = $client->request('GET', '/unread/list');
379 $form = $crawler->filter('button[id=submit-filter]')->form();
380 $form['entry_filter[previewPicture]']->tick();
381
382 $crawler = $client->submit($form);
370 $this->assertCount(1, $crawler->filter('div[class=entry]')); 383 $this->assertCount(1, $crawler->filter('div[class=entry]'));
371 } 384 }
372} 385}
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php
index af39d6ce..d25b2db5 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php
@@ -24,7 +24,7 @@ class TagControllerTest extends WallabagCoreTestCase
24 $entry = $client->getContainer() 24 $entry = $client->getContainer()
25 ->get('doctrine.orm.entity_manager') 25 ->get('doctrine.orm.entity_manager')
26 ->getRepository('WallabagCoreBundle:Entry') 26 ->getRepository('WallabagCoreBundle:Entry')
27 ->findOneByIsArchived(false); 27 ->findOneBy(array());
28 28
29 $crawler = $client->request('GET', '/view/'.$entry->getId()); 29 $crawler = $client->request('GET', '/view/'.$entry->getId());
30 30