From 5da5e4ea537cabae5c4e176a1bc90647437926c0 Mon Sep 17 00:00:00 2001 From: Vital_Pantsialeyeu Date: Tue, 14 Aug 2018 00:49:12 +0300 Subject: [PATCH] MAGETWO-91701: Newsletter subscription is not correctly updated when user is registered on 2 stores - Adding additional checking for guest customers --- .../Magento/Newsletter/Model/Plugin/PluginTest.php | 4 ++-- .../Newsletter/Model/ResourceModel/SubscriberTest.php | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php index 39db400d2d637..ab38dcf158c56 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/Plugin/PluginTest.php @@ -63,14 +63,14 @@ public function testCustomerCreated() ->setFirstname('Firstname') ->setLastname('Lastname') ->setEmail('customer_two@example.com'); - $createdCustomer = $this->customerRepository->save( + $this->customerRepository->save( $customerDataObject, $this->accountManagement->getPasswordHash('password') ); $subscriber->loadByEmail('customer_two@example.com'); $this->assertTrue($subscriber->isSubscribed()); - $this->assertEquals((int)$createdCustomer->getId(), (int)$subscriber->getCustomerId()); + $this->assertEquals(0, (int)$subscriber->getCustomerId()); } /** diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php index 356cedde57772..b6f9a22ff5273 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/ResourceModel/SubscriberTest.php @@ -40,15 +40,13 @@ public function testLoadByCustomerDataWithCustomerId() * @magentoDataFixture Magento/Newsletter/_files/subscribers.php * @magentoDataFixture Magento/Customer/_files/two_customers.php */ - public function testLoadByCustomerDataWithoutCustomerId() + public function testTryLoadByCustomerDataWithoutCustomerId() { /** @var \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository */ $customerRepository = Bootstrap::getObjectManager() ->create(\Magento\Customer\Api\CustomerRepositoryInterface::class); $customerData = $customerRepository->getById(2); $result = $this->_resourceModel->loadByCustomerData($customerData); - - $this->assertEquals(0, $result['customer_id']); - $this->assertEquals('customer_two@example.com', $result['subscriber_email']); + $this->assertEmpty($result); } }