/** * @magentoAppArea adminhtml * @magentoDataFixture Magento/Newsletter/_files/subscribers.php */ public function testCustomerDeletedAdminArea() { $objectManager = Bootstrap::getObjectManager(); /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ $subscriber = $objectManager->create('Magento\\Newsletter\\Model\\Subscriber'); $subscriber->loadByEmail('*****@*****.**'); $this->assertTrue($subscriber->isSubscribed()); $this->accountService->deleteCustomer(1); $this->verifySubscriptionNotExist('*****@*****.**'); }
/** * @magentoAppArea adminhtml * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php * @expectedException \Magento\Framework\Exception\NoSuchEntityException * @expectedExceptionMessage No such entity with customerId = 1 */ public function testDeleteCustomerWithAddress() { //Verify address is created for the customer; $result = $this->_customerAddressService->getAddresses(1); $this->assertEquals(2, count($result)); // _files/customer.php sets the customer id to 1 $this->_customerAccountService->deleteCustomer(1); // Verify by directly loading the address by id $this->verifyDeletedAddress(1); $this->verifyDeletedAddress(2); //Verify by calling the Address Service. This will throw the expected exception since customerId doesn't exist $result = $this->_customerAddressService->getAddresses(1); }