Skip to content

Commit 79d1ede

Browse files
committed
MAGETWO-86125: Sorting on price of configurable products in catalog not working properly
1 parent 44084c9 commit 79d1ede

File tree

2 files changed

+41
-80
lines changed

2 files changed

+41
-80
lines changed

app/code/Magento/Config/Model/Config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ private function getChangedPaths(
329329
* @param \Magento\Framework\DB\Transaction $saveTransaction
330330
* @param \Magento\Framework\DB\Transaction $deleteTransaction
331331
* @return void
332+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
332333
*/
333334
protected function _processGroup(
334335
$groupId,

app/code/Magento/Config/Test/Unit/Model/ConfigTest.php

Lines changed: 40 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,22 @@ public function testSaveToCheckAdminSystemConfigChangedSectionEvent()
152152
public function testSaveToCheckScopeDataSet()
153153
{
154154
$transactionMock = $this->createMock(\Magento\Framework\DB\Transaction::class);
155-
156155
$this->_transFactoryMock->expects($this->any())->method('create')->will($this->returnValue($transactionMock));
157156

158157
$this->_configLoaderMock->expects($this->any())->method('getConfigByPath')->will($this->returnValue([]));
159158

160-
$this->_eventManagerMock->expects(
161-
$this->at(0)
162-
)->method(
163-
'dispatch'
164-
)->with(
165-
$this->equalTo('admin_system_config_changed_section_section'),
166-
$this->arrayHasKey('website')
167-
);
168-
169-
$this->_eventManagerMock->expects(
170-
$this->at(0)
171-
)->method(
172-
'dispatch'
173-
)->with(
174-
$this->equalTo('admin_system_config_changed_section_section'),
175-
$this->arrayHasKey('store')
176-
);
159+
$this->_eventManagerMock->expects($this->at(0))
160+
->method('dispatch')
161+
->with(
162+
$this->equalTo('admin_system_config_changed_section_section'),
163+
$this->arrayHasKey('website')
164+
);
165+
$this->_eventManagerMock->expects($this->at(0))
166+
->method('dispatch')
167+
->with(
168+
$this->equalTo('admin_system_config_changed_section_section'),
169+
$this->arrayHasKey('store')
170+
);
177171

178172
$group = $this->createMock(\Magento\Config\Model\Config\Structure\Element\Group::class);
179173
$group->method('getPath')->willReturn('section/1');
@@ -182,51 +176,26 @@ public function testSaveToCheckScopeDataSet()
182176
$field->method('getGroupPath')->willReturn('section/1');
183177
$field->method('getId')->willReturn('key');
184178

185-
$this->_configStructure->expects(
186-
$this->at(0)
187-
)->method(
188-
'getElement'
189-
)->with(
190-
'section/1'
191-
)->will(
192-
$this->returnValue($group)
193-
);
194-
$this->_configStructure->expects(
195-
$this->at(1)
196-
)->method(
197-
'getElement'
198-
)->with(
199-
'section/1'
200-
)->will(
201-
$this->returnValue($group)
202-
);
203-
$this->_configStructure->expects(
204-
$this->at(2)
205-
)->method(
206-
'getElement'
207-
)->with(
208-
'section/1/key'
209-
)->will(
210-
$this->returnValue($field)
211-
);
212-
$this->_configStructure->expects(
213-
$this->at(3)
214-
)->method(
215-
'getElement'
216-
)->with(
217-
'section/1'
218-
)->will(
219-
$this->returnValue($group)
220-
);
221-
$this->_configStructure->expects(
222-
$this->at(4)
223-
)->method(
224-
'getElement'
225-
)->with(
226-
'section/1/key'
227-
)->will(
228-
$this->returnValue($field)
229-
);
179+
$this->_configStructure->expects($this->at(0))
180+
->method('getElement')
181+
->with('section/1')
182+
->will($this->returnValue($group));
183+
$this->_configStructure->expects($this->at(1))
184+
->method('getElement')
185+
->with('section/1')
186+
->will($this->returnValue($group));
187+
$this->_configStructure->expects($this->at(2))
188+
->method('getElement')
189+
->with('section/1/key')
190+
->will($this->returnValue($field));
191+
$this->_configStructure->expects($this->at(3))
192+
->method('getElement')
193+
->with('section/1')
194+
->will($this->returnValue($group));
195+
$this->_configStructure->expects($this->at(4))
196+
->method('getElement')
197+
->with('section/1/key')
198+
->will($this->returnValue($field));
230199

231200
$website = $this->createMock(\Magento\Store\Model\Website::class);
232201
$website->expects($this->any())->method('getCode')->will($this->returnValue('website_code'));
@@ -242,12 +211,9 @@ public function testSaveToCheckScopeDataSet()
242211
\Magento\Framework\App\Config\Value::class,
243212
['setPath', 'addData', '__sleep', '__wakeup']
244213
);
245-
$backendModel->expects(
246-
$this->once()
247-
)->method(
248-
'addData'
249-
)->with(
250-
[
214+
$backendModel->expects($this->once())
215+
->method('addData')
216+
->with([
251217
'field' => 'key',
252218
'groups' => [1 => ['fields' => ['key' => ['data']]]],
253219
'group_id' => null,
@@ -256,17 +222,11 @@ public function testSaveToCheckScopeDataSet()
256222
'scope_code' => 'website_code',
257223
'field_config' => null,
258224
'fieldset_data' => ['key' => null],
259-
]
260-
);
261-
$backendModel->expects(
262-
$this->once()
263-
)->method(
264-
'setPath'
265-
)->with(
266-
'section/1/key'
267-
)->will(
268-
$this->returnValue($backendModel)
269-
);
225+
]);
226+
$backendModel->expects($this->once())
227+
->method('setPath')
228+
->with('section/1/key')
229+
->will($this->returnValue($backendModel));
270230

271231
$this->_dataFactoryMock->expects($this->any())->method('create')->will($this->returnValue($backendModel));
272232

0 commit comments

Comments
 (0)