Skip to content

Commit f35c6eb

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop expedited
Accepted Community Pull Requests: - #24741: Resolve Suggested Terms Yes/No not in camel case #24739 (by @edenduong) - #24734: #24043: Better exception handling during cli commands. (by @p-bystritsky) - #24728: Fixed LayeredNavigation color filter show only loader for out of stock product (by @ravi-chandra3197) - #24494: #14012 fixed (by @vishalverma279) Fixed GitHub Issues: - #24739: Suggested Terms Yes/No not in camel case (reported by @bhavik43) has been fixed in #24741 by @edenduong in 2.3-develop branch Related commits: 1. 1ed98c6 - #24043: Better exception handling during cli commands (reported by @PascalBrouwers) has been fixed in #24734 by @p-bystritsky in 2.3-develop branch Related commits: 1. dfd481d - #24678: Static Content Deploy in developer mode without force flag is broken in 2.3-develop (reported by @hostep) has been fixed in #24734 by @p-bystritsky in 2.3-develop branch Related commits: 1. dfd481d - #14012: 2.2 - Admin will not create shipment from the invoice create screen if credit card was used (reported by @mzenner1) has been fixed in #24494 by @vishalverma279 in 2.3-develop branch Related commits: 1. 529e19d
2 parents 41b9991 + 7254da3 commit f35c6eb

File tree

5 files changed

+103
-15
lines changed

5 files changed

+103
-15
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ $_helper = $this->helper(Magento\Catalog\Helper\Output::class);
7272
</strong>
7373
<?= $block->getReviewsSummaryHtml($_product, $templateType) ?>
7474
<?= /* @noEscape */ $block->getProductPrice($_product) ?>
75-
<?= $block->getProductDetailsHtml($_product) ?>
75+
<?php if ($_product->isAvailable()) :?>
76+
<?= $block->getProductDetailsHtml($_product) ?>
77+
<?php endif; ?>
7678

7779
<div class="product-item-inner">
7880
<div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $block->escapeHtmlAttr($position) : '' ?>>

app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,18 @@ public function __construct(
8989
protected function _prepareShipment($invoice)
9090
{
9191
$invoiceData = $this->getRequest()->getParam('invoice');
92-
92+
$itemArr = [];
93+
if (!isset($invoiceData['items']) || empty($invoiceData['items'])) {
94+
$orderItems = $invoice->getOrder()->getItems();
95+
foreach ($orderItems as $item) {
96+
$itemArr[$item->getId()] = (int)$item->getQtyOrdered();
97+
}
98+
}
9399
$shipment = $this->shipmentFactory->create(
94100
$invoice->getOrder(),
95-
isset($invoiceData['items']) ? $invoiceData['items'] : [],
101+
isset($invoiceData['items']) ? $invoiceData['items'] : $itemArr,
96102
$this->getRequest()->getPost('tracking')
97103
);
98-
99104
if (!$shipment->getTotalQty()) {
100105
return false;
101106
}

app/code/Magento/Search/view/adminhtml/layout/search_term_grid_block.xml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,7 @@
8181
<argument name="sortable" xsi:type="string">1</argument>
8282
<argument name="index" xsi:type="string">display_in_terms</argument>
8383
<argument name="type" xsi:type="string">options</argument>
84-
<argument name="options" xsi:type="array">
85-
<item name="yes" xsi:type="array">
86-
<item name="value" xsi:type="string">1</item>
87-
<item name="label" xsi:type="string" translate="true">yes</item>
88-
</item>
89-
<item name="no" xsi:type="array">
90-
<item name="value" xsi:type="string">0</item>
91-
<item name="label" xsi:type="string" translate="true">no</item>
92-
</item>
93-
</argument>
84+
<argument name="options" xsi:type="options" model="Magento\Config\Model\Config\Source\Yesno"/>
9485
</arguments>
9586
</block>
9687
<block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.catalog.search.grid.columnSet.action" as="action">

lib/internal/Magento/Framework/Console/Cli.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Magento\Setup\Application;
2020
use Magento\Setup\Console\CompilerPreparation;
2121
use Magento\Setup\Model\ObjectManagerProvider;
22+
use Psr\Log\LoggerInterface;
2223
use Symfony\Component\Console;
2324
use Magento\Framework\Config\ConfigOptionsListConstants;
2425

@@ -61,6 +62,11 @@ class Cli extends Console\Application
6162
*/
6263
private $objectManager;
6364

65+
/**
66+
* @var LoggerInterface
67+
*/
68+
private $logger;
69+
6470
/**
6571
* @param string $name the application name
6672
* @param string $version the application version
@@ -94,6 +100,7 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
94100

95101
parent::__construct($name, $version);
96102
$this->serviceManager->setService(\Symfony\Component\Console\Application::class, $this);
103+
$this->logger = $this->objectManager->get(LoggerInterface::class);
97104
}
98105

99106
/**
@@ -107,7 +114,9 @@ public function doRun(Console\Input\InputInterface $input, Console\Output\Output
107114
try {
108115
$exitCode = parent::doRun($input, $output);
109116
} catch (\Exception $e) {
110-
$output->writeln($e->getTraceAsString());
117+
$errorMessage = $e->getMessage() . PHP_EOL . $e->getTraceAsString();
118+
$this->logger->error($errorMessage);
119+
$this->initException = $e;
111120
}
112121

113122
if ($this->initException) {
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Framework\Console\Test\Unit;
9+
10+
use Magento\Framework\Console\Cli;
11+
use PHPUnit\Framework\MockObject\MockObject;
12+
use Psr\Log\LoggerInterface;
13+
use Symfony\Component\Console\Input\InputInterface;
14+
use Symfony\Component\Console\Output\OutputInterface;
15+
16+
/**
17+
* Test for Magento\Framework\Console\Cli class.
18+
*/
19+
class CliTest extends \PHPUnit\Framework\TestCase
20+
{
21+
/**
22+
* @var Cli
23+
*/
24+
private $cli;
25+
26+
/**
27+
* @var InputInterface|MockObject
28+
*/
29+
private $inputMock;
30+
31+
/**
32+
* @var OutputInterface|MockObject
33+
*/
34+
private $outputMock;
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
protected function setUp()
40+
{
41+
$this->inputMock = $this->getMockBuilder(InputInterface::class)
42+
->getMockForAbstractClass();
43+
$this->outputMock = $this->getMockBuilder(OutputInterface::class)
44+
->getMockForAbstractClass();
45+
$this->cli = new Cli();
46+
}
47+
48+
/**
49+
* Make sure exception message is displayed and trace is logged.
50+
*
51+
* @expectedException \Exception
52+
* @expectedExceptionMessage Test message
53+
*/
54+
public function testDoRunExceptionLogging()
55+
{
56+
$e = new \Exception('Test message');
57+
$this->inputMock->expects($this->once())->method('getFirstArgument')->willThrowException($e);
58+
$loggerMock = $this->createMock(LoggerInterface::class);
59+
$loggerMock->expects($this->once())
60+
->method('error')
61+
->with($e->getMessage() . PHP_EOL . $e->getTraceAsString());
62+
$this->injectMock($loggerMock, 'logger');
63+
64+
$this->cli->doRun($this->inputMock, $this->outputMock);
65+
}
66+
67+
/**
68+
* Inject mock to Cli property.
69+
*
70+
* @param MockObject $mockObject
71+
* @param string $propertyName
72+
* @throws \ReflectionException
73+
*/
74+
private function injectMock(MockObject $mockObject, string $propertyName): void
75+
{
76+
$reflection = new \ReflectionClass(Cli::class);
77+
$reflectionProperty = $reflection->getProperty($propertyName);
78+
$reflectionProperty->setAccessible(true);
79+
$reflectionProperty->setValue($this->cli, $mockObject);
80+
}
81+
}

0 commit comments

Comments
 (0)