/** * @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']); }
public function testReceived() { $queue = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\Queue')->disableOriginalConstructor()->getMock(); $this->resource->expects($this->once())->method('received')->with($this->subscriber, $queue)->willReturnSelf(); $this->assertEquals($this->subscriber, $this->subscriber->received($queue)); }