|
@@ -62,6 +62,10 @@ class Controller extends BaseController
|
62
|
62
|
protected function isVisitor()
|
63
|
63
|
{
|
64
|
64
|
$user = $this->getUser();
|
|
65
|
+ if ($this->container->getParameter('env') == 'test')
|
|
66
|
+ {
|
|
67
|
+ $user = $this->getUserRefreshed();
|
|
68
|
+ }
|
65
|
69
|
if ($user === 'anon.')
|
66
|
70
|
{
|
67
|
71
|
return true;
|
|
@@ -204,22 +208,10 @@ class Controller extends BaseController
|
204
|
208
|
*/
|
205
|
209
|
protected function getUserId($return_null_if_visitor = false)
|
206
|
210
|
{
|
207
|
|
-
|
208
|
|
- /**
|
209
|
|
- * Bug lors des tests: L'user n'est pas 'lié' a celui en base par doctrine.
|
210
|
|
- * Docrine le voit si on faire une requete directe.
|
211
|
|
- */
|
|
211
|
+ /** Bug */
|
212
|
212
|
if ($this->container->getParameter('env') == 'test')
|
213
|
213
|
{
|
214
|
|
- $user_context = $this->container->get('security.context')->getToken()->getUser();
|
215
|
|
-
|
216
|
|
- if ($user_context !== 'anon.')
|
217
|
|
- {
|
218
|
|
- $user = $this->getDoctrine()->getRepository('MuzichCoreBundle:User')->findOneById(
|
219
|
|
- $user_context,
|
220
|
|
- array()
|
221
|
|
- )->getSingleResult();
|
222
|
|
- }
|
|
214
|
+ $user = $this->getUserRefreshed();
|
223
|
215
|
}
|
224
|
216
|
else
|
225
|
217
|
{
|