Skip to content

Commit add4a41

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-47017' into BUGS
2 parents 07a3994 + a74f11b commit add4a41

File tree

9 files changed

+55
-27
lines changed

9 files changed

+55
-27
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO
564564
$this->resourceModel->getLinkField(),
565565
$existingProduct->getData($this->resourceModel->getLinkField())
566566
);
567+
if (!$product->hasData(Product::STATUS)) {
568+
$product->setStatus($existingProduct->getStatus());
569+
}
567570
} catch (NoSuchEntityException $e) {
568571
$existingProduct = null;
569572
}

app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
<item name="add_variables" xsi:type="boolean">false</item>
194194
<item name="add_widgets" xsi:type="boolean">false</item>
195195
<item name="add_images" xsi:type="boolean">false</item>
196+
<item name="add_directives" xsi:type="boolean">true</item>
196197
</item>
197198
<item name="source" xsi:type="string">category</item>
198199
</item>

app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase
6565
*/
6666
private $storeManager;
6767

68-
/**
69-
* @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
70-
*/
71-
private $registry;
72-
7368
protected function setUp()
7469
{
7570
$this->mockContextObject();
@@ -174,11 +169,6 @@ public function testGetJsonConfig()
174169
->method('getId')
175170
->willReturn($productId);
176171

177-
$this->registry->expects($this->any())
178-
->method('registry')
179-
->with('product')
180-
->willReturn($productMock);
181-
182172
$this->helper->expects($this->any())
183173
->method('getOptions')
184174
->with($productMock, [$productMock])
@@ -217,6 +207,8 @@ public function testGetJsonConfig()
217207
->with($expectedArray)
218208
->willReturn($expectedJson);
219209

210+
$this->block->setData('product', $productMock);
211+
220212
$result = $this->block->getJsonConfig();
221213
$this->assertEquals($expectedJson, $result);
222214
}
@@ -330,19 +322,12 @@ protected function mockContextObject()
330322
$this->storeManager = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
331323
->getMockForAbstractClass();
332324

333-
$this->registry = $this->getMockBuilder(\Magento\Framework\Registry::class)
334-
->disableOriginalConstructor()
335-
->getMock();
336-
337325
$this->context = $this->getMockBuilder(\Magento\Catalog\Block\Product\Context::class)
338326
->disableOriginalConstructor()
339327
->getMock();
340328
$this->context->expects($this->any())
341329
->method('getStoreManager')
342330
->willReturn($this->storeManager);
343-
$this->context->expects($this->any())
344-
->method('getRegistry')
345-
->willReturn($this->registry);
346331
}
347332

348333
/**

app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace Magento\Cron\Observer;
1111

1212
use Magento\Framework\App\State;
13-
use Magento\Framework\Console\CLI;
13+
use Magento\Framework\Console\Cli;
1414
use Magento\Framework\Event\ObserverInterface;
1515
use \Magento\Cron\Model\Schedule;
1616

@@ -188,7 +188,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
188188
) == 1
189189
)) {
190190
$this->_shell->execute(
191-
$phpPath . ' %s cron:run --group=' . $groupId . ' --' . CLI::INPUT_KEY_BOOTSTRAP . '='
191+
$phpPath . ' %s cron:run --group=' . $groupId . ' --' . Cli::INPUT_KEY_BOOTSTRAP . '='
192192
. self::STANDALONE_PROCESS_STARTED . '=1',
193193
[
194194
BP . '/bin/magento'

app/code/Magento/Theme/view/frontend/templates/html/breadcrumbs.phtml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
<?php foreach ($crumbs as $crumbName => $crumbInfo) : ?>
1414
<li class="item <?php /* @escapeNotVerified */ echo $crumbName ?>">
1515
<?php if ($crumbInfo['link']) : ?>
16-
<a href="<?php /* @escapeNotVerified */ echo $crumbInfo['link'] ?>" title="<?php echo $block->escapeHtml($crumbInfo['title']) ?>">
17-
<?php echo $block->escapeHtml($crumbInfo['label']) ?>
18-
</a>
16+
<a href="<?php /* @escapeNotVerified */ echo $crumbInfo['link'] ?>" title="<?php echo $block->escapeHtml($crumbInfo['title']) ?>"><?php echo $block->escapeHtml($crumbInfo['label']) ?></a>
1917
<?php elseif ($crumbInfo['last']) : ?>
2018
<strong><?php echo $block->escapeHtml($crumbInfo['label']) ?></strong>
2119
<?php else: ?>

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,4 +1266,34 @@ public function testSpecialPrice()
12661266
$this->assertEquals(0, count(array_intersect($attributeCodes, $missingAttributes)));
12671267
$this->assertEquals(2, count(array_intersect($attributeCodes, $expectedAttribute)));
12681268
}
1269+
1270+
public function testUpdateStatus()
1271+
{
1272+
// Create simple product
1273+
$productData = [
1274+
ProductInterface::SKU => "product_simple_502",
1275+
ProductInterface::NAME => "Product Simple 502",
1276+
ProductInterface::VISIBILITY => 4,
1277+
ProductInterface::TYPE_ID => 'simple',
1278+
ProductInterface::PRICE => 100,
1279+
ProductInterface::STATUS => 0,
1280+
ProductInterface::TYPE_ID => 'simple',
1281+
ProductInterface::ATTRIBUTE_SET_ID => 4,
1282+
];
1283+
1284+
// Save product with status disabled
1285+
$this->saveProduct($productData);
1286+
$response = $this->getProduct($productData[ProductInterface::SKU]);
1287+
$this->assertEquals(0, $response['status']);
1288+
1289+
// Update the product
1290+
$productData[ProductInterface::PRICE] = 200;
1291+
$this->saveProduct($productData);
1292+
$response = $this->getProduct($productData[ProductInterface::SKU]);
1293+
1294+
// Status should still be disabled
1295+
$this->assertEquals(0, $response['status']);
1296+
// Price should be updated
1297+
$this->assertEquals(200, $response['price']);
1298+
}
12691299
}

lib/internal/Magento/Framework/Exception/LocalizedException.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ class LocalizedException extends \Exception
2626
protected $logMessage;
2727

2828
/**
29-
* Constructor
30-
*
3129
* @param \Magento\Framework\Phrase $phrase
3230
* @param \Exception $cause
31+
* @param int $code
3332
*/
34-
public function __construct(Phrase $phrase, \Exception $cause = null)
33+
public function __construct(Phrase $phrase, \Exception $cause = null, $code = 0)
3534
{
3635
$this->phrase = $phrase;
37-
parent::__construct($phrase->render(), 0, $cause);
36+
parent::__construct($phrase->render(), intval($code), $cause);
3837
}
3938

4039
/**

lib/internal/Magento/Framework/Exception/Test/Unit/LocalizedExceptionTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,16 @@ public function testGetLogMessage()
150150
$expectedLogMessage = 'message parameter1 parameter2';
151151
$this->assertEquals($expectedLogMessage, $localizeException->getLogMessage());
152152
}
153+
154+
public function testGetCode()
155+
{
156+
$expectedCode = 42;
157+
$localizedException = new LocalizedException(
158+
new Phrase("message %1", ['test']),
159+
new \Exception(),
160+
$expectedCode
161+
);
162+
163+
$this->assertEquals($expectedCode, $localizedException->getCode());
164+
}
153165
}

setup/src/Magento/Setup/Model/UninstallCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function collectUninstall($filterModules = [])
5656
$setup = $this->dataSetupFactory->create();
5757
$result = $setup->getConnection()->select()->from($setup->getTable('setup_module'), ['module']);
5858
if (isset($filterModules) && sizeof($filterModules) > 0) {
59-
$result->where('module in( ? )', implode(',', $filterModules));
59+
$result->where('module in( ? )', $filterModules);
6060
}
6161
// go through modules
6262
foreach ($setup->getConnection()->fetchAll($result) as $row) {

0 commit comments

Comments
 (0)