Skip to content

Commit 7638c01

Browse files
committed
ACP2E-341::Product is not getting added in wishlist from product list page and product view page when customer confirms account from confirmation email - Fixed Automation test & Modify Back URL
1 parent 83130a0 commit 7638c01

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/code/Magento/Wishlist/Plugin/SaveWishlistDataAndAddReferenceKeyToBackUrl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function beforeNewAccount(
7474
): array {
7575
if (($this->customerSession->getBeforeWishlistRequest() != null)
7676
&& ($customer->getConfirmation() != null)
77-
&& (strpos($backUrl, 'wishlist/index/add') !== false)
77+
&& ($backUrl !== null && strpos($backUrl, 'wishlist/index/add') !== false)
7878
) {
7979
$token = $this->dataSerializer->serialize($this->customerSession->getBeforeWishlistRequest());
8080
$query = [];

dev/tests/integration/testsuite/Magento/Wishlist/Controller/Index/AddTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ public function testCreateCustomerWithEmailConfirmationAfterAddToWishlist(): voi
185185
{
186186
$product = $this->productRepository->get('simple');
187187
$data = [];
188-
$data['product'] = (int) $product->getId();
188+
$data['product'] = (int)$product->getId();
189189
$this->customerSession->setBeforeWishlistRequest($data);
190-
$email = 'test_example_new31@email.com';
190+
$email = 'test_example_new@email.com';
191191
$this->fillRequestWithCustomerData($email);
192192
$this->dispatch('customer/account/createPost');
193193
$this->assertRedirect($this->stringContains('customer/account/index'));
@@ -234,15 +234,15 @@ public function testAddToWishlistOnCustomerConfirmation(): void
234234
$this->prepareReferer();
235235
$product = $this->productRepository->get('simple');
236236
$data = [];
237-
$data['product'] = (int) $product->getId();
237+
$data['product'] = (int)$product->getId();
238238
$token = $this->dataSerializer->serialize($data);//Save into Cache
239239
$customer = $this->customerRepository->get('unconfirmedcustomer@example.com');
240240
$customer->setConfirmation(null);
241241
$this->customerRepository->save($customer);
242242
$this->assertEquals(null, $customer->getConfirmation());
243-
$this->customerSession->setCustomerId((int) $customer->getId());
243+
$this->customerSession->setCustomerId((int)$customer->getId());
244244
$this->performAddToWishListRequest(['token' => $token]);
245-
$this->assertSuccess((int) $customer->getId(), 1, $product->getName());
245+
$this->assertSuccess((int)$customer->getId(), 1, $product->getName());
246246
}
247247

248248
/**

0 commit comments

Comments
 (0)