Skip to content

Commit

Permalink
MAGETWO-91701: Newsletter subscription is not correctly updated when …
Browse files Browse the repository at this point in the history
…user is registered on 2 stores

- Adding additional checking for guest customers
  • Loading branch information
vital-pantsialeyeu committed Aug 13, 2018
1 parent e3a9ac2 commit 5da5e4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ public function testCustomerCreated()
->setFirstname('Firstname')
->setLastname('Lastname')
->setEmail('[email protected]');
$createdCustomer = $this->customerRepository->save(
$this->customerRepository->save(
$customerDataObject,
$this->accountManagement->getPasswordHash('password')
);

$subscriber->loadByEmail('[email protected]');
$this->assertTrue($subscriber->isSubscribed());
$this->assertEquals((int)$createdCustomer->getId(), (int)$subscriber->getCustomerId());
$this->assertEquals(0, (int)$subscriber->getCustomerId());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('[email protected]', $result['subscriber_email']);
$this->assertEmpty($result);
}
}

0 comments on commit 5da5e4e

Please sign in to comment.