Skip to content

Commit

Permalink
Merge pull request #2 from pogorivan/patch-1
Browse files Browse the repository at this point in the history
Update MergeUserWishlistItemsListener.php
  • Loading branch information
bitbager authored May 25, 2018
2 parents a247e9f + 8252e43 commit 43a5911
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/EventListener/MergeUserWishlistItemsListenerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function it_adds_cookie_items_to_user_items_if_both_exist(
$token->getUser()->willReturn($shopUser);
$interactiveLoginEvent->getRequest()->willReturn($request);
$request->cookies = $parameterBag;
$parameterBag->get('bitbag_sylius_wishlist')->willReturn("Fq8N4W6mk12i9J2HX0U60POGG5UEzSgGW37OWd6sv2dd8FlBId");
$parameterBag->get('bitbag_sylius_wishlist', '')->willReturn("Fq8N4W6mk12i9J2HX0U60POGG5UEzSgGW37OWd6sv2dd8FlBId");
$wishlistRepository->findByToken("Fq8N4W6mk12i9J2HX0U60POGG5UEzSgGW37OWd6sv2dd8FlBId")->willReturn($cookieWishlist);
$wishlistRepository->findByShopUser($shopUser)->willReturn($userWishlist);
$cookieWishlist->getWishlistProducts()->willReturn(new ArrayCollection([$wishlistProduct->getWrappedObject()]));
Expand All @@ -94,7 +94,7 @@ function it_associates_anon_wishlsit_with_a_user_if_user_does_not_have_one(
$token->getUser()->willReturn($shopUser);
$interactiveLoginEvent->getRequest()->willReturn($request);
$request->cookies = $parameterBag;
$parameterBag->get('bitbag_sylius_wishlist')->willReturn("Fq8N4W6mk12i9J2HX0U60POGG5UEzSgGW37OWd6sv2dd8FlBId");
$parameterBag->get('bitbag_sylius_wishlist', '')->willReturn("Fq8N4W6mk12i9J2HX0U60POGG5UEzSgGW37OWd6sv2dd8FlBId");
$wishlistRepository->findByToken("Fq8N4W6mk12i9J2HX0U60POGG5UEzSgGW37OWd6sv2dd8FlBId")->willReturn($cookieWishlist);
$wishlistRepository->findByShopUser($shopUser)->willReturn(null);

Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/MergeUserWishlistItemsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function onInteractiveLogin(InteractiveLoginEvent $interactiveLoginEvent)

private function resolveWishlist(Request $request, ShopUserInterface $shopUser): void
{
$cookieWishlistToken = $request->cookies->get($this->wishlistCookieToken);
$cookieWishlistToken = $request->cookies->get($this->wishlistCookieToken, '');
/** @var WishlistInterface|null $cookieWishlist */
$cookieWishlist = $this->wishlistRepository->findByToken($cookieWishlistToken);
$userWishlist = $this->wishlistRepository->findByShopUser($shopUser);
Expand Down

0 comments on commit 43a5911

Please sign in to comment.