/** * @magentoDataFixture Magento/Newsletter/_files/subscribers.php * @magentoDataFixture Magento/Customer/_files/two_customers.php */ public function testLoadByCustomerDataWithoutCustomerId() { /** @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService */ $customerAccountService = Bootstrap::getObjectManager()->create('Magento\\Customer\\Service\\V1\\CustomerAccountServiceInterface'); $customerData = $customerAccountService->getCustomerDetails(2)->getCustomer(); $result = $this->_resourceModel->loadByCustomerData($customerData); $this->assertEquals(0, $result['customer_id']); $this->assertEquals('*****@*****.**', $result['subscriber_email']); }
/** * @magentoDataFixture Magento/Newsletter/_files/subscribers.php * @magentoDataFixture Magento/Customer/_files/two_customers.php */ public function testLoadByCustomerDataWithoutCustomerId() { /** @var \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository */ $customerRepository = Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\CustomerRepositoryInterface'); $customerData = $customerRepository->getById(2); $result = $this->_resourceModel->loadByCustomerData($customerData); $this->assertEquals(0, $result['customer_id']); $this->assertEquals('*****@*****.**', $result['subscriber_email']); }