47 $this->designConfigFactory = $this->createPartialMock(
51 $this->metadataProvider = $this->getMockForAbstractClass(
57 $this->designConfigDataFactory = $this->createPartialMock(
61 $this->configExtensionFactory = $this->createPartialMock(
65 $this->designConfig = $this->getMockForAbstractClass(
71 $this->designConfigData = $this->getMockForAbstractClass(
77 $this->designConfigExtension = $this->getMockForAbstractClass(
84 [
'setDesignConfigData']
86 $this->scopeValidator = $this->getMockBuilder(\
Magento\Framework\
App\ScopeValidatorInterface::class)
87 ->getMockForAbstractClass();
88 $this->storeManager = $this->getMockBuilder(\
Magento\Store\Model\StoreManagerInterface::class)
89 ->getMockForAbstractClass();
90 $this->website = $this->getMockBuilder(\
Magento\Store\Api\
Data\WebsiteInterface::class)
91 ->getMockForAbstractClass();
94 $this->designConfigFactory,
95 $this->metadataProvider,
96 $this->designConfigDataFactory,
97 $this->configExtensionFactory,
98 $this->scopeValidator,
108 'header_default_title' =>
'value' 111 'header_default_title' => [
112 'path' =>
'design/header/default_title',
115 'head_default_description' => [
116 'path' =>
'design/head/default_description',
121 $this->scopeValidator->expects($this->once())
122 ->method(
'isValidScope')
123 ->with($scope, $scopeId)
125 $this->storeManager->expects($this->once())
126 ->method(
'isSingleStoreMode')
129 $this->designConfigFactory->expects($this->once())
131 ->willReturn($this->designConfig);
132 $this->designConfig->expects($this->once())
134 ->willReturn(
'default');
135 $this->designConfig->expects($this->once())
136 ->method(
'setScopeId')
138 $this->metadataProvider->expects($this->once())
140 ->willReturn($metadata);
141 $this->designConfigDataFactory->expects($this->exactly(2))
143 ->willReturn($this->designConfigData);
144 $this->designConfigData->expects($this->exactly(2))
147 [
'design/header/default_title'],
148 [
'design/head/default_description']
150 $this->designConfigData->expects($this->exactly(2))
151 ->method(
'setFieldConfig')
155 'path' =>
'design/header/default_title',
156 'fieldset' =>
'head',
157 'field' =>
'header_default_title' 162 'path' =>
'design/head/default_description',
163 'fieldset' =>
'head',
164 'field' =>
'head_default_description' 168 $this->designConfigData->expects($this->once())
171 $this->configExtensionFactory->expects($this->once())
173 ->willReturn($this->designConfigExtension);
174 $this->designConfigExtension->expects($this->once())
175 ->method(
'setDesignConfigData')
176 ->with([$this->designConfigData, $this->designConfigData]);
177 $this->designConfig->expects($this->once())
178 ->method(
'setExtensionAttributes')
179 ->with($this->designConfigExtension);
180 $this->assertSame($this->designConfig, $this->factory->create($scope, $scopeId,
$data));
188 'header_default_title' =>
'value' 191 'header_default_title' => [
192 'path' =>
'design/header/default_title',
195 'head_default_description' => [
196 'path' =>
'design/head/default_description',
201 $this->scopeValidator->expects($this->once())
202 ->method(
'isValidScope')
203 ->with($scope, $scopeId)
205 $this->storeManager->expects($this->once())
206 ->method(
'isSingleStoreMode')
208 $this->storeManager->expects($this->once())
209 ->method(
'getWebsites')
210 ->willReturn([$this->website]);
211 $this->website->expects($this->once())
215 $this->designConfigFactory->expects($this->once())
217 ->willReturn($this->designConfig);
218 $this->designConfig->expects($this->once())
220 ->willReturn(
'websites');
221 $this->designConfig->expects($this->once())
222 ->method(
'setScopeId')
224 $this->metadataProvider->expects($this->once())
226 ->willReturn($metadata);
227 $this->designConfigDataFactory->expects($this->exactly(2))
229 ->willReturn($this->designConfigData);
230 $this->designConfigData->expects($this->exactly(2))
233 [
'design/header/default_title'],
234 [
'design/head/default_description']
236 $this->designConfigData->expects($this->exactly(2))
237 ->method(
'setFieldConfig')
241 'path' =>
'design/header/default_title',
242 'fieldset' =>
'head',
243 'field' =>
'header_default_title' 248 'path' =>
'design/head/default_description',
249 'fieldset' =>
'head',
250 'field' =>
'head_default_description' 254 $this->designConfigData->expects($this->once())
257 $this->configExtensionFactory->expects($this->once())
259 ->willReturn($this->designConfigExtension);
260 $this->designConfigExtension->expects($this->once())
261 ->method(
'setDesignConfigData')
262 ->with([$this->designConfigData, $this->designConfigData]);
263 $this->designConfig->expects($this->once())
264 ->method(
'setExtensionAttributes')
265 ->with($this->designConfigExtension);
266 $this->assertSame($this->designConfig, $this->factory->create($scope, $scopeId,
$data));
testCreateInSingleStoreMode()