/**
  * {@inheritdoc}
  */
 public function delete()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'delete');
     if (!$pluginInfo) {
         return parent::delete();
     } else {
         return $this->___callPlugins('delete', func_get_args(), $pluginInfo);
     }
 }
 public function testDelete()
 {
     $groupId = 6;
     $this->group->expects($this->once())->method('getId')->willReturn($groupId);
     $this->groupRegistry->expects($this->once())->method('retrieve')->with($groupId)->willReturn($this->groupModel);
     $this->groupModel->expects($this->once())->method('usesAsDefault')->willReturn(false);
     $this->groupModel->expects($this->once())->method('delete');
     $this->groupRegistry->expects($this->once())->method('remove')->with($groupId);
     $this->assertTrue($this->model->delete($this->group));
 }
 public function testDelete()
 {
     $dbAdapter = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($dbAdapter));
     $customer = $this->getMock('Magento\\Customer\\Model\\Customer', ['__wakeup', 'load', 'getId', 'getStoreId', 'setGroupId', 'save'], [], '', false);
     $customerId = 1;
     $customer->expects($this->once())->method('getId')->will($this->returnValue($customerId));
     $customer->expects($this->once())->method('load')->with($customerId)->will($this->returnSelf());
     $defaultCustomerGroup = $this->getMock('Magento\\Customer\\Model\\Group', ['getId'], [], '', false);
     $this->groupManagement->expects($this->once())->method('getDefaultGroup')->will($this->returnValue($defaultCustomerGroup));
     $defaultCustomerGroup->expects($this->once())->method('getId')->will($this->returnValue(1));
     $customer->expects($this->once())->method('setGroupId')->with(1);
     $customerCollection = $this->getMock('Magento\\Customer\\Model\\ResourceModel\\Customer\\Collection', [], [], '', false);
     $customerCollection->expects($this->once())->method('addAttributeToFilter')->will($this->returnSelf());
     $customerCollection->expects($this->once())->method('load')->will($this->returnValue([$customer]));
     $this->customersFactory->expects($this->once())->method('create')->will($this->returnValue($customerCollection));
     $this->relationProcessorMock->expects($this->once())->method('delete');
     $this->groupModel->expects($this->any())->method('getData')->willReturn(['data' => 'value']);
     $this->groupResourceModel->delete($this->groupModel);
 }
 public function testCRUD()
 {
     $this->groupModel->setCode('test');
     $crud = new \Magento\TestFramework\Entity($this->groupModel, ['customer_group_code' => uniqid()]);
     $crud->testCrud();
 }
 /**
  * {@inheritdoc}
  */
 public function offsetGet($offset)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'offsetGet');
     if (!$pluginInfo) {
         return parent::offsetGet($offset);
     } else {
         return $this->___callPlugins('offsetGet', func_get_args(), $pluginInfo);
     }
 }