Exemplo n.º 1
0
 /**
  * @magentoDataFixture Magento/Newsletter/_files/problems.php
  */
 public function testAddCustomersData()
 {
     /** @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService */
     $customerAccountService = Bootstrap::getObjectManager()->create('Magento\\Customer\\Service\\V1\\CustomerAccountServiceInterface');
     $customer = $customerAccountService->getCustomerDetails(1)->getCustomer();
     /** @var \Magento\Newsletter\Model\Subscriber $subscriber */
     $subscriber = Bootstrap::getObjectManager()->create('Magento\\Newsletter\\Model\\Subscriber')->loadByEmail($customer->getEmail());
     /** @var \Magento\Newsletter\Model\Problem $problem */
     $problem = Bootstrap::getObjectManager()->create('Magento\\Newsletter\\Model\\Problem')->addSubscriberData($subscriber);
     $item = $this->_collection->addSubscriberInfo()->load()->getFirstItem();
     $this->assertEquals($problem->getProblemErrorCode(), $item->getErrorCode());
     $this->assertEquals($problem->getProblemErrorText(), $item->getErrorText());
     $this->assertEquals($problem->getSubscriberId(), $item->getSubscriberId());
     $this->assertEquals($customer->getEmail(), $item->getSubscriberEmail());
     $this->assertEquals($customer->getFirstname(), $item->getCustomerFirstName());
     $this->assertEquals($customer->getLastname(), $item->getCustomerLastName());
     $this->assertContains($customer->getFirstname(), $item->getCustomerName());
 }
Exemplo n.º 2
0
 /**
  * Adds queue info to grid
  *
  * @return \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection|\Magento\Newsletter\Model\Resource\Grid\Collection
  */
 protected function _initSelect()
 {
     parent::_initSelect();
     $this->addSubscriberInfo()->addQueueInfo();
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Return true if the size is greater than 0
  *
  * @return bool
  */
 public function getShowButtons()
 {
     return $this->_problemCollection->getSize() > 0;
 }