Skip to content

Commit 12aa4ed

Browse files
committed
MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart
1 parent 75c5285 commit 12aa4ed

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,5 @@
223223
$product->getSku(),
224224
[2]
225225
);
226+
227+
$productRepositoryFactory->getById(1, false, null, true);

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,10 @@ public function testReserveOrderId()
429429
/**
430430
* Test to verify that disabled product cannot be added to cart
431431
* @magentoDataFixture Magento/Quote/_files/disabled_product.php
432-
* @magentoAppIsolation enabled
433432
*/
434433
public function testAddedProductToQuoteIsSalable()
435434
{
436-
$productId = 1;
435+
$productId = 99;
437436
$objectManager = Bootstrap::getObjectManager();
438437

439438
/** @var ProductRepository $productRepository */

dev/tests/integration/testsuite/Magento/Quote/_files/disabled_product.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2016 Magento. All rights reserved.
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

@@ -9,7 +9,7 @@
99
$product = $objectManager->create(\Magento\Catalog\Model\Product::class);
1010
$product->isObjectNew(true);
1111
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
12-
->setId(1)
12+
->setId(99)
1313
->setAttributeSetId(4)
1414
->setWebsiteIds([1])
1515
->setName('Simple Product')
@@ -34,3 +34,7 @@
3434
)
3535
->setCanSaveCustomOptions(true)
3636
->setHasOptions(true);
37+
38+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepositoryFactory */
39+
$productRepositoryFactory = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
40+
$productRepositoryFactory->save($product);

dev/tests/integration/testsuite/Magento/SalesRule/Model/Quote/Address/Total/ShippingTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public function testRuleByProductWeightWithFreeShipping()
4242
$this->assertTrue(count($methods) > 0);
4343
$this->assertEquals('flatrate', $methods[0]->getMethodCode());
4444
$this->assertEquals(0, $methods[0]->getAmount());
45-
4645
}
4746

4847
/**
@@ -57,7 +56,6 @@ public function testRuleByProductWeightWithoutFreeShipping()
5756
$this->assertTrue(count($methods) > 0);
5857
$this->assertEquals('flatrate', $methods[0]->getMethodCode());
5958
$this->assertEquals(25, $methods[0]->getAmount());
60-
6159
}
6260

6361
/**

0 commit comments

Comments
 (0)