File tree 4 files changed +17
-6
lines changed
app/code/Magento/CatalogSearch
Test/Unit/Model/Layer/Filter 4 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,7 @@ public function getDataSet(
96
96
$ currencyRate = $ store ->getCurrentCurrencyRate () ? : 1 ;
97
97
$ valueExpr = new \Zend_Db_Expr ('main_table.min_price * ' . $ currencyRate );
98
98
$ table = $ this ->resource ->getTableName ('catalog_product_index_price ' );
99
- $ select ->from (['main_table ' => $ table ], null )
100
- ->columns ([BucketInterface::FIELD_VALUE => $ valueExpr ])
99
+ $ select ->from (['main_table ' => $ table ], [BucketInterface::FIELD_VALUE => $ valueExpr ])
101
100
->where ('main_table.customer_group_id = ? ' , $ this ->customerSession ->getCustomerGroupId ())
102
101
->where ('main_table.website_id = ? ' , $ store ->getWebsiteId ());
103
102
} else {
@@ -118,7 +117,7 @@ public function getDataSet(
118
117
->where ('stock_index.stock_status = ? ' , Stock::STOCK_IN_STOCK )
119
118
->group (['main_table.entity_id ' , 'main_table.value ' ]);
120
119
$ parentSelect = $ this ->getSelect ();
121
- $ parentSelect ->from (['main_table ' => $ subSelect ], ['main_table.value ' ]);
120
+ $ parentSelect ->from (['main_table ' => $ subSelect ], [BucketInterface:: FIELD_VALUE => 'main_table.value ' ]);
122
121
$ select = $ parentSelect ;
123
122
}
124
123
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ public function getAggregation(
133
133
) {
134
134
$ select = $ this ->dataProvider ->getDataSet ($ bucket , $ dimensions , $ entityStorage ->getSource ());
135
135
$ columns = array_column ($ select ->getPart (Select::COLUMNS ), 1 , 2 );
136
- $ valueColumn = (string ) $ columns [' value ' ];
136
+ $ valueColumn = (string ) $ columns [BucketInterface:: FIELD_VALUE ];
137
137
$ select ->reset (Select::COLUMNS );
138
138
$ rangeExpr = new \Zend_Db_Expr (
139
139
$ this ->connection ->getIfNullSql (
Original file line number Diff line number Diff line change @@ -158,8 +158,7 @@ public function getCurrencyRate()
158
158
{
159
159
$ rate = $ this ->_getData ('currency_rate ' );
160
160
if ($ rate === null ) {
161
- $ rate = $ this ->_storeManager ->getStore ($ this ->getStoreId ())
162
- ->getCurrentCurrencyRate ();
161
+ $ rate = $ this ->_storeManager ->getStore ()->getCurrentCurrencyRate ();
163
162
}
164
163
if (!$ rate ) {
165
164
$ rate = 1 ;
Original file line number Diff line number Diff line change @@ -129,6 +129,18 @@ protected function setUp()
129
129
->method ('escapeHtml ' )
130
130
->will ($ this ->returnArgument (0 ));
131
131
132
+ $ storeMock = $ this ->getMockBuilder (\Magento \Store \Api \Data \StoreInterface::class)
133
+ ->setMethods (['getCurrentCurrencyRate ' ])
134
+ ->getMockForAbstractClass ();
135
+ $ storeMock ->expects ($ this ->any ())
136
+ ->method ('getCurrentCurrencyRate ' )
137
+ ->willReturn (1 );
138
+ $ storeManagerMock = $ this ->getMockBuilder (\Magento \Store \Model \StoreManagerInterface::class)
139
+ ->getMockForAbstractClass ();
140
+ $ storeManagerMock ->expects ($ this ->any ())
141
+ ->method ('getStore ' )
142
+ ->willReturn ($ storeMock );
143
+
132
144
$ this ->attribute = $ this ->getMockBuilder ('\Magento\Eav\Model\Entity\Attribute ' )
133
145
->disableOriginalConstructor ()
134
146
->setMethods (['getAttributeCode ' , 'getFrontend ' , 'getIsFilterable ' ])
@@ -142,6 +154,7 @@ protected function setUp()
142
154
'itemDataBuilder ' => $ this ->itemDataBuilder ,
143
155
'filterItemFactory ' => $ this ->filterItemFactory ,
144
156
'escaper ' => $ escaper ,
157
+ 'storeManager ' => $ storeManagerMock ,
145
158
]
146
159
);
147
160
}
You can’t perform that action at this time.
0 commit comments