Skip to content

Commit

Permalink
[framework] user is logged out after role change (#3459)
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmannmartin authored Sep 25, 2024
1 parent 7cf37ae commit 58c86ac
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\DataFixtures\Demo\ProductDataFixture;
use App\Model\Customer\User\CustomerUser;
use App\Model\Product\Product;
use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUserData;
use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUserDataFactory;
use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUserFacade;
use Shopsys\FrameworkBundle\Model\Customer\User\Role\CustomerUserRoleGroup;
Expand Down Expand Up @@ -39,7 +40,7 @@ protected function setUp(): void
$customerUserData = $this->customerUserDataFactory->createFromCustomerUser($customerUser);
$customerUserData->roleGroup = $this->getReference(CustomerUserRoleGroupDataFixture::ROLE_GROUP_LIMITED_USER, CustomerUserRoleGroup::class);

$this->customerUserFacade->editCustomerUser($customerUser->getId(), $customerUserData);
$this->editCustomerUser($customerUser->getId(), $customerUserData);

$this->login();
}
Expand Down Expand Up @@ -135,4 +136,17 @@ public function testCustomerUserCannotUseOrderingByPrice(): void

$this->assertSame('Ordering by price is not allowed for current user.', $errors[0]['message']);
}

/**
* @param int $id
* @param \Shopsys\FrameworkBundle\Model\Customer\User\CustomerUserData $customerUserData
*/
private function editCustomerUser(int $id, CustomerUserData $customerUserData): void
{
$customerUser = $this->customerUserFacade->getCustomerUserById($id);

$customerUser->edit($customerUserData);

$this->em->flush();
}
}

0 comments on commit 58c86ac

Please sign in to comment.