10 use Magento\Customer\Api\Data\GroupInterfaceFactory;
12 use Magento\Customer\Model\ResourceModel\Group\CollectionFactory;
23 private $fixtureModelMock;
28 private $groupCollectionFactoryMock;
33 private $groupRepositoryMock;
38 private $groupFactoryMock;
43 private $groupDataObjectMock;
52 $this->fixtureModelMock = $this->getMockBuilder(\
Magento\Setup\Fixtures\FixtureModel::class)
53 ->disableOriginalConstructor()
57 $this->groupRepositoryMock = $this->getMockBuilder(GroupRepositoryInterface::class)
58 ->disableOriginalConstructor()
62 $this->groupCollectionFactoryMock = $this->getMockBuilder(CollectionFactory::class)
63 ->setMethods([
'create',
'getSize'])
64 ->disableOriginalConstructor()
67 $this->groupCollectionFactoryMock
68 ->expects($this->once())
70 ->willReturn($this->groupCollectionFactoryMock);
72 $this->groupCollectionFactoryMock
73 ->expects($this->once())
78 $this->groupDataObjectMock = $this->getMockBuilder(GroupInterface::class)
79 ->setMethods([
'setCode',
'setTaxClassId',
'save'])
80 ->disableOriginalConstructor()
81 ->getMockForAbstractClass();
84 $this->groupFactoryMock = $this->getMockBuilder(GroupInterfaceFactory::class)
85 ->setMethods([
'create'])
86 ->disableOriginalConstructor()
89 $this->groupFactoryMock
90 ->expects($this->once())
92 ->willReturn($this->groupDataObjectMock);
94 $this->groupDataObjectMock
95 ->expects($this->once())
97 ->willReturn($this->groupDataObjectMock);
99 $this->groupDataObjectMock
100 ->expects($this->once())
101 ->method(
'setTaxClassId')
102 ->willReturn($this->groupDataObjectMock);
104 $this->groupRepositoryMock
105 ->expects($this->once())
107 ->willReturn($this->groupDataObjectMock);
109 $this->fixtureModelMock
110 ->expects($this->once())
112 ->will($this->returnValue(1));
115 $this->fixtureModelMock,
116 $this->groupCollectionFactoryMock,
117 $this->groupRepositoryMock,
118 $this->groupFactoryMock
121 $this->model->execute();