Skip to content

Commit 0dab612

Browse files
committed
MAGETWO-50893: No _Threshold_ message is displayed after buying product and its qty is not decreased
- fix static
1 parent c5cc0b5 commit 0dab612

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ protected function _isManageStock()
182182
*/
183183
protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = false)
184184
{
185-
$metadata = $this->getMetadataPool()->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
186185
$connection = $this->getConnection();
187186
$qtyExpr = $connection->getCheckSql('cisi.qty > 0', 'cisi.qty', 0);
188187
$select = $connection->select()->from(
@@ -202,7 +201,7 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f
202201
)->where(
203202
'cis.website_id = ?',
204203
$this->getStockConfiguration()->getDefaultScopeId()
205-
)->where( 'e.type_id = ?', $this->getTypeId())
204+
)->where('e.type_id = ?', $this->getTypeId())
206205
->group(['e.entity_id', 'cis.website_id', 'cis.stock_id']);
207206

208207
$select->columns(['status' => $this->getStatusExpression($connection, true)]);

app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* CatalogInventory Stock Status per website Resource Model
13+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1314
*/
1415
class Status extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1516
{

app/code/Magento/CatalogInventory/Test/Unit/Helper/StockTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function testAssignStatusToProduct()
9696
->disableOriginalConstructor()
9797
->setMethods(['setIsSalable', 'getId'])
9898
->getMock();
99-
$productMock->expects($this->once())
99+
$productMock->expects($this->once())
100100
->method('setIsSalable')
101101
->with($status);
102102
$this->assertNull($this->stock->assignStatusToProduct($productMock));

app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class IndexBuilderTest extends \PHPUnit_Framework_TestCase
5858
*/
5959
private $scopeInterface;
6060

61+
/**
62+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
63+
* @return void
64+
*/
6165
protected function setUp()
6266
{
6367
$this->select = $this->getMockBuilder('\Magento\Framework\DB\Select')
@@ -142,6 +146,9 @@ function ($left, $operator, $right) {
142146
'',
143147
false
144148
);
149+
$this->stockConfiguration = $this
150+
->getMockBuilder('\Magento\CatalogInventory\Api\StockConfigurationInterface')
151+
->getMock();
145152

146153
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
147154
$this->target = $objectManagerHelper->getObject(
@@ -156,14 +163,6 @@ function ($left, $operator, $right) {
156163
'dimensionScopeResolver' => $this->dimensionScopeResolver
157164
]
158165
);
159-
$this->initStockConfiguration();
160-
}
161-
162-
protected function initStockConfiguration()
163-
{
164-
$this->stockConfiguration = $this
165-
->getMockBuilder('\Magento\CatalogInventory\Api\StockConfigurationInterface')
166-
->getMock();
167166

168167
// Todo: \Magento\Framework\TestFramework\Unit\Helper\ObjectManager to do this automatically (MAGETWO-49793)
169168
$reflection = new \ReflectionClass(get_class($this->target));

0 commit comments

Comments
 (0)