47 $this->formFactory = $this->getMockForAbstractClass(
56 $this->customerFactory = $this->getMockForAbstractClass(
65 $this->storeManager = $this->getMockForAbstractClass(
66 \
Magento\Store\Model\StoreManagerInterface::class,
71 $this->customerGroupManagement = $this->getMockForAbstractClass(
77 $this->dataObjectHelper = $this->createMock(\
Magento\Framework\Api\DataObjectHelper::class);
78 $this->request = $this->getMockForAbstractClass(\
Magento\Framework\
App\RequestInterface::class, [],
'',
false);
79 $this->customerForm = $this->createMock(\
Magento\
Customer\Model\Metadata\Form::class);
80 $this->customerData = $this->getMockForAbstractClass(
86 $this->store = $this->getMockForAbstractClass(
87 \
Magento\Store\Api\Data\StoreInterface::class,
92 $this->customerGroup = $this->getMockForAbstractClass(
100 $this->customerFactory,
102 $this->customerGroupManagement,
103 $this->dataObjectHelper
110 'firstname' =>
'firstname',
111 'lastname' =>
'firstname',
112 'email' =>
'email.example.com',
115 $this->formFactory->expects($this->once())
117 ->with(
'customer',
'form-code')
118 ->willReturn($this->customerForm);
119 $this->customerForm->expects($this->once())
120 ->method(
'extractData')
121 ->with($this->request)
123 $this->customerForm->expects($this->once())
124 ->method(
'compactData')
127 $this->customerForm->expects($this->once())
128 ->method(
'getAllowedAttributes')
129 ->willReturn([
'group_id' =>
'attribute object']);
130 $this->customerFactory->expects($this->once())
132 ->willReturn($this->customerData);
133 $this->dataObjectHelper->expects($this->once())
134 ->method(
'populateWithArray')
136 ->willReturn($this->customerData);
137 $this->storeManager->expects($this->once())
139 ->willReturn($this->store);
140 $this->store->expects($this->exactly(2))
143 $this->customerGroupManagement->expects($this->once())
144 ->method(
'getDefaultGroup')
146 ->willReturn($this->customerGroup);
147 $this->customerGroup->expects($this->once())
150 $this->customerData->expects($this->once())
151 ->method(
'setGroupId')
153 $this->store->expects($this->once())
154 ->method(
'getWebsiteId')
156 $this->customerData->expects($this->once())
157 ->method(
'setWebsiteId')
159 $this->customerData->expects($this->once())
160 ->method(
'setStoreId')
163 $this->assertSame($this->customerData, $this->customerExtractor->extract(
'form-code', $this->request));