From ba32d4524154fef4e70e188ac2972b72937787ab Mon Sep 17 00:00:00 2001 From: Ishiki Date: Wed, 24 Jul 2019 12:28:36 +0300 Subject: [PATCH] Dashboard manager fails to determine dasbhoard For functional tests there is no user, as there is no user this throws exception. With this patch functional tests might work. --- src/Oro/Bundle/DashboardBundle/Model/Manager.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Oro/Bundle/DashboardBundle/Model/Manager.php b/src/Oro/Bundle/DashboardBundle/Model/Manager.php index 39b9f4a09c4..64abb08e363 100644 --- a/src/Oro/Bundle/DashboardBundle/Model/Manager.php +++ b/src/Oro/Bundle/DashboardBundle/Model/Manager.php @@ -206,12 +206,17 @@ public function remove(EntityModelInterface $entityModel) /** * Find active dashboard or default dashboard * - * @param User $user + * @param User|null $user * * @return DashboardModel|null */ - public function findUserActiveOrDefaultDashboard(User $user) + public function findUserActiveOrDefaultDashboard(?User $user) { + // No user, no way to determine dashboard. Even findDefaultDashboard requires proper user token. + if ($user === null) { + return null; + } + $activeDashboard = $this->findUserActiveDashboard($user); return $activeDashboard ? $activeDashboard : $this->findDefaultDashboard(); }