Skip to content

Commit 12bc0c1

Browse files
author
Sergey Nosov
committed
Merge branch 'merchant_beta' into SUPEE-6995
2 parents b6ffa78 + 3c06d03 commit 12bc0c1

File tree

57 files changed

+1483
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1483
-555
lines changed

app/code/Magento/Catalog/Model/Layer/Category/FilterableAttributeList.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,18 @@ class FilterableAttributeList implements FilterableAttributeListInterface
2121
*/
2222
protected $storeManager;
2323

24-
/**
25-
* @var \Magento\Catalog\Model\Layer
26-
*/
27-
protected $layer;
28-
2924
/**
3025
* FilterableAttributeList constructor
3126
*
3227
* @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory
3328
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
34-
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
3529
*/
3630
public function __construct(
3731
\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory,
38-
\Magento\Store\Model\StoreManagerInterface $storeManager,
39-
\Magento\Catalog\Model\Layer\Resolver $layerResolver
32+
\Magento\Store\Model\StoreManagerInterface $storeManager
4033
) {
4134
$this->collectionFactory = $collectionFactory;
4235
$this->storeManager = $storeManager;
43-
$this->layer = $layerResolver->get();
4436
}
4537

4638
/**
@@ -50,14 +42,9 @@ public function __construct(
5042
*/
5143
public function getList()
5244
{
53-
$setIds = $this->layer->getProductCollection()->getSetIds();
54-
if (!$setIds) {
55-
return [];
56-
}
5745
/** @var $collection \Magento\Catalog\Model\Resource\Product\Attribute\Collection */
5846
$collection = $this->collectionFactory->create();
5947
$collection->setItemObjectClass('Magento\Catalog\Model\Resource\Eav\Attribute')
60-
->setAttributeSetFilter($setIds)
6148
->addStoreLabel($this->storeManager->getStore()->getId())
6249
->setOrder('position', 'ASC');
6350
$collection = $this->_prepareAttributeCollection($collection);

app/code/Magento/Catalog/Model/Layer/Search/CollectionFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ public function filter(
6464
->addStoreFilter()
6565
->addUrlRewrite()
6666
->setVisibility($this->productVisibility->getVisibleInSearchIds())
67-
->setOrder('relevance', Select::SQL_ASC);
67+
->setOrder('relevance', Select::SQL_DESC);
6868
}
6969
}

app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@
88

99
class FilterableAttributeList extends \Magento\Catalog\Model\Layer\Category\FilterableAttributeList
1010
{
11-
/**
12-
* @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory
13-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
14-
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
15-
*/
16-
public function __construct(
17-
\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory,
18-
\Magento\Store\Model\StoreManagerInterface $storeManager,
19-
\Magento\Catalog\Model\Layer\Resolver $layerResolver
20-
) {
21-
parent::__construct($collectionFactory, $storeManager, $layerResolver);
22-
}
23-
2411
/**
2512
* @param \Magento\Catalog\Model\Resource\Product\Attribute\Collection $collection
2613
* @return \Magento\Catalog\Model\Resource\Product\Attribute\Collection

app/code/Magento/Catalog/Test/Unit/Model/Layer/Category/FilterableAttributeListTest.php

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase
2525
*/
2626
protected $storeManagerMock;
2727

28-
/**
29-
* @var \PHPUnit_Framework_MockObject_MockObject
30-
*/
31-
protected $layerMock;
32-
3328
protected function setUp()
3429
{
3530
$this->collectionFactoryMock = $this->getMock(
@@ -39,50 +34,15 @@ protected function setUp()
3934
'\Magento\Store\Model\StoreManagerInterface', [], [], '', false
4035
);
4136

42-
$this->layerMock = $this->getMock(
43-
'Magento\Catalog\Model\Layer\Search', [], [], '', false
44-
);
45-
46-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Layer\Resolver $layerResolver */
47-
$layerResolver = $this->getMockBuilder('\Magento\Catalog\Model\Layer\Resolver')
48-
->disableOriginalConstructor()
49-
->setMethods(['get', 'create'])
50-
->getMock();
51-
$layerResolver->expects($this->any())
52-
->method($this->anything())
53-
->will($this->returnValue($this->layerMock));
54-
5537
$this->model = new \Magento\Catalog\Model\Layer\Search\FilterableAttributeList(
5638
$this->collectionFactoryMock,
57-
$this->storeManagerMock,
58-
$layerResolver
59-
);
60-
61-
}
62-
63-
public function testGetListWithEmptyIds()
64-
{
65-
$productCollectionMock = $this->getMock(
66-
'\Magento\Catalog\Model\Resource\Product\Collection', [], [], '', false
39+
$this->storeManagerMock
6740
);
68-
$this->layerMock->expects($this->once())->method('getProductCollection')
69-
->will($this->returnValue($productCollectionMock));
70-
$productCollectionMock->expects($this->once())->method('getSetIds')->will($this->returnValue([]));
7141

72-
$this->collectionFactoryMock->expects($this->never())->method('create');
73-
$this->assertEquals([], $this->model->getList());
7442
}
7543

7644
public function testGetList()
7745
{
78-
$productCollectionMock = $this->getMock(
79-
'\Magento\Catalog\Model\Resource\Product\Collection', [], [], '', false
80-
);
81-
$this->layerMock->expects($this->once())->method('getProductCollection')
82-
->will($this->returnValue($productCollectionMock));
83-
$setIds = [2, 3, 5];
84-
$productCollectionMock->expects($this->once())->method('getSetIds')->will($this->returnValue($setIds));
85-
8646
$storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false);
8747
$this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock));
8848

@@ -102,11 +62,6 @@ public function testGetList()
10262
->method('setItemObjectClass')
10363
->with('Magento\Catalog\Model\Resource\Eav\Attribute')
10464
->will($this->returnSelf());
105-
$collectionMock
106-
->expects($this->once())
107-
->method('setAttributeSetFilter')
108-
->with($setIds)
109-
->will($this->returnSelf());
11065
$collectionMock
11166
->expects($this->once())
11267
->method('addStoreLabel')

app/code/Magento/Catalog/Test/Unit/Model/Layer/Search/FilterableAttributeListTest.php

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase
2525
*/
2626
protected $storeManagerMock;
2727

28-
/**
29-
* @var \PHPUnit_Framework_MockObject_MockObject
30-
*/
31-
protected $layerMock;
32-
3328
protected function setUp()
3429
{
3530
$this->collectionFactoryMock = $this->getMock(
@@ -39,23 +34,9 @@ protected function setUp()
3934
'\Magento\Store\Model\StoreManagerInterface', [], [], '', false
4035
);
4136

42-
$this->layerMock = $this->getMock(
43-
'\Magento\Catalog\Model\Layer\Search', [], [], '', false
44-
);
45-
46-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Layer\Resolver $layerResolver */
47-
$layerResolver = $this->getMockBuilder('\Magento\Catalog\Model\Layer\Resolver')
48-
->disableOriginalConstructor()
49-
->setMethods(['get', 'create'])
50-
->getMock();
51-
$layerResolver->expects($this->any())
52-
->method($this->anything())
53-
->will($this->returnValue($this->layerMock));
54-
5537
$this->model = new \Magento\Catalog\Model\Layer\Search\FilterableAttributeList(
5638
$this->collectionFactoryMock,
57-
$this->storeManagerMock,
58-
$layerResolver
39+
$this->storeManagerMock
5940
);
6041

6142
}
@@ -65,14 +46,6 @@ protected function setUp()
6546
*/
6647
public function testGetList()
6748
{
68-
$productCollectionMock = $this->getMock(
69-
'\Magento\Catalog\Model\Resource\Product\Collection', [], [], '', false
70-
);
71-
$this->layerMock->expects($this->once())->method('getProductCollection')
72-
->will($this->returnValue($productCollectionMock));
73-
$setIds = [2, 3, 5];
74-
$productCollectionMock->expects($this->once())->method('getSetIds')->will($this->returnValue($setIds));
75-
7649
$storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false);
7750
$this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock));
7851

@@ -92,11 +65,6 @@ public function testGetList()
9265
->method('setItemObjectClass')
9366
->with('Magento\Catalog\Model\Resource\Eav\Attribute')
9467
->will($this->returnSelf());
95-
$collectionMock
96-
->expects($this->once())
97-
->method('setAttributeSetFilter')
98-
->with($setIds)
99-
->will($this->returnSelf());
10068
$collectionMock
10169
->expects($this->once())
10270
->method('addStoreLabel')

0 commit comments

Comments
 (0)