Skip to content

Commit

Permalink
Merge pull request #49 from magento-epam/MAGETWO-91701-V2
Browse files Browse the repository at this point in the history
MAGETWO-91701: Newsletter subscription is not correctly updated when …
  • Loading branch information
vital-pantsialeyeu committed Aug 13, 2018
2 parents a12c031 + 5da5e4e commit 9e726c3
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('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());
}

/**
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('customer_two@example.com', $result['subscriber_email']);
$this->assertEmpty($result);
}
}

0 comments on commit 9e726c3

Please sign in to comment.