Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function deleteById($customerId)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'deleteById');
     if (!$pluginInfo) {
         return parent::deleteById($customerId);
     } else {
         return $this->___callPlugins('deleteById', func_get_args(), $pluginInfo);
     }
 }
 /**
  * @return void
  */
 public function testExecuteWithException()
 {
     $customerId = 1;
     $phrase = new \Magento\Framework\Phrase('some error');
     $this->requestMock->expects($this->once())->method('getParam')->with($this->equalTo('customer_id'))->will($this->returnValue($customerId));
     $this->customerRepositoryMock->expects($this->once())->method('getById')->with($customerId)->willReturn($this->customerDataMock);
     $this->accountManagementHelperMock->expects($this->once())->method('processUnlockData')->with($customerId)->willThrowException(new \Exception($phrase));
     $this->messageManagerMock->expects($this->once())->method('addError');
     $this->controller->execute();
 }
 public function testDelete()
 {
     $customerId = 14;
     $customerModel = $this->getMock('Magento\\Customer\\Model\\Customer', ['delete'], [], '', false);
     $this->customer->expects($this->once())->method('getId')->willReturn($customerId);
     $this->customerRegistry->expects($this->once())->method('retrieve')->with($customerId)->willReturn($customerModel);
     $customerModel->expects($this->once())->method('delete');
     $this->customerRegistry->expects($this->once())->method('remove')->with($customerId);
     $this->assertTrue($this->model->delete($this->customer));
 }